iclient-mapboxgl-es6.js 3.6 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769897708977189772897738977489775897768977789778897798978089781897828978389784897858978689787897888978989790897918979289793897948979589796897978979889799898008980189802898038980489805898068980789808898098981089811898128981389814898158981689817898188981989820898218982289823898248982589826898278982889829898308983189832898338983489835898368983789838898398984089841898428984389844898458984689847898488984989850898518985289853898548985589856898578985889859898608986189862898638986489865898668986789868898698987089871898728987389874898758987689877898788987989880898818988289883898848988589886898878988889889898908989189892898938989489895898968989789898898998990089901899028990389904899058990689907899088990989910899118991289913899148991589916899178991889919899208992189922899238992489925899268992789928899298993089931899328993389934899358993689937899388993989940899418994289943899448994589946899478994889949899508995189952899538995489955899568995789958899598996089961899628996389964899658996689967899688996989970899718997289973899748997589976899778997889979899808998189982899838998489985899868998789988899898999089991899928999389994899958999689997899988999990000900019000290003900049000590006900079000890009900109001190012900139001490015900169001790018900199002090021900229002390024900259002690027900289002990030900319003290033900349003590036900379003890039900409004190042900439004490045900469004790048900499005090051900529005390054900559005690057900589005990060900619006290063900649006590066900679006890069900709007190072900739007490075900769007790078900799008090081900829008390084900859008690087900889008990090900919009290093900949009590096900979009890099901009010190102901039010490105901069010790108901099011090111901129011390114901159011690117901189011990120901219012290123901249012590126901279012890129901309013190132901339013490135901369013790138901399014090141901429014390144901459014690147901489014990150901519015290153901549015590156901579015890159901609016190162901639016490165901669016790168901699017090171901729017390174901759017690177901789017990180901819018290183901849018590186901879018890189901909019190192901939019490195901969019790198901999020090201902029020390204902059020690207902089020990210902119021290213902149021590216902179021890219902209022190222902239022490225902269022790228902299023090231902329023390234902359023690237902389023990240902419024290243902449024590246902479024890249902509025190252902539025490255902569025790258902599026090261902629026390264902659026690267902689026990270902719027290273902749027590276902779027890279902809028190282902839028490285902869028790288902899029090291902929029390294902959029690297902989029990300903019030290303903049030590306903079030890309903109031190312903139031490315903169031790318903199032090321903229032390324903259032690327903289032990330903319033290333903349033590336903379033890339903409034190342903439034490345903469034790348903499035090351903529035390354903559035690357903589035990360903619036290363903649036590366903679036890369903709037190372903739037490375903769037790378903799038090381903829038390384903859038690387903889038990390903919039290393903949039590396903979039890399904009040190402904039040490405904069040790408904099041090411904129041390414904159041690417904189041990420904219042290423904249042590426904279042890429904309043190432904339043490435904369043790438904399044090441904429044390444904459044690447904489044990450904519045290453904549045590456904579045890459904609046190462904639046490465904669046790468904699047090471904729047390474904759047690477904789047990480904819048290483904849048590486904879048890489904909049190492904939049490495904969049790498904999050090501905029050390504905059050690507905089050990510905119051290513905149051590516905179051890519905209052190522905239052490525905269052790528905299053090531905329053390534905359053690537905389053990540905419054290543905449054590546905479054890549905509055190552905539055490555905569055790558905599056090561905629056390564905659056690567905689056990570905719057290573905749057590576905779057890579905809058190582905839058490585905869058790588905899059090591905929059390594905959059690597905989059990600906019060290603906049060590606906079060890609906109061190612906139061490615906169061790618906199062090621906229062390624906259062690627906289062990630906319063290633906349063590636906379063890639906409064190642906439064490645906469064790648906499065090651906529065390654906559065690657906589065990660906619066290663906649066590666906679066890669906709067190672906739067490675906769067790678906799068090681906829068390684906859068690687906889068990690906919069290693906949069590696906979069890699907009070190702907039070490705907069070790708907099071090711907129071390714907159071690717907189071990720907219072290723907249072590726907279072890729907309073190732907339073490735907369073790738907399074090741907429074390744907459074690747907489074990750907519075290753907549075590756907579075890759907609076190762907639076490765907669076790768907699077090771907729077390774907759077690777907789077990780907819078290783907849078590786907879078890789907909079190792907939079490795907969079790798907999080090801908029080390804908059080690807908089080990810908119081290813908149081590816908179081890819908209082190822908239082490825908269082790828908299083090831908329083390834908359083690837908389083990840908419084290843908449084590846908479084890849908509085190852908539085490855908569085790858908599086090861908629086390864908659086690867908689086990870908719087290873908749087590876908779087890879908809088190882908839088490885908869088790888908899089090891908929089390894908959089690897908989089990900909019090290903909049090590906909079090890909909109091190912909139091490915909169091790918909199092090921909229092390924909259092690927909289092990930909319093290933909349093590936909379093890939909409094190942909439094490945909469094790948909499095090951909529095390954909559095690957909589095990960909619096290963909649096590966909679096890969909709097190972909739097490975909769097790978909799098090981909829098390984909859098690987909889098990990909919099290993909949099590996909979099890999910009100191002910039100491005910069100791008910099101091011910129101391014910159101691017910189101991020910219102291023910249102591026910279102891029910309103191032910339103491035910369103791038910399104091041910429104391044910459104691047910489104991050910519105291053910549105591056910579105891059910609106191062910639106491065910669106791068910699107091071910729107391074910759107691077910789107991080910819108291083910849108591086910879108891089910909109191092910939109491095910969109791098910999110091101911029110391104911059110691107911089110991110911119111291113911149111591116911179111891119911209112191122911239112491125911269112791128911299113091131911329113391134911359113691137911389113991140911419114291143911449114591146911479114891149911509115191152911539115491155911569115791158911599116091161911629116391164911659116691167911689116991170911719117291173911749117591176911779117891179911809118191182911839118491185911869118791188911899119091191911929119391194911959119691197911989119991200912019120291203912049120591206912079120891209912109121191212912139121491215912169121791218912199122091221912229122391224912259122691227912289122991230912319123291233912349123591236912379123891239912409124191242912439124491245912469124791248912499125091251912529125391254912559125691257912589125991260912619126291263912649126591266912679126891269912709127191272912739127491275912769127791278912799128091281912829128391284912859128691287912889128991290912919129291293912949129591296912979129891299913009130191302913039130491305913069130791308913099131091311913129131391314913159131691317913189131991320913219132291323913249132591326913279132891329913309133191332913339133491335913369133791338913399134091341913429134391344913459134691347913489134991350913519135291353913549135591356913579135891359913609136191362913639136491365913669136791368913699137091371913729137391374913759137691377913789137991380913819138291383913849138591386913879138891389913909139191392913939139491395913969139791398913999140091401914029140391404914059140691407914089140991410914119141291413914149141591416914179141891419914209142191422914239142491425914269142791428914299143091431914329143391434914359143691437914389143991440914419144291443914449144591446914479144891449914509145191452914539145491455914569145791458914599146091461914629146391464914659146691467914689146991470914719147291473914749147591476914779147891479914809148191482914839148491485914869148791488914899149091491914929149391494914959149691497914989149991500915019150291503915049150591506915079150891509915109151191512915139151491515915169151791518915199152091521915229152391524915259152691527915289152991530915319153291533915349153591536915379153891539915409154191542915439154491545915469154791548915499155091551915529155391554915559155691557915589155991560915619156291563915649156591566915679156891569915709157191572915739157491575915769157791578915799158091581915829158391584915859158691587915889158991590915919159291593915949159591596915979159891599916009160191602916039160491605916069160791608916099161091611916129161391614916159161691617916189161991620916219162291623916249162591626916279162891629916309163191632916339163491635916369163791638916399164091641916429164391644916459164691647916489164991650916519165291653916549165591656916579165891659916609166191662916639166491665916669166791668916699167091671916729167391674916759167691677916789167991680916819168291683916849168591686916879168891689916909169191692916939169491695916969169791698916999170091701917029170391704917059170691707917089170991710917119171291713917149171591716917179171891719917209172191722917239172491725917269172791728917299173091731917329173391734917359173691737917389173991740917419174291743917449174591746917479174891749917509175191752917539175491755917569175791758917599176091761917629176391764917659176691767917689176991770917719177291773917749177591776917779177891779917809178191782917839178491785917869178791788917899179091791917929179391794917959179691797917989179991800918019180291803918049180591806918079180891809918109181191812918139181491815918169181791818918199182091821918229182391824918259182691827918289182991830918319183291833918349183591836918379183891839918409184191842918439184491845918469184791848918499185091851918529185391854918559185691857918589185991860918619186291863918649186591866918679186891869918709187191872918739187491875918769187791878918799188091881918829188391884918859188691887918889188991890918919189291893918949189591896918979189891899919009190191902919039190491905919069190791908919099191091911919129191391914919159191691917919189191991920919219192291923919249192591926919279192891929919309193191932919339193491935919369193791938919399194091941919429194391944919459194691947919489194991950919519195291953919549195591956919579195891959919609196191962919639196491965919669196791968919699197091971919729197391974919759197691977919789197991980919819198291983919849198591986919879198891989919909199191992919939199491995919969199791998919999200092001920029200392004920059200692007920089200992010920119201292013920149201592016920179201892019920209202192022920239202492025920269202792028920299203092031920329203392034920359203692037920389203992040920419204292043920449204592046920479204892049920509205192052920539205492055920569205792058920599206092061920629206392064920659206692067920689206992070920719207292073920749207592076920779207892079920809208192082920839208492085920869208792088920899209092091920929209392094920959209692097920989209992100921019210292103921049210592106921079210892109921109211192112921139211492115921169211792118921199212092121921229212392124921259212692127921289212992130921319213292133921349213592136921379213892139921409214192142921439214492145921469214792148921499215092151921529215392154921559215692157921589215992160921619216292163921649216592166921679216892169921709217192172921739217492175921769217792178921799218092181921829218392184921859218692187921889218992190921919219292193921949219592196921979219892199922009220192202922039220492205922069220792208922099221092211922129221392214922159221692217922189221992220922219222292223922249222592226922279222892229922309223192232922339223492235922369223792238922399224092241922429224392244922459224692247922489224992250922519225292253922549225592256922579225892259922609226192262922639226492265922669226792268922699227092271922729227392274922759227692277922789227992280922819228292283922849228592286922879228892289922909229192292922939229492295922969229792298922999230092301923029230392304923059230692307923089230992310923119231292313923149231592316923179231892319923209232192322923239232492325923269232792328923299233092331923329233392334923359233692337923389233992340923419234292343923449234592346923479234892349923509235192352923539235492355923569235792358923599236092361923629236392364923659236692367923689236992370923719237292373923749237592376923779237892379923809238192382923839238492385923869238792388923899239092391923929239392394923959239692397923989239992400924019240292403924049240592406924079240892409924109241192412924139241492415924169241792418924199242092421924229242392424924259242692427924289242992430924319243292433924349243592436924379243892439924409244192442924439244492445924469244792448924499245092451924529245392454924559245692457924589245992460924619246292463924649246592466924679246892469924709247192472924739247492475924769247792478924799248092481924829248392484924859248692487924889248992490924919249292493924949249592496924979249892499925009250192502925039250492505925069250792508925099251092511925129251392514925159251692517925189251992520925219252292523925249252592526925279252892529925309253192532925339253492535925369253792538925399254092541925429254392544925459254692547925489254992550925519255292553925549255592556925579255892559925609256192562925639256492565925669256792568925699257092571925729257392574925759257692577925789257992580925819258292583925849258592586925879258892589925909259192592925939259492595925969259792598925999260092601926029260392604926059260692607926089260992610926119261292613926149261592616926179261892619926209262192622926239262492625926269262792628926299263092631926329263392634926359263692637926389263992640926419264292643926449264592646926479264892649926509265192652926539265492655926569265792658926599266092661926629266392664926659266692667926689266992670926719267292673926749267592676926779267892679926809268192682926839268492685926869268792688926899269092691926929269392694926959269692697926989269992700927019270292703927049270592706927079270892709927109271192712927139271492715927169271792718927199272092721927229272392724927259272692727927289272992730927319273292733927349273592736927379273892739927409274192742927439274492745927469274792748927499275092751927529275392754927559275692757927589275992760927619276292763927649276592766927679276892769927709277192772927739277492775927769277792778927799278092781927829278392784927859278692787927889278992790927919279292793927949279592796927979279892799928009280192802928039280492805928069280792808928099281092811928129281392814928159281692817928189281992820928219282292823928249282592826928279282892829928309283192832928339283492835928369283792838928399284092841928429284392844928459284692847928489284992850928519285292853928549285592856928579285892859928609286192862928639286492865928669286792868928699287092871928729287392874928759287692877928789287992880928819288292883928849288592886928879288892889928909289192892928939289492895928969289792898928999290092901929029290392904929059290692907929089290992910929119291292913929149291592916929179291892919929209292192922929239292492925929269292792928929299293092931929329293392934929359293692937929389293992940929419294292943929449294592946929479294892949929509295192952929539295492955929569295792958929599296092961929629296392964929659296692967929689296992970929719297292973929749297592976929779297892979929809298192982929839298492985929869298792988929899299092991929929299392994929959299692997929989299993000930019300293003930049300593006930079300893009930109301193012930139301493015930169301793018930199302093021930229302393024930259302693027930289302993030930319303293033930349303593036930379303893039930409304193042930439304493045930469304793048930499305093051930529305393054930559305693057930589305993060930619306293063930649306593066930679306893069930709307193072930739307493075930769307793078930799308093081930829308393084930859308693087930889308993090930919309293093930949309593096930979309893099931009310193102931039310493105931069310793108931099311093111931129311393114931159311693117931189311993120931219312293123931249312593126931279312893129931309313193132931339313493135931369313793138931399314093141931429314393144931459314693147931489314993150931519315293153931549315593156931579315893159931609316193162931639316493165931669316793168931699317093171931729317393174931759317693177931789317993180931819318293183931849318593186931879318893189931909319193192931939319493195931969319793198931999320093201932029320393204932059320693207932089320993210932119321293213932149321593216932179321893219932209322193222932239322493225932269322793228932299323093231932329323393234932359323693237932389323993240932419324293243932449324593246932479324893249932509325193252932539325493255932569325793258932599326093261932629326393264932659326693267932689326993270932719327293273932749327593276932779327893279932809328193282932839328493285932869328793288932899329093291932929329393294932959329693297932989329993300933019330293303933049330593306933079330893309933109331193312933139331493315933169331793318933199332093321933229332393324933259332693327933289332993330933319333293333933349333593336933379333893339933409334193342933439334493345933469334793348933499335093351933529335393354933559335693357933589335993360933619336293363933649336593366933679336893369933709337193372933739337493375933769337793378933799338093381933829338393384933859338693387933889338993390933919339293393933949339593396933979339893399934009340193402934039340493405934069340793408934099341093411934129341393414934159341693417934189341993420934219342293423934249342593426934279342893429934309343193432934339343493435934369343793438934399344093441934429344393444934459344693447934489344993450934519345293453934549345593456934579345893459934609346193462934639346493465934669346793468934699347093471934729347393474934759347693477934789347993480934819348293483934849348593486934879348893489934909349193492934939349493495934969349793498934999350093501935029350393504935059350693507935089350993510935119351293513935149351593516935179351893519935209352193522935239352493525935269352793528935299353093531935329353393534935359353693537935389353993540935419354293543935449354593546935479354893549935509355193552935539355493555935569355793558935599356093561935629356393564935659356693567935689356993570935719357293573935749357593576935779357893579935809358193582935839358493585935869358793588935899359093591935929359393594935959359693597935989359993600936019360293603936049360593606936079360893609936109361193612936139361493615936169361793618936199362093621936229362393624936259362693627936289362993630936319363293633936349363593636936379363893639936409364193642936439364493645936469364793648936499365093651936529365393654936559365693657936589365993660936619366293663936649366593666936679366893669936709367193672936739367493675936769367793678936799368093681936829368393684936859368693687936889368993690936919369293693936949369593696936979369893699937009370193702937039370493705937069370793708937099371093711937129371393714937159371693717937189371993720937219372293723937249372593726937279372893729937309373193732937339373493735937369373793738937399374093741937429374393744937459374693747937489374993750937519375293753937549375593756937579375893759937609376193762937639376493765937669376793768937699377093771937729377393774937759377693777937789377993780937819378293783937849378593786937879378893789937909379193792937939379493795937969379793798937999380093801938029380393804938059380693807938089380993810938119381293813938149381593816938179381893819938209382193822938239382493825938269382793828938299383093831938329383393834938359383693837938389383993840938419384293843938449384593846938479384893849938509385193852938539385493855938569385793858938599386093861938629386393864938659386693867938689386993870938719387293873938749387593876938779387893879938809388193882938839388493885938869388793888938899389093891938929389393894938959389693897938989389993900939019390293903939049390593906939079390893909939109391193912939139391493915939169391793918939199392093921939229392393924939259392693927939289392993930939319393293933939349393593936939379393893939939409394193942939439394493945939469394793948939499395093951939529395393954939559395693957939589395993960939619396293963939649396593966939679396893969939709397193972939739397493975939769397793978939799398093981939829398393984939859398693987939889398993990939919399293993939949399593996939979399893999940009400194002940039400494005940069400794008940099401094011940129401394014940159401694017940189401994020940219402294023940249402594026940279402894029940309403194032940339403494035940369403794038940399404094041940429404394044940459404694047940489404994050940519405294053940549405594056940579405894059940609406194062940639406494065940669406794068940699407094071940729407394074940759407694077940789407994080940819408294083940849408594086940879408894089940909409194092940939409494095940969409794098940999410094101941029410394104941059410694107941089410994110941119411294113941149411594116941179411894119941209412194122941239412494125941269412794128941299413094131941329413394134941359413694137941389413994140941419414294143941449414594146941479414894149941509415194152941539415494155941569415794158941599416094161941629416394164941659416694167941689416994170941719417294173941749417594176941779417894179941809418194182941839418494185941869418794188941899419094191941929419394194941959419694197941989419994200942019420294203942049420594206942079420894209942109421194212942139421494215942169421794218942199422094221942229422394224942259422694227942289422994230942319423294233942349423594236942379423894239942409424194242942439424494245942469424794248942499425094251942529425394254942559425694257942589425994260942619426294263942649426594266942679426894269942709427194272942739427494275942769427794278942799428094281942829428394284942859428694287942889428994290942919429294293942949429594296942979429894299943009430194302943039430494305943069430794308943099431094311943129431394314943159431694317943189431994320943219432294323943249432594326943279432894329943309433194332943339433494335943369433794338943399434094341943429434394344943459434694347943489434994350943519435294353943549435594356943579435894359943609436194362943639436494365943669436794368943699437094371943729437394374943759437694377943789437994380943819438294383943849438594386943879438894389943909439194392943939439494395943969439794398943999440094401944029440394404944059440694407944089440994410944119441294413944149441594416944179441894419944209442194422944239442494425944269442794428944299443094431944329443394434944359443694437944389443994440944419444294443944449444594446944479444894449944509445194452944539445494455944569445794458944599446094461944629446394464944659446694467944689446994470944719447294473944749447594476944779447894479944809448194482944839448494485944869448794488944899449094491944929449394494944959449694497944989449994500945019450294503945049450594506945079450894509945109451194512945139451494515945169451794518945199452094521945229452394524945259452694527945289452994530945319453294533945349453594536945379453894539945409454194542945439454494545945469454794548945499455094551945529455394554945559455694557945589455994560945619456294563945649456594566945679456894569945709457194572945739457494575945769457794578945799458094581945829458394584945859458694587945889458994590945919459294593945949459594596945979459894599946009460194602946039460494605946069460794608946099461094611946129461394614946159461694617946189461994620946219462294623946249462594626946279462894629946309463194632946339463494635946369463794638946399464094641946429464394644946459464694647946489464994650946519465294653946549465594656946579465894659946609466194662946639466494665946669466794668946699467094671946729467394674946759467694677946789467994680946819468294683946849468594686946879468894689946909469194692946939469494695946969469794698946999470094701947029470394704947059470694707947089470994710947119471294713947149471594716947179471894719947209472194722947239472494725947269472794728947299473094731947329473394734947359473694737947389473994740947419474294743947449474594746947479474894749947509475194752947539475494755947569475794758947599476094761947629476394764947659476694767947689476994770947719477294773947749477594776947779477894779947809478194782947839478494785947869478794788947899479094791947929479394794947959479694797947989479994800948019480294803948049480594806948079480894809948109481194812948139481494815948169481794818948199482094821948229482394824948259482694827948289482994830948319483294833948349483594836948379483894839948409484194842948439484494845948469484794848948499485094851948529485394854948559485694857948589485994860948619486294863948649486594866948679486894869948709487194872948739487494875948769487794878948799488094881948829488394884948859488694887948889488994890948919489294893948949489594896948979489894899949009490194902949039490494905949069490794908949099491094911949129491394914949159491694917949189491994920949219492294923949249492594926949279492894929949309493194932949339493494935949369493794938949399494094941949429494394944949459494694947949489494994950949519495294953949549495594956949579495894959949609496194962949639496494965949669496794968949699497094971949729497394974949759497694977949789497994980949819498294983949849498594986949879498894989949909499194992949939499494995949969499794998949999500095001950029500395004950059500695007950089500995010950119501295013950149501595016950179501895019950209502195022950239502495025950269502795028950299503095031950329503395034950359503695037950389503995040950419504295043950449504595046950479504895049950509505195052950539505495055950569505795058950599506095061950629506395064950659506695067950689506995070950719507295073950749507595076950779507895079950809508195082950839508495085950869508795088950899509095091950929509395094950959509695097950989509995100951019510295103951049510595106951079510895109951109511195112951139511495115951169511795118951199512095121951229512395124951259512695127951289512995130951319513295133951349513595136951379513895139951409514195142951439514495145951469514795148951499515095151951529515395154951559515695157951589515995160951619516295163951649516595166951679516895169951709517195172951739517495175951769517795178951799518095181951829518395184951859518695187951889518995190951919519295193951949519595196951979519895199952009520195202952039520495205952069520795208952099521095211952129521395214952159521695217952189521995220952219522295223952249522595226952279522895229952309523195232952339523495235952369523795238952399524095241952429524395244952459524695247952489524995250952519525295253952549525595256952579525895259952609526195262952639526495265952669526795268952699527095271952729527395274952759527695277952789527995280952819528295283952849528595286952879528895289952909529195292952939529495295952969529795298952999530095301953029530395304953059530695307953089530995310953119531295313953149531595316953179531895319953209532195322953239532495325953269532795328953299533095331953329533395334953359533695337953389533995340953419534295343953449534595346953479534895349953509535195352953539535495355953569535795358953599536095361953629536395364953659536695367953689536995370953719537295373953749537595376953779537895379953809538195382953839538495385953869538795388953899539095391953929539395394953959539695397953989539995400954019540295403954049540595406954079540895409954109541195412954139541495415954169541795418954199542095421954229542395424954259542695427954289542995430954319543295433954349543595436954379543895439954409544195442954439544495445954469544795448954499545095451954529545395454954559545695457954589545995460954619546295463954649546595466954679546895469954709547195472954739547495475954769547795478954799548095481954829548395484954859548695487954889548995490954919549295493954949549595496954979549895499955009550195502955039550495505955069550795508955099551095511955129551395514955159551695517955189551995520955219552295523955249552595526955279552895529955309553195532955339553495535955369553795538955399554095541955429554395544955459554695547955489554995550955519555295553955549555595556955579555895559955609556195562955639556495565955669556795568955699557095571955729557395574955759557695577955789557995580955819558295583955849558595586955879558895589955909559195592955939559495595955969559795598955999560095601956029560395604956059560695607956089560995610956119561295613956149561595616956179561895619956209562195622956239562495625956269562795628956299563095631956329563395634956359563695637956389563995640956419564295643956449564595646956479564895649956509565195652956539565495655956569565795658956599566095661956629566395664956659566695667956689566995670956719567295673956749567595676956779567895679956809568195682956839568495685956869568795688956899569095691956929569395694956959569695697956989569995700957019570295703957049570595706957079570895709957109571195712957139571495715957169571795718957199572095721957229572395724957259572695727957289572995730957319573295733957349573595736957379573895739957409574195742957439574495745957469574795748957499575095751957529575395754957559575695757957589575995760957619576295763957649576595766957679576895769957709577195772957739577495775957769577795778957799578095781957829578395784957859578695787957889578995790957919579295793957949579595796957979579895799958009580195802958039580495805958069580795808958099581095811958129581395814958159581695817958189581995820958219582295823958249582595826958279582895829958309583195832958339583495835958369583795838958399584095841958429584395844958459584695847958489584995850958519585295853958549585595856958579585895859958609586195862958639586495865958669586795868958699587095871958729587395874958759587695877958789587995880958819588295883958849588595886958879588895889958909589195892958939589495895958969589795898958999590095901959029590395904959059590695907959089590995910959119591295913959149591595916959179591895919959209592195922959239592495925959269592795928959299593095931959329593395934959359593695937959389593995940959419594295943959449594595946959479594895949959509595195952959539595495955959569595795958959599596095961959629596395964959659596695967959689596995970959719597295973959749597595976959779597895979959809598195982959839598495985959869598795988959899599095991959929599395994959959599695997959989599996000960019600296003960049600596006960079600896009960109601196012960139601496015960169601796018960199602096021960229602396024960259602696027960289602996030960319603296033960349603596036960379603896039960409604196042960439604496045960469604796048960499605096051960529605396054960559605696057960589605996060960619606296063960649606596066960679606896069960709607196072960739607496075960769607796078960799608096081960829608396084960859608696087960889608996090960919609296093960949609596096960979609896099961009610196102961039610496105961069610796108961099611096111961129611396114961159611696117961189611996120961219612296123961249612596126961279612896129961309613196132961339613496135961369613796138961399614096141961429614396144961459614696147961489614996150961519615296153961549615596156961579615896159961609616196162961639616496165961669616796168961699617096171961729617396174961759617696177961789617996180961819618296183961849618596186961879618896189961909619196192961939619496195961969619796198961999620096201962029620396204962059620696207962089620996210962119621296213962149621596216962179621896219962209622196222962239622496225962269622796228962299623096231962329623396234962359623696237962389623996240962419624296243962449624596246962479624896249962509625196252962539625496255962569625796258962599626096261962629626396264962659626696267962689626996270962719627296273962749627596276962779627896279962809628196282962839628496285962869628796288962899629096291962929629396294962959629696297962989629996300963019630296303963049630596306963079630896309963109631196312963139631496315963169631796318963199632096321963229632396324963259632696327963289632996330963319633296333963349633596336963379633896339963409634196342963439634496345963469634796348963499635096351963529635396354963559635696357963589635996360963619636296363963649636596366963679636896369963709637196372963739637496375963769637796378963799638096381963829638396384963859638696387963889638996390963919639296393963949639596396963979639896399964009640196402964039640496405964069640796408964099641096411964129641396414964159641696417964189641996420964219642296423964249642596426964279642896429964309643196432964339643496435964369643796438964399644096441964429644396444964459644696447964489644996450964519645296453964549645596456964579645896459964609646196462964639646496465964669646796468964699647096471964729647396474964759647696477964789647996480964819648296483964849648596486964879648896489964909649196492964939649496495964969649796498964999650096501965029650396504965059650696507965089650996510965119651296513965149651596516965179651896519965209652196522965239652496525965269652796528965299653096531965329653396534965359653696537965389653996540965419654296543965449654596546965479654896549965509655196552965539655496555965569655796558965599656096561965629656396564965659656696567965689656996570965719657296573965749657596576965779657896579965809658196582965839658496585965869658796588965899659096591965929659396594965959659696597965989659996600966019660296603966049660596606966079660896609966109661196612966139661496615966169661796618966199662096621966229662396624966259662696627966289662996630966319663296633966349663596636966379663896639966409664196642966439664496645966469664796648966499665096651966529665396654966559665696657966589665996660966619666296663966649666596666966679666896669966709667196672966739667496675966769667796678966799668096681966829668396684966859668696687966889668996690966919669296693966949669596696966979669896699967009670196702967039670496705967069670796708967099671096711967129671396714967159671696717967189671996720967219672296723967249672596726967279672896729967309673196732967339673496735967369673796738967399674096741967429674396744967459674696747967489674996750967519675296753967549675596756967579675896759967609676196762967639676496765967669676796768967699677096771967729677396774967759677696777967789677996780967819678296783967849678596786967879678896789967909679196792967939679496795967969679796798967999680096801968029680396804968059680696807968089680996810968119681296813968149681596816968179681896819968209682196822968239682496825968269682796828968299683096831968329683396834968359683696837968389683996840968419684296843968449684596846968479684896849968509685196852968539685496855968569685796858968599686096861968629686396864968659686696867968689686996870968719687296873968749687596876968779687896879968809688196882968839688496885968869688796888968899689096891968929689396894968959689696897968989689996900969019690296903969049690596906969079690896909969109691196912969139691496915969169691796918969199692096921969229692396924969259692696927969289692996930969319693296933969349693596936969379693896939969409694196942969439694496945969469694796948969499695096951969529695396954969559695696957969589695996960969619696296963969649696596966969679696896969969709697196972969739697496975969769697796978969799698096981969829698396984969859698696987969889698996990969919699296993969949699596996969979699896999970009700197002970039700497005970069700797008970099701097011970129701397014970159701697017970189701997020970219702297023970249702597026970279702897029970309703197032970339703497035970369703797038970399704097041970429704397044970459704697047970489704997050970519705297053970549705597056970579705897059970609706197062970639706497065970669706797068970699707097071970729707397074970759707697077970789707997080970819708297083970849708597086970879708897089970909709197092970939709497095970969709797098970999710097101971029710397104971059710697107971089710997110971119711297113971149711597116971179711897119971209712197122971239712497125971269712797128971299713097131971329713397134971359713697137971389713997140971419714297143971449714597146971479714897149971509715197152971539715497155971569715797158971599716097161971629716397164971659716697167971689716997170971719717297173971749717597176971779717897179971809718197182971839718497185971869718797188971899719097191971929719397194971959719697197971989719997200972019720297203972049720597206972079720897209972109721197212972139721497215972169721797218972199722097221972229722397224972259722697227972289722997230972319723297233972349723597236972379723897239972409724197242972439724497245972469724797248972499725097251972529725397254972559725697257972589725997260972619726297263972649726597266972679726897269972709727197272972739727497275972769727797278972799728097281972829728397284972859728697287972889728997290972919729297293972949729597296972979729897299973009730197302973039730497305973069730797308973099731097311973129731397314973159731697317973189731997320973219732297323973249732597326973279732897329973309733197332973339733497335973369733797338973399734097341973429734397344973459734697347973489734997350973519735297353973549735597356973579735897359973609736197362973639736497365973669736797368973699737097371973729737397374973759737697377973789737997380973819738297383973849738597386973879738897389973909739197392973939739497395973969739797398973999740097401974029740397404974059740697407974089740997410974119741297413974149741597416974179741897419974209742197422974239742497425974269742797428974299743097431974329743397434974359743697437974389743997440974419744297443974449744597446974479744897449974509745197452974539745497455974569745797458974599746097461974629746397464974659746697467974689746997470974719747297473974749747597476974779747897479974809748197482974839748497485974869748797488974899749097491974929749397494974959749697497974989749997500975019750297503975049750597506975079750897509975109751197512975139751497515975169751797518975199752097521975229752397524975259752697527975289752997530975319753297533975349753597536975379753897539975409754197542975439754497545975469754797548975499755097551975529755397554975559755697557975589755997560975619756297563975649756597566975679756897569975709757197572975739757497575975769757797578975799758097581975829758397584975859758697587975889758997590975919759297593975949759597596975979759897599976009760197602976039760497605976069760797608976099761097611976129761397614976159761697617976189761997620976219762297623976249762597626976279762897629976309763197632976339763497635976369763797638976399764097641976429764397644976459764697647976489764997650976519765297653976549765597656976579765897659976609766197662976639766497665976669766797668976699767097671976729767397674976759767697677976789767997680976819768297683976849768597686976879768897689976909769197692976939769497695976969769797698976999770097701977029770397704977059770697707977089770997710977119771297713977149771597716977179771897719977209772197722977239772497725977269772797728977299773097731977329773397734977359773697737977389773997740977419774297743977449774597746977479774897749977509775197752977539775497755977569775797758977599776097761977629776397764977659776697767977689776997770977719777297773977749777597776977779777897779977809778197782977839778497785977869778797788977899779097791977929779397794977959779697797977989779997800978019780297803978049780597806978079780897809978109781197812978139781497815978169781797818978199782097821978229782397824978259782697827978289782997830978319783297833978349783597836978379783897839978409784197842978439784497845978469784797848978499785097851978529785397854978559785697857978589785997860978619786297863978649786597866978679786897869978709787197872978739787497875978769787797878978799788097881978829788397884978859788697887978889788997890978919789297893978949789597896978979789897899979009790197902979039790497905979069790797908979099791097911979129791397914979159791697917979189791997920979219792297923979249792597926979279792897929979309793197932979339793497935979369793797938979399794097941979429794397944979459794697947979489794997950979519795297953979549795597956979579795897959979609796197962979639796497965979669796797968979699797097971979729797397974979759797697977979789797997980979819798297983979849798597986979879798897989979909799197992979939799497995979969799797998979999800098001980029800398004980059800698007980089800998010980119801298013980149801598016980179801898019980209802198022980239802498025980269802798028980299803098031980329803398034980359803698037980389803998040980419804298043980449804598046980479804898049980509805198052980539805498055980569805798058980599806098061980629806398064980659806698067980689806998070980719807298073980749807598076980779807898079980809808198082980839808498085980869808798088980899809098091980929809398094980959809698097980989809998100981019810298103981049810598106981079810898109981109811198112981139811498115981169811798118981199812098121981229812398124981259812698127981289812998130981319813298133981349813598136981379813898139981409814198142981439814498145981469814798148981499815098151981529815398154981559815698157981589815998160981619816298163981649816598166981679816898169981709817198172981739817498175981769817798178981799818098181981829818398184981859818698187981889818998190981919819298193981949819598196981979819898199982009820198202982039820498205982069820798208982099821098211982129821398214982159821698217982189821998220982219822298223982249822598226982279822898229982309823198232982339823498235982369823798238982399824098241982429824398244982459824698247982489824998250982519825298253982549825598256982579825898259982609826198262982639826498265982669826798268982699827098271982729827398274982759827698277982789827998280982819828298283982849828598286982879828898289982909829198292982939829498295982969829798298982999830098301983029830398304983059830698307983089830998310983119831298313983149831598316983179831898319983209832198322983239832498325983269832798328983299833098331983329833398334983359833698337983389833998340983419834298343983449834598346983479834898349983509835198352983539835498355983569835798358983599836098361983629836398364983659836698367983689836998370983719837298373983749837598376983779837898379983809838198382983839838498385983869838798388983899839098391983929839398394983959839698397983989839998400984019840298403984049840598406984079840898409984109841198412984139841498415984169841798418984199842098421984229842398424984259842698427984289842998430984319843298433984349843598436984379843898439984409844198442984439844498445984469844798448984499845098451984529845398454984559845698457984589845998460984619846298463984649846598466984679846898469984709847198472984739847498475984769847798478984799848098481984829848398484984859848698487984889848998490984919849298493984949849598496984979849898499985009850198502985039850498505985069850798508985099851098511985129851398514985159851698517985189851998520985219852298523985249852598526985279852898529985309853198532985339853498535985369853798538985399854098541985429854398544985459854698547985489854998550985519855298553985549855598556985579855898559985609856198562985639856498565985669856798568985699857098571985729857398574985759857698577985789857998580985819858298583985849858598586985879858898589985909859198592985939859498595985969859798598985999860098601986029860398604986059860698607986089860998610986119861298613986149861598616986179861898619986209862198622986239862498625986269862798628986299863098631986329863398634986359863698637986389863998640986419864298643986449864598646986479864898649986509865198652986539865498655986569865798658986599866098661986629866398664986659866698667986689866998670986719867298673986749867598676986779867898679986809868198682986839868498685986869868798688986899869098691986929869398694986959869698697986989869998700987019870298703987049870598706987079870898709987109871198712987139871498715987169871798718987199872098721987229872398724987259872698727987289872998730987319873298733987349873598736987379873898739987409874198742987439874498745987469874798748987499875098751987529875398754987559875698757987589875998760987619876298763987649876598766987679876898769987709877198772987739877498775987769877798778987799878098781987829878398784987859878698787987889878998790987919879298793987949879598796987979879898799988009880198802988039880498805988069880798808988099881098811988129881398814988159881698817988189881998820988219882298823988249882598826988279882898829988309883198832988339883498835988369883798838988399884098841988429884398844988459884698847988489884998850988519885298853988549885598856988579885898859988609886198862988639886498865988669886798868988699887098871988729887398874988759887698877988789887998880988819888298883988849888598886988879888898889988909889198892988939889498895988969889798898988999890098901989029890398904989059890698907989089890998910989119891298913989149891598916989179891898919989209892198922989239892498925989269892798928989299893098931989329893398934989359893698937989389893998940989419894298943989449894598946989479894898949989509895198952989539895498955989569895798958989599896098961989629896398964989659896698967989689896998970989719897298973989749897598976989779897898979989809898198982989839898498985989869898798988989899899098991989929899398994989959899698997989989899999000990019900299003990049900599006990079900899009990109901199012990139901499015990169901799018990199902099021990229902399024990259902699027990289902999030990319903299033990349903599036990379903899039990409904199042990439904499045990469904799048990499905099051990529905399054990559905699057990589905999060990619906299063990649906599066990679906899069990709907199072990739907499075990769907799078990799908099081990829908399084990859908699087990889908999090990919909299093990949909599096990979909899099991009910199102991039910499105991069910799108991099911099111991129911399114991159911699117991189911999120991219912299123991249912599126991279912899129991309913199132991339913499135991369913799138991399914099141991429914399144991459914699147991489914999150991519915299153991549915599156991579915899159991609916199162991639916499165991669916799168991699917099171991729917399174991759917699177991789917999180991819918299183991849918599186991879918899189991909919199192991939919499195991969919799198991999920099201992029920399204992059920699207992089920999210992119921299213992149921599216992179921899219992209922199222992239922499225992269922799228992299923099231992329923399234992359923699237992389923999240992419924299243992449924599246992479924899249992509925199252992539925499255992569925799258992599926099261992629926399264992659926699267992689926999270992719927299273992749927599276992779927899279992809928199282992839928499285992869928799288992899929099291992929929399294992959929699297992989929999300993019930299303993049930599306993079930899309993109931199312993139931499315993169931799318993199932099321993229932399324993259932699327993289932999330993319933299333993349933599336993379933899339993409934199342993439934499345993469934799348993499935099351993529935399354993559935699357993589935999360993619936299363993649936599366993679936899369993709937199372993739937499375993769937799378993799938099381993829938399384993859938699387993889938999390993919939299393993949939599396993979939899399994009940199402994039940499405994069940799408994099941099411994129941399414994159941699417994189941999420994219942299423994249942599426994279942899429994309943199432994339943499435994369943799438994399944099441994429944399444994459944699447994489944999450994519945299453994549945599456994579945899459994609946199462994639946499465994669946799468994699947099471994729947399474994759947699477994789947999480994819948299483994849948599486994879948899489994909949199492994939949499495994969949799498994999950099501995029950399504995059950699507995089950999510995119951299513995149951599516995179951899519995209952199522995239952499525995269952799528995299953099531995329953399534995359953699537995389953999540995419954299543995449954599546995479954899549995509955199552995539955499555995569955799558995599956099561995629956399564995659956699567995689956999570995719957299573995749957599576995779957899579995809958199582995839958499585995869958799588995899959099591995929959399594995959959699597995989959999600996019960299603996049960599606996079960899609996109961199612996139961499615996169961799618996199962099621996229962399624996259962699627996289962999630996319963299633996349963599636996379963899639996409964199642996439964499645996469964799648996499965099651996529965399654996559965699657996589965999660996619966299663996649966599666996679966899669996709967199672996739967499675996769967799678996799968099681996829968399684996859968699687996889968999690996919969299693996949969599696996979969899699997009970199702997039970499705997069970799708997099971099711997129971399714997159971699717997189971999720997219972299723997249972599726997279972899729997309973199732997339973499735997369973799738997399974099741997429974399744997459974699747997489974999750997519975299753997549975599756997579975899759997609976199762997639976499765997669976799768997699977099771997729977399774997759977699777997789977999780997819978299783997849978599786997879978899789997909979199792997939979499795997969979799798997999980099801998029980399804998059980699807998089980999810998119981299813998149981599816998179981899819998209982199822998239982499825998269982799828998299983099831998329983399834998359983699837998389983999840998419984299843998449984599846998479984899849998509985199852998539985499855998569985799858998599986099861998629986399864998659986699867998689986999870998719987299873998749987599876998779987899879998809988199882998839988499885998869988799888998899989099891998929989399894998959989699897998989989999900999019990299903999049990599906999079990899909999109991199912999139991499915999169991799918999199992099921999229992399924999259992699927999289992999930999319993299933999349993599936999379993899939999409994199942999439994499945999469994799948999499995099951999529995399954999559995699957999589995999960999619996299963999649996599966999679996899969999709997199972999739997499975999769997799978999799998099981999829998399984999859998699987999889998999990999919999299993999949999599996999979999899999100000100001100002100003100004100005100006100007100008100009100010100011100012100013100014100015100016100017100018100019100020100021100022100023100024100025100026100027100028100029100030100031100032100033100034100035100036100037100038100039100040100041100042100043100044100045100046100047100048100049100050100051100052100053100054100055100056100057100058100059100060100061100062100063100064100065100066100067100068100069100070100071100072100073100074100075100076100077100078100079100080100081100082100083100084100085100086100087100088100089100090100091100092100093100094100095100096100097100098100099100100100101100102100103100104100105100106100107100108100109100110100111100112100113100114100115100116100117100118100119100120100121100122100123100124100125100126100127100128100129100130100131100132100133100134100135100136100137100138100139100140100141100142100143100144100145100146100147100148100149100150100151100152100153100154100155100156100157100158100159100160100161100162100163100164100165100166100167100168100169100170100171100172100173100174100175100176100177100178100179100180100181100182100183100184100185100186100187100188100189100190100191100192100193100194100195100196100197100198100199100200100201100202100203100204100205100206100207100208100209100210100211100212100213100214100215100216100217100218100219100220100221100222100223100224100225100226100227100228100229100230100231100232100233100234100235100236100237100238100239100240100241100242100243100244100245100246100247100248100249100250100251100252100253100254100255100256100257100258100259100260100261100262100263100264100265100266100267100268100269100270100271100272100273100274100275100276100277100278100279100280100281100282100283100284100285100286100287100288100289100290100291100292100293100294100295100296100297100298100299100300100301100302100303100304100305100306100307100308100309100310100311100312100313100314100315100316100317100318100319100320100321100322100323100324100325100326100327100328100329100330100331100332100333100334100335100336100337100338100339100340100341100342100343100344100345100346100347100348100349100350100351100352100353100354100355100356100357100358100359100360100361100362100363100364100365100366100367100368100369100370100371100372100373100374100375100376100377100378100379100380100381100382100383100384100385100386100387100388100389100390100391100392100393100394100395100396100397100398100399100400100401100402100403100404100405100406100407100408100409100410100411100412100413100414100415100416100417100418100419100420100421100422100423100424100425100426100427100428100429100430100431100432100433100434100435100436100437100438100439100440100441100442100443100444100445100446100447100448100449100450100451100452100453100454100455100456100457100458100459100460100461100462100463100464100465100466100467100468100469100470100471100472100473100474100475100476100477100478100479100480100481100482100483100484100485100486100487100488100489100490100491100492100493100494100495100496100497100498100499100500100501100502100503100504100505100506100507100508100509100510100511100512100513100514100515100516100517100518100519100520100521100522100523100524100525100526100527100528100529100530100531100532100533100534100535100536100537100538100539100540100541100542100543100544100545100546100547100548100549100550100551100552100553100554100555100556100557100558100559100560100561100562100563100564100565100566100567100568100569100570100571100572100573100574100575100576100577100578100579100580100581100582100583100584100585100586100587100588100589100590100591100592100593100594100595100596100597100598100599100600100601100602100603100604100605100606100607100608100609100610100611100612100613100614100615100616100617100618100619100620100621100622100623100624100625100626100627100628100629100630100631100632100633100634100635100636100637100638100639100640100641100642100643100644100645100646100647100648100649100650100651100652100653100654100655100656100657100658100659100660100661100662100663100664100665100666100667100668100669100670100671100672100673100674100675100676100677100678100679100680100681100682100683100684100685100686100687100688100689100690100691100692100693100694100695100696100697100698100699100700100701100702100703100704100705100706100707100708100709100710100711100712100713100714100715100716100717100718100719100720100721100722100723100724100725100726100727100728100729100730100731100732100733100734100735100736100737100738100739100740100741100742100743100744100745100746100747100748100749100750100751100752100753100754100755100756100757100758100759100760100761100762100763100764100765100766100767100768100769100770100771100772100773100774100775100776100777100778100779100780100781100782100783100784100785100786100787100788100789100790100791100792100793100794100795100796100797100798100799100800100801100802100803100804100805100806100807100808100809100810100811100812100813100814100815100816100817100818100819100820100821100822100823100824100825100826100827100828100829100830100831100832100833100834100835100836100837100838100839100840100841100842100843100844100845100846100847100848100849100850100851100852100853100854100855100856100857100858100859100860100861100862100863100864100865100866100867100868100869100870100871100872100873100874100875100876100877100878100879100880100881100882100883100884100885100886100887100888100889100890100891100892100893100894100895100896100897100898100899100900100901100902100903100904100905100906100907100908100909100910100911100912100913100914100915100916100917100918100919100920100921100922100923100924100925100926100927100928100929100930100931100932100933100934100935100936100937100938100939100940100941100942100943100944100945100946100947100948100949100950100951100952100953100954100955100956100957100958100959100960100961100962100963100964100965100966100967100968100969100970100971100972100973100974100975100976100977100978100979100980100981100982100983100984100985100986100987100988100989100990100991100992100993100994100995100996100997100998100999101000101001101002101003101004101005101006101007101008101009101010101011101012101013101014101015101016101017101018101019101020101021101022101023101024101025101026101027101028101029101030101031101032101033101034101035101036101037101038101039101040101041101042101043101044101045101046101047101048101049101050101051101052101053101054101055101056101057101058101059101060101061101062101063101064101065101066101067101068101069101070101071101072101073101074101075101076101077101078101079101080101081101082101083101084101085101086101087101088101089101090101091101092101093101094101095101096101097101098101099101100101101101102101103101104101105101106101107101108101109101110101111101112101113101114101115101116101117101118101119101120101121101122101123101124101125101126101127101128101129101130101131101132101133101134101135101136101137101138101139101140101141101142101143101144101145101146101147101148101149101150101151101152101153101154101155101156101157101158101159101160101161101162101163101164101165101166101167101168101169101170101171101172101173101174101175101176101177101178101179101180101181101182101183101184101185101186101187101188101189101190101191101192101193101194101195101196101197101198101199101200101201101202101203101204101205101206101207101208101209101210101211101212101213101214101215101216101217101218101219101220101221101222101223101224101225101226101227101228101229101230101231101232101233101234101235101236101237101238101239101240101241101242101243101244101245101246101247101248101249101250101251101252101253101254101255101256101257101258101259101260101261101262101263101264101265101266101267101268101269101270101271101272101273101274101275101276101277101278101279101280101281101282101283101284101285101286101287101288101289101290101291101292101293101294101295101296101297101298101299101300101301101302101303101304101305101306101307101308101309101310101311101312101313101314101315101316101317101318101319101320101321101322101323101324101325101326101327101328101329101330101331101332101333101334101335101336101337101338101339101340101341101342101343101344101345101346101347101348101349101350101351101352101353101354101355101356101357101358101359101360101361101362101363101364101365101366101367101368101369101370101371101372101373101374101375101376101377101378101379101380101381101382101383101384101385101386101387101388101389101390101391101392101393101394101395101396101397101398101399101400101401101402101403101404101405101406101407101408101409101410101411101412101413101414101415101416101417101418101419101420101421101422101423101424101425101426101427101428101429101430101431101432101433101434101435101436101437101438101439101440101441101442101443101444101445101446101447101448101449101450101451101452101453101454101455101456101457101458101459101460101461101462101463101464101465101466101467101468101469101470101471101472101473101474101475101476101477101478101479101480101481101482101483101484101485101486101487101488101489101490101491101492101493101494101495101496101497101498101499101500101501101502101503101504101505101506101507101508101509101510101511101512101513101514101515101516101517101518101519101520101521101522101523101524101525101526101527101528101529101530101531101532101533101534101535101536101537101538101539101540101541101542101543101544101545101546101547101548101549101550101551101552101553101554101555101556101557101558101559101560101561101562101563101564101565101566101567101568101569101570101571101572101573101574101575101576101577101578101579101580101581101582101583101584101585101586101587101588101589101590101591101592101593101594101595101596101597101598101599101600101601101602101603101604101605101606101607101608101609101610101611101612101613101614101615101616101617101618101619101620101621101622101623101624101625101626101627101628101629101630101631101632101633101634101635101636101637101638101639101640101641101642101643101644101645101646101647101648101649101650101651101652101653101654101655101656101657101658101659101660101661101662101663101664101665101666101667101668101669101670101671101672101673101674101675101676101677101678101679101680101681101682101683101684101685101686101687101688101689101690101691101692101693101694101695101696101697101698101699101700101701101702101703101704101705101706101707101708101709101710101711101712101713101714101715101716101717101718101719101720101721101722101723101724101725101726101727101728101729101730101731101732101733101734101735101736101737101738101739101740101741101742101743101744101745101746101747101748101749101750101751101752101753101754101755101756101757101758101759101760101761101762101763101764101765101766101767101768101769101770101771101772
  1. /*!
  2. *
  3. * iclient-mapboxgl
  4. * Copyright© 2000 - 2023 SuperMap Software Co.Ltd
  5. * license: Apache-2.0
  6. * version: v11.1.0
  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. /***/ 962:
  471. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  472. "use strict";
  473. Object.defineProperty(exports, "__esModule", ({ value: true }));
  474. exports.Builder = void 0;
  475. var byte_buffer_js_1 = __webpack_require__(505);
  476. var constants_js_1 = __webpack_require__(147);
  477. var Builder = /** @class */ (function () {
  478. /**
  479. * Create a FlatBufferBuilder.
  480. */
  481. function Builder(opt_initial_size) {
  482. /** Minimum alignment encountered so far. */
  483. this.minalign = 1;
  484. /** The vtable for the current table. */
  485. this.vtable = null;
  486. /** The amount of fields we're actually using. */
  487. this.vtable_in_use = 0;
  488. /** Whether we are currently serializing a table. */
  489. this.isNested = false;
  490. /** Starting offset of the current struct/table. */
  491. this.object_start = 0;
  492. /** List of offsets of all vtables. */
  493. this.vtables = [];
  494. /** For the current vector being built. */
  495. this.vector_num_elems = 0;
  496. /** False omits default values from the serialized data */
  497. this.force_defaults = false;
  498. this.string_maps = null;
  499. var initial_size;
  500. if (!opt_initial_size) {
  501. initial_size = 1024;
  502. }
  503. else {
  504. initial_size = opt_initial_size;
  505. }
  506. /**
  507. * @type {ByteBuffer}
  508. * @private
  509. */
  510. this.bb = byte_buffer_js_1.ByteBuffer.allocate(initial_size);
  511. this.space = initial_size;
  512. }
  513. Builder.prototype.clear = function () {
  514. this.bb.clear();
  515. this.space = this.bb.capacity();
  516. this.minalign = 1;
  517. this.vtable = null;
  518. this.vtable_in_use = 0;
  519. this.isNested = false;
  520. this.object_start = 0;
  521. this.vtables = [];
  522. this.vector_num_elems = 0;
  523. this.force_defaults = false;
  524. this.string_maps = null;
  525. };
  526. /**
  527. * In order to save space, fields that are set to their default value
  528. * don't get serialized into the buffer. Forcing defaults provides a
  529. * way to manually disable this optimization.
  530. *
  531. * @param forceDefaults true always serializes default values
  532. */
  533. Builder.prototype.forceDefaults = function (forceDefaults) {
  534. this.force_defaults = forceDefaults;
  535. };
  536. /**
  537. * Get the ByteBuffer representing the FlatBuffer. Only call this after you've
  538. * called finish(). The actual data starts at the ByteBuffer's current position,
  539. * not necessarily at 0.
  540. */
  541. Builder.prototype.dataBuffer = function () {
  542. return this.bb;
  543. };
  544. /**
  545. * Get the bytes representing the FlatBuffer. Only call this after you've
  546. * called finish().
  547. */
  548. Builder.prototype.asUint8Array = function () {
  549. return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());
  550. };
  551. /**
  552. * Prepare to write an element of `size` after `additional_bytes` have been
  553. * written, e.g. if you write a string, you need to align such the int length
  554. * field is aligned to 4 bytes, and the string data follows it directly. If all
  555. * you need to do is alignment, `additional_bytes` will be 0.
  556. *
  557. * @param size This is the of the new element to write
  558. * @param additional_bytes The padding size
  559. */
  560. Builder.prototype.prep = function (size, additional_bytes) {
  561. // Track the biggest thing we've ever aligned to.
  562. if (size > this.minalign) {
  563. this.minalign = size;
  564. }
  565. // Find the amount of alignment needed such that `size` is properly
  566. // aligned after `additional_bytes`
  567. var align_size = ((~(this.bb.capacity() - this.space + additional_bytes)) + 1) & (size - 1);
  568. // Reallocate the buffer if needed.
  569. while (this.space < align_size + size + additional_bytes) {
  570. var old_buf_size = this.bb.capacity();
  571. this.bb = Builder.growByteBuffer(this.bb);
  572. this.space += this.bb.capacity() - old_buf_size;
  573. }
  574. this.pad(align_size);
  575. };
  576. Builder.prototype.pad = function (byte_size) {
  577. for (var i = 0; i < byte_size; i++) {
  578. this.bb.writeInt8(--this.space, 0);
  579. }
  580. };
  581. Builder.prototype.writeInt8 = function (value) {
  582. this.bb.writeInt8(this.space -= 1, value);
  583. };
  584. Builder.prototype.writeInt16 = function (value) {
  585. this.bb.writeInt16(this.space -= 2, value);
  586. };
  587. Builder.prototype.writeInt32 = function (value) {
  588. this.bb.writeInt32(this.space -= 4, value);
  589. };
  590. Builder.prototype.writeInt64 = function (value) {
  591. this.bb.writeInt64(this.space -= 8, value);
  592. };
  593. Builder.prototype.writeFloat32 = function (value) {
  594. this.bb.writeFloat32(this.space -= 4, value);
  595. };
  596. Builder.prototype.writeFloat64 = function (value) {
  597. this.bb.writeFloat64(this.space -= 8, value);
  598. };
  599. /**
  600. * Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary).
  601. * @param value The `int8` to add the the buffer.
  602. */
  603. Builder.prototype.addInt8 = function (value) {
  604. this.prep(1, 0);
  605. this.writeInt8(value);
  606. };
  607. /**
  608. * Add an `int16` to the buffer, properly aligned, and grows the buffer (if necessary).
  609. * @param value The `int16` to add the the buffer.
  610. */
  611. Builder.prototype.addInt16 = function (value) {
  612. this.prep(2, 0);
  613. this.writeInt16(value);
  614. };
  615. /**
  616. * Add an `int32` to the buffer, properly aligned, and grows the buffer (if necessary).
  617. * @param value The `int32` to add the the buffer.
  618. */
  619. Builder.prototype.addInt32 = function (value) {
  620. this.prep(4, 0);
  621. this.writeInt32(value);
  622. };
  623. /**
  624. * Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).
  625. * @param value The `int64` to add the the buffer.
  626. */
  627. Builder.prototype.addInt64 = function (value) {
  628. this.prep(8, 0);
  629. this.writeInt64(value);
  630. };
  631. /**
  632. * Add a `float32` to the buffer, properly aligned, and grows the buffer (if necessary).
  633. * @param value The `float32` to add the the buffer.
  634. */
  635. Builder.prototype.addFloat32 = function (value) {
  636. this.prep(4, 0);
  637. this.writeFloat32(value);
  638. };
  639. /**
  640. * Add a `float64` to the buffer, properly aligned, and grows the buffer (if necessary).
  641. * @param value The `float64` to add the the buffer.
  642. */
  643. Builder.prototype.addFloat64 = function (value) {
  644. this.prep(8, 0);
  645. this.writeFloat64(value);
  646. };
  647. Builder.prototype.addFieldInt8 = function (voffset, value, defaultValue) {
  648. if (this.force_defaults || value != defaultValue) {
  649. this.addInt8(value);
  650. this.slot(voffset);
  651. }
  652. };
  653. Builder.prototype.addFieldInt16 = function (voffset, value, defaultValue) {
  654. if (this.force_defaults || value != defaultValue) {
  655. this.addInt16(value);
  656. this.slot(voffset);
  657. }
  658. };
  659. Builder.prototype.addFieldInt32 = function (voffset, value, defaultValue) {
  660. if (this.force_defaults || value != defaultValue) {
  661. this.addInt32(value);
  662. this.slot(voffset);
  663. }
  664. };
  665. Builder.prototype.addFieldInt64 = function (voffset, value, defaultValue) {
  666. if (this.force_defaults || value !== defaultValue) {
  667. this.addInt64(value);
  668. this.slot(voffset);
  669. }
  670. };
  671. Builder.prototype.addFieldFloat32 = function (voffset, value, defaultValue) {
  672. if (this.force_defaults || value != defaultValue) {
  673. this.addFloat32(value);
  674. this.slot(voffset);
  675. }
  676. };
  677. Builder.prototype.addFieldFloat64 = function (voffset, value, defaultValue) {
  678. if (this.force_defaults || value != defaultValue) {
  679. this.addFloat64(value);
  680. this.slot(voffset);
  681. }
  682. };
  683. Builder.prototype.addFieldOffset = function (voffset, value, defaultValue) {
  684. if (this.force_defaults || value != defaultValue) {
  685. this.addOffset(value);
  686. this.slot(voffset);
  687. }
  688. };
  689. /**
  690. * Structs are stored inline, so nothing additional is being added. `d` is always 0.
  691. */
  692. Builder.prototype.addFieldStruct = function (voffset, value, defaultValue) {
  693. if (value != defaultValue) {
  694. this.nested(value);
  695. this.slot(voffset);
  696. }
  697. };
  698. /**
  699. * Structures are always stored inline, they need to be created right
  700. * where they're used. You'll get this assertion failure if you
  701. * created it elsewhere.
  702. */
  703. Builder.prototype.nested = function (obj) {
  704. if (obj != this.offset()) {
  705. throw new Error('FlatBuffers: struct must be serialized inline.');
  706. }
  707. };
  708. /**
  709. * Should not be creating any other object, string or vector
  710. * while an object is being constructed
  711. */
  712. Builder.prototype.notNested = function () {
  713. if (this.isNested) {
  714. throw new Error('FlatBuffers: object serialization must not be nested.');
  715. }
  716. };
  717. /**
  718. * Set the current vtable at `voffset` to the current location in the buffer.
  719. */
  720. Builder.prototype.slot = function (voffset) {
  721. if (this.vtable !== null)
  722. this.vtable[voffset] = this.offset();
  723. };
  724. /**
  725. * @returns Offset relative to the end of the buffer.
  726. */
  727. Builder.prototype.offset = function () {
  728. return this.bb.capacity() - this.space;
  729. };
  730. /**
  731. * Doubles the size of the backing ByteBuffer and copies the old data towards
  732. * the end of the new buffer (since we build the buffer backwards).
  733. *
  734. * @param bb The current buffer with the existing data
  735. * @returns A new byte buffer with the old data copied
  736. * to it. The data is located at the end of the buffer.
  737. *
  738. * uint8Array.set() formally takes {Array<number>|ArrayBufferView}, so to pass
  739. * it a uint8Array we need to suppress the type check:
  740. * @suppress {checkTypes}
  741. */
  742. Builder.growByteBuffer = function (bb) {
  743. var old_buf_size = bb.capacity();
  744. // Ensure we don't grow beyond what fits in an int.
  745. if (old_buf_size & 0xC0000000) {
  746. throw new Error('FlatBuffers: cannot grow buffer beyond 2 gigabytes.');
  747. }
  748. var new_buf_size = old_buf_size << 1;
  749. var nbb = byte_buffer_js_1.ByteBuffer.allocate(new_buf_size);
  750. nbb.setPosition(new_buf_size - old_buf_size);
  751. nbb.bytes().set(bb.bytes(), new_buf_size - old_buf_size);
  752. return nbb;
  753. };
  754. /**
  755. * Adds on offset, relative to where it will be written.
  756. *
  757. * @param offset The offset to add.
  758. */
  759. Builder.prototype.addOffset = function (offset) {
  760. this.prep(constants_js_1.SIZEOF_INT, 0); // Ensure alignment is already done.
  761. this.writeInt32(this.offset() - offset + constants_js_1.SIZEOF_INT);
  762. };
  763. /**
  764. * Start encoding a new object in the buffer. Users will not usually need to
  765. * call this directly. The FlatBuffers compiler will generate helper methods
  766. * that call this method internally.
  767. */
  768. Builder.prototype.startObject = function (numfields) {
  769. this.notNested();
  770. if (this.vtable == null) {
  771. this.vtable = [];
  772. }
  773. this.vtable_in_use = numfields;
  774. for (var i = 0; i < numfields; i++) {
  775. this.vtable[i] = 0; // This will push additional elements as needed
  776. }
  777. this.isNested = true;
  778. this.object_start = this.offset();
  779. };
  780. /**
  781. * Finish off writing the object that is under construction.
  782. *
  783. * @returns The offset to the object inside `dataBuffer`
  784. */
  785. Builder.prototype.endObject = function () {
  786. if (this.vtable == null || !this.isNested) {
  787. throw new Error('FlatBuffers: endObject called without startObject');
  788. }
  789. this.addInt32(0);
  790. var vtableloc = this.offset();
  791. // Trim trailing zeroes.
  792. var i = this.vtable_in_use - 1;
  793. // eslint-disable-next-line no-empty
  794. for (; i >= 0 && this.vtable[i] == 0; i--) { }
  795. var trimmed_size = i + 1;
  796. // Write out the current vtable.
  797. for (; i >= 0; i--) {
  798. // Offset relative to the start of the table.
  799. this.addInt16(this.vtable[i] != 0 ? vtableloc - this.vtable[i] : 0);
  800. }
  801. var standard_fields = 2; // The fields below:
  802. this.addInt16(vtableloc - this.object_start);
  803. var len = (trimmed_size + standard_fields) * constants_js_1.SIZEOF_SHORT;
  804. this.addInt16(len);
  805. // Search for an existing vtable that matches the current one.
  806. var existing_vtable = 0;
  807. var vt1 = this.space;
  808. outer_loop: for (i = 0; i < this.vtables.length; i++) {
  809. var vt2 = this.bb.capacity() - this.vtables[i];
  810. if (len == this.bb.readInt16(vt2)) {
  811. for (var j = constants_js_1.SIZEOF_SHORT; j < len; j += constants_js_1.SIZEOF_SHORT) {
  812. if (this.bb.readInt16(vt1 + j) != this.bb.readInt16(vt2 + j)) {
  813. continue outer_loop;
  814. }
  815. }
  816. existing_vtable = this.vtables[i];
  817. break;
  818. }
  819. }
  820. if (existing_vtable) {
  821. // Found a match:
  822. // Remove the current vtable.
  823. this.space = this.bb.capacity() - vtableloc;
  824. // Point table to existing vtable.
  825. this.bb.writeInt32(this.space, existing_vtable - vtableloc);
  826. }
  827. else {
  828. // No match:
  829. // Add the location of the current vtable to the list of vtables.
  830. this.vtables.push(this.offset());
  831. // Point table to current vtable.
  832. this.bb.writeInt32(this.bb.capacity() - vtableloc, this.offset() - vtableloc);
  833. }
  834. this.isNested = false;
  835. return vtableloc;
  836. };
  837. /**
  838. * Finalize a buffer, poiting to the given `root_table`.
  839. */
  840. Builder.prototype.finish = function (root_table, opt_file_identifier, opt_size_prefix) {
  841. var size_prefix = opt_size_prefix ? constants_js_1.SIZE_PREFIX_LENGTH : 0;
  842. if (opt_file_identifier) {
  843. var file_identifier = opt_file_identifier;
  844. this.prep(this.minalign, constants_js_1.SIZEOF_INT +
  845. constants_js_1.FILE_IDENTIFIER_LENGTH + size_prefix);
  846. if (file_identifier.length != constants_js_1.FILE_IDENTIFIER_LENGTH) {
  847. throw new Error('FlatBuffers: file identifier must be length ' +
  848. constants_js_1.FILE_IDENTIFIER_LENGTH);
  849. }
  850. for (var i = constants_js_1.FILE_IDENTIFIER_LENGTH - 1; i >= 0; i--) {
  851. this.writeInt8(file_identifier.charCodeAt(i));
  852. }
  853. }
  854. this.prep(this.minalign, constants_js_1.SIZEOF_INT + size_prefix);
  855. this.addOffset(root_table);
  856. if (size_prefix) {
  857. this.addInt32(this.bb.capacity() - this.space);
  858. }
  859. this.bb.setPosition(this.space);
  860. };
  861. /**
  862. * Finalize a size prefixed buffer, pointing to the given `root_table`.
  863. */
  864. Builder.prototype.finishSizePrefixed = function (root_table, opt_file_identifier) {
  865. this.finish(root_table, opt_file_identifier, true);
  866. };
  867. /**
  868. * This checks a required field has been set in a given table that has
  869. * just been constructed.
  870. */
  871. Builder.prototype.requiredField = function (table, field) {
  872. var table_start = this.bb.capacity() - table;
  873. var vtable_start = table_start - this.bb.readInt32(table_start);
  874. var ok = this.bb.readInt16(vtable_start + field) != 0;
  875. // If this fails, the caller will show what field needs to be set.
  876. if (!ok) {
  877. throw new Error('FlatBuffers: field ' + field + ' must be set');
  878. }
  879. };
  880. /**
  881. * Start a new array/vector of objects. Users usually will not call
  882. * this directly. The FlatBuffers compiler will create a start/end
  883. * method for vector types in generated code.
  884. *
  885. * @param elem_size The size of each element in the array
  886. * @param num_elems The number of elements in the array
  887. * @param alignment The alignment of the array
  888. */
  889. Builder.prototype.startVector = function (elem_size, num_elems, alignment) {
  890. this.notNested();
  891. this.vector_num_elems = num_elems;
  892. this.prep(constants_js_1.SIZEOF_INT, elem_size * num_elems);
  893. this.prep(alignment, elem_size * num_elems); // Just in case alignment > int.
  894. };
  895. /**
  896. * Finish off the creation of an array and all its elements. The array must be
  897. * created with `startVector`.
  898. *
  899. * @returns The offset at which the newly created array
  900. * starts.
  901. */
  902. Builder.prototype.endVector = function () {
  903. this.writeInt32(this.vector_num_elems);
  904. return this.offset();
  905. };
  906. /**
  907. * Encode the string `s` in the buffer using UTF-8. If the string passed has
  908. * already been seen, we return the offset of the already written string
  909. *
  910. * @param s The string to encode
  911. * @return The offset in the buffer where the encoded string starts
  912. */
  913. Builder.prototype.createSharedString = function (s) {
  914. if (!s) {
  915. return 0;
  916. }
  917. if (!this.string_maps) {
  918. this.string_maps = new Map();
  919. }
  920. if (this.string_maps.has(s)) {
  921. return this.string_maps.get(s);
  922. }
  923. var offset = this.createString(s);
  924. this.string_maps.set(s, offset);
  925. return offset;
  926. };
  927. /**
  928. * Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed
  929. * instead of a string, it is assumed to contain valid UTF-8 encoded data.
  930. *
  931. * @param s The string to encode
  932. * @return The offset in the buffer where the encoded string starts
  933. */
  934. Builder.prototype.createString = function (s) {
  935. if (s === null || s === undefined) {
  936. return 0;
  937. }
  938. var utf8;
  939. if (s instanceof Uint8Array) {
  940. utf8 = s;
  941. }
  942. else {
  943. utf8 = [];
  944. var i = 0;
  945. while (i < s.length) {
  946. var codePoint = void 0;
  947. // Decode UTF-16
  948. var a = s.charCodeAt(i++);
  949. if (a < 0xD800 || a >= 0xDC00) {
  950. codePoint = a;
  951. }
  952. else {
  953. var b = s.charCodeAt(i++);
  954. codePoint = (a << 10) + b + (0x10000 - (0xD800 << 10) - 0xDC00);
  955. }
  956. // Encode UTF-8
  957. if (codePoint < 0x80) {
  958. utf8.push(codePoint);
  959. }
  960. else {
  961. if (codePoint < 0x800) {
  962. utf8.push(((codePoint >> 6) & 0x1F) | 0xC0);
  963. }
  964. else {
  965. if (codePoint < 0x10000) {
  966. utf8.push(((codePoint >> 12) & 0x0F) | 0xE0);
  967. }
  968. else {
  969. utf8.push(((codePoint >> 18) & 0x07) | 0xF0, ((codePoint >> 12) & 0x3F) | 0x80);
  970. }
  971. utf8.push(((codePoint >> 6) & 0x3F) | 0x80);
  972. }
  973. utf8.push((codePoint & 0x3F) | 0x80);
  974. }
  975. }
  976. }
  977. this.addInt8(0);
  978. this.startVector(1, utf8.length, 1);
  979. this.bb.setPosition(this.space -= utf8.length);
  980. for (var i = 0, offset = this.space, bytes = this.bb.bytes(); i < utf8.length; i++) {
  981. bytes[offset++] = utf8[i];
  982. }
  983. return this.endVector();
  984. };
  985. /**
  986. * A helper function to pack an object
  987. *
  988. * @returns offset of obj
  989. */
  990. Builder.prototype.createObjectOffset = function (obj) {
  991. if (obj === null) {
  992. return 0;
  993. }
  994. if (typeof obj === 'string') {
  995. return this.createString(obj);
  996. }
  997. else {
  998. return obj.pack(this);
  999. }
  1000. };
  1001. /**
  1002. * A helper function to pack a list of object
  1003. *
  1004. * @returns list of offsets of each non null object
  1005. */
  1006. Builder.prototype.createObjectOffsetList = function (list) {
  1007. var ret = [];
  1008. for (var i = 0; i < list.length; ++i) {
  1009. var val = list[i];
  1010. if (val !== null) {
  1011. ret.push(this.createObjectOffset(val));
  1012. }
  1013. else {
  1014. throw new Error('FlatBuffers: Argument for createObjectOffsetList cannot contain null.');
  1015. }
  1016. }
  1017. return ret;
  1018. };
  1019. Builder.prototype.createStructOffsetList = function (list, startFunc) {
  1020. startFunc(this, list.length);
  1021. this.createObjectOffsetList(list);
  1022. return this.endVector();
  1023. };
  1024. return Builder;
  1025. }());
  1026. exports.Builder = Builder;
  1027. /***/ }),
  1028. /***/ 505:
  1029. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  1030. "use strict";
  1031. Object.defineProperty(exports, "__esModule", ({ value: true }));
  1032. exports.ByteBuffer = void 0;
  1033. var constants_js_1 = __webpack_require__(147);
  1034. var utils_js_1 = __webpack_require__(766);
  1035. var encoding_js_1 = __webpack_require__(650);
  1036. var ByteBuffer = /** @class */ (function () {
  1037. /**
  1038. * Create a new ByteBuffer with a given array of bytes (`Uint8Array`)
  1039. */
  1040. function ByteBuffer(bytes_) {
  1041. this.bytes_ = bytes_;
  1042. this.position_ = 0;
  1043. }
  1044. /**
  1045. * Create and allocate a new ByteBuffer with a given size.
  1046. */
  1047. ByteBuffer.allocate = function (byte_size) {
  1048. return new ByteBuffer(new Uint8Array(byte_size));
  1049. };
  1050. ByteBuffer.prototype.clear = function () {
  1051. this.position_ = 0;
  1052. };
  1053. /**
  1054. * Get the underlying `Uint8Array`.
  1055. */
  1056. ByteBuffer.prototype.bytes = function () {
  1057. return this.bytes_;
  1058. };
  1059. /**
  1060. * Get the buffer's position.
  1061. */
  1062. ByteBuffer.prototype.position = function () {
  1063. return this.position_;
  1064. };
  1065. /**
  1066. * Set the buffer's position.
  1067. */
  1068. ByteBuffer.prototype.setPosition = function (position) {
  1069. this.position_ = position;
  1070. };
  1071. /**
  1072. * Get the buffer's capacity.
  1073. */
  1074. ByteBuffer.prototype.capacity = function () {
  1075. return this.bytes_.length;
  1076. };
  1077. ByteBuffer.prototype.readInt8 = function (offset) {
  1078. return this.readUint8(offset) << 24 >> 24;
  1079. };
  1080. ByteBuffer.prototype.readUint8 = function (offset) {
  1081. return this.bytes_[offset];
  1082. };
  1083. ByteBuffer.prototype.readInt16 = function (offset) {
  1084. return this.readUint16(offset) << 16 >> 16;
  1085. };
  1086. ByteBuffer.prototype.readUint16 = function (offset) {
  1087. return this.bytes_[offset] | this.bytes_[offset + 1] << 8;
  1088. };
  1089. ByteBuffer.prototype.readInt32 = function (offset) {
  1090. return this.bytes_[offset] | this.bytes_[offset + 1] << 8 | this.bytes_[offset + 2] << 16 | this.bytes_[offset + 3] << 24;
  1091. };
  1092. ByteBuffer.prototype.readUint32 = function (offset) {
  1093. return this.readInt32(offset) >>> 0;
  1094. };
  1095. ByteBuffer.prototype.readInt64 = function (offset) {
  1096. return BigInt.asIntN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
  1097. };
  1098. ByteBuffer.prototype.readUint64 = function (offset) {
  1099. return BigInt.asUintN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
  1100. };
  1101. ByteBuffer.prototype.readFloat32 = function (offset) {
  1102. utils_js_1.int32[0] = this.readInt32(offset);
  1103. return utils_js_1.float32[0];
  1104. };
  1105. ByteBuffer.prototype.readFloat64 = function (offset) {
  1106. utils_js_1.int32[utils_js_1.isLittleEndian ? 0 : 1] = this.readInt32(offset);
  1107. utils_js_1.int32[utils_js_1.isLittleEndian ? 1 : 0] = this.readInt32(offset + 4);
  1108. return utils_js_1.float64[0];
  1109. };
  1110. ByteBuffer.prototype.writeInt8 = function (offset, value) {
  1111. this.bytes_[offset] = value;
  1112. };
  1113. ByteBuffer.prototype.writeUint8 = function (offset, value) {
  1114. this.bytes_[offset] = value;
  1115. };
  1116. ByteBuffer.prototype.writeInt16 = function (offset, value) {
  1117. this.bytes_[offset] = value;
  1118. this.bytes_[offset + 1] = value >> 8;
  1119. };
  1120. ByteBuffer.prototype.writeUint16 = function (offset, value) {
  1121. this.bytes_[offset] = value;
  1122. this.bytes_[offset + 1] = value >> 8;
  1123. };
  1124. ByteBuffer.prototype.writeInt32 = function (offset, value) {
  1125. this.bytes_[offset] = value;
  1126. this.bytes_[offset + 1] = value >> 8;
  1127. this.bytes_[offset + 2] = value >> 16;
  1128. this.bytes_[offset + 3] = value >> 24;
  1129. };
  1130. ByteBuffer.prototype.writeUint32 = function (offset, value) {
  1131. this.bytes_[offset] = value;
  1132. this.bytes_[offset + 1] = value >> 8;
  1133. this.bytes_[offset + 2] = value >> 16;
  1134. this.bytes_[offset + 3] = value >> 24;
  1135. };
  1136. ByteBuffer.prototype.writeInt64 = function (offset, value) {
  1137. this.writeInt32(offset, Number(BigInt.asIntN(32, value)));
  1138. this.writeInt32(offset + 4, Number(BigInt.asIntN(32, value >> BigInt(32))));
  1139. };
  1140. ByteBuffer.prototype.writeUint64 = function (offset, value) {
  1141. this.writeUint32(offset, Number(BigInt.asUintN(32, value)));
  1142. this.writeUint32(offset + 4, Number(BigInt.asUintN(32, value >> BigInt(32))));
  1143. };
  1144. ByteBuffer.prototype.writeFloat32 = function (offset, value) {
  1145. utils_js_1.float32[0] = value;
  1146. this.writeInt32(offset, utils_js_1.int32[0]);
  1147. };
  1148. ByteBuffer.prototype.writeFloat64 = function (offset, value) {
  1149. utils_js_1.float64[0] = value;
  1150. this.writeInt32(offset, utils_js_1.int32[utils_js_1.isLittleEndian ? 0 : 1]);
  1151. this.writeInt32(offset + 4, utils_js_1.int32[utils_js_1.isLittleEndian ? 1 : 0]);
  1152. };
  1153. /**
  1154. * Return the file identifier. Behavior is undefined for FlatBuffers whose
  1155. * schema does not include a file_identifier (likely points at padding or the
  1156. * start of a the root vtable).
  1157. */
  1158. ByteBuffer.prototype.getBufferIdentifier = function () {
  1159. if (this.bytes_.length < this.position_ + constants_js_1.SIZEOF_INT +
  1160. constants_js_1.FILE_IDENTIFIER_LENGTH) {
  1161. throw new Error('FlatBuffers: ByteBuffer is too short to contain an identifier.');
  1162. }
  1163. var result = "";
  1164. for (var i = 0; i < constants_js_1.FILE_IDENTIFIER_LENGTH; i++) {
  1165. result += String.fromCharCode(this.readInt8(this.position_ + constants_js_1.SIZEOF_INT + i));
  1166. }
  1167. return result;
  1168. };
  1169. /**
  1170. * Look up a field in the vtable, return an offset into the object, or 0 if the
  1171. * field is not present.
  1172. */
  1173. ByteBuffer.prototype.__offset = function (bb_pos, vtable_offset) {
  1174. var vtable = bb_pos - this.readInt32(bb_pos);
  1175. return vtable_offset < this.readInt16(vtable) ? this.readInt16(vtable + vtable_offset) : 0;
  1176. };
  1177. /**
  1178. * Initialize any Table-derived type to point to the union at the given offset.
  1179. */
  1180. ByteBuffer.prototype.__union = function (t, offset) {
  1181. t.bb_pos = offset + this.readInt32(offset);
  1182. t.bb = this;
  1183. return t;
  1184. };
  1185. /**
  1186. * Create a JavaScript string from UTF-8 data stored inside the FlatBuffer.
  1187. * This allocates a new string and converts to wide chars upon each access.
  1188. *
  1189. * To avoid the conversion to UTF-16, pass Encoding.UTF8_BYTES as
  1190. * the "optionalEncoding" argument. This is useful for avoiding conversion to
  1191. * and from UTF-16 when the data will just be packaged back up in another
  1192. * FlatBuffer later on.
  1193. *
  1194. * @param offset
  1195. * @param opt_encoding Defaults to UTF16_STRING
  1196. */
  1197. ByteBuffer.prototype.__string = function (offset, opt_encoding) {
  1198. offset += this.readInt32(offset);
  1199. var length = this.readInt32(offset);
  1200. var result = '';
  1201. var i = 0;
  1202. offset += constants_js_1.SIZEOF_INT;
  1203. if (opt_encoding === encoding_js_1.Encoding.UTF8_BYTES) {
  1204. return this.bytes_.subarray(offset, offset + length);
  1205. }
  1206. while (i < length) {
  1207. var codePoint = void 0;
  1208. // Decode UTF-8
  1209. var a = this.readUint8(offset + i++);
  1210. if (a < 0xC0) {
  1211. codePoint = a;
  1212. }
  1213. else {
  1214. var b = this.readUint8(offset + i++);
  1215. if (a < 0xE0) {
  1216. codePoint =
  1217. ((a & 0x1F) << 6) |
  1218. (b & 0x3F);
  1219. }
  1220. else {
  1221. var c = this.readUint8(offset + i++);
  1222. if (a < 0xF0) {
  1223. codePoint =
  1224. ((a & 0x0F) << 12) |
  1225. ((b & 0x3F) << 6) |
  1226. (c & 0x3F);
  1227. }
  1228. else {
  1229. var d = this.readUint8(offset + i++);
  1230. codePoint =
  1231. ((a & 0x07) << 18) |
  1232. ((b & 0x3F) << 12) |
  1233. ((c & 0x3F) << 6) |
  1234. (d & 0x3F);
  1235. }
  1236. }
  1237. }
  1238. // Encode UTF-16
  1239. if (codePoint < 0x10000) {
  1240. result += String.fromCharCode(codePoint);
  1241. }
  1242. else {
  1243. codePoint -= 0x10000;
  1244. result += String.fromCharCode((codePoint >> 10) + 0xD800, (codePoint & ((1 << 10) - 1)) + 0xDC00);
  1245. }
  1246. }
  1247. return result;
  1248. };
  1249. /**
  1250. * Handle unions that can contain string as its member, if a Table-derived type then initialize it,
  1251. * if a string then return a new one
  1252. *
  1253. * WARNING: strings are immutable in JS so we can't change the string that the user gave us, this
  1254. * makes the behaviour of __union_with_string different compared to __union
  1255. */
  1256. ByteBuffer.prototype.__union_with_string = function (o, offset) {
  1257. if (typeof o === 'string') {
  1258. return this.__string(offset);
  1259. }
  1260. return this.__union(o, offset);
  1261. };
  1262. /**
  1263. * Retrieve the relative offset stored at "offset"
  1264. */
  1265. ByteBuffer.prototype.__indirect = function (offset) {
  1266. return offset + this.readInt32(offset);
  1267. };
  1268. /**
  1269. * Get the start of data of a vector whose offset is stored at "offset" in this object.
  1270. */
  1271. ByteBuffer.prototype.__vector = function (offset) {
  1272. return offset + this.readInt32(offset) + constants_js_1.SIZEOF_INT; // data starts after the length
  1273. };
  1274. /**
  1275. * Get the length of a vector whose offset is stored at "offset" in this object.
  1276. */
  1277. ByteBuffer.prototype.__vector_len = function (offset) {
  1278. return this.readInt32(offset + this.readInt32(offset));
  1279. };
  1280. ByteBuffer.prototype.__has_identifier = function (ident) {
  1281. if (ident.length != constants_js_1.FILE_IDENTIFIER_LENGTH) {
  1282. throw new Error('FlatBuffers: file identifier must be length ' +
  1283. constants_js_1.FILE_IDENTIFIER_LENGTH);
  1284. }
  1285. for (var i = 0; i < constants_js_1.FILE_IDENTIFIER_LENGTH; i++) {
  1286. if (ident.charCodeAt(i) != this.readInt8(this.position() + constants_js_1.SIZEOF_INT + i)) {
  1287. return false;
  1288. }
  1289. }
  1290. return true;
  1291. };
  1292. /**
  1293. * A helper function for generating list for obj api
  1294. */
  1295. ByteBuffer.prototype.createScalarList = function (listAccessor, listLength) {
  1296. var ret = [];
  1297. for (var i = 0; i < listLength; ++i) {
  1298. if (listAccessor(i) !== null) {
  1299. ret.push(listAccessor(i));
  1300. }
  1301. }
  1302. return ret;
  1303. };
  1304. /**
  1305. * A helper function for generating list for obj api
  1306. * @param listAccessor function that accepts an index and return data at that index
  1307. * @param listLength listLength
  1308. * @param res result list
  1309. */
  1310. ByteBuffer.prototype.createObjList = function (listAccessor, listLength) {
  1311. var ret = [];
  1312. for (var i = 0; i < listLength; ++i) {
  1313. var val = listAccessor(i);
  1314. if (val !== null) {
  1315. ret.push(val.unpack());
  1316. }
  1317. }
  1318. return ret;
  1319. };
  1320. return ByteBuffer;
  1321. }());
  1322. exports.ByteBuffer = ByteBuffer;
  1323. /***/ }),
  1324. /***/ 147:
  1325. /***/ ((__unused_webpack_module, exports) => {
  1326. "use strict";
  1327. Object.defineProperty(exports, "__esModule", ({ value: true }));
  1328. exports.SIZE_PREFIX_LENGTH = exports.FILE_IDENTIFIER_LENGTH = exports.SIZEOF_INT = exports.SIZEOF_SHORT = void 0;
  1329. exports.SIZEOF_SHORT = 2;
  1330. exports.SIZEOF_INT = 4;
  1331. exports.FILE_IDENTIFIER_LENGTH = 4;
  1332. exports.SIZE_PREFIX_LENGTH = 4;
  1333. /***/ }),
  1334. /***/ 650:
  1335. /***/ ((__unused_webpack_module, exports) => {
  1336. "use strict";
  1337. Object.defineProperty(exports, "__esModule", ({ value: true }));
  1338. exports.Encoding = void 0;
  1339. var Encoding;
  1340. (function (Encoding) {
  1341. Encoding[Encoding["UTF8_BYTES"] = 1] = "UTF8_BYTES";
  1342. Encoding[Encoding["UTF16_STRING"] = 2] = "UTF16_STRING";
  1343. })(Encoding = exports.Encoding || (exports.Encoding = {}));
  1344. /***/ }),
  1345. /***/ 903:
  1346. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  1347. "use strict";
  1348. var __webpack_unused_export__;
  1349. __webpack_unused_export__ = ({ value: true });
  1350. exports.cZ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = exports.XU = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = void 0;
  1351. var constants_js_1 = __webpack_require__(147);
  1352. __webpack_unused_export__ = ({ enumerable: true, get: function () { return constants_js_1.SIZEOF_SHORT; } });
  1353. var constants_js_2 = __webpack_require__(147);
  1354. __webpack_unused_export__ = ({ enumerable: true, get: function () { return constants_js_2.SIZEOF_INT; } });
  1355. var constants_js_3 = __webpack_require__(147);
  1356. __webpack_unused_export__ = ({ enumerable: true, get: function () { return constants_js_3.FILE_IDENTIFIER_LENGTH; } });
  1357. var constants_js_4 = __webpack_require__(147);
  1358. Object.defineProperty(exports, "XU", ({ enumerable: true, get: function () { return constants_js_4.SIZE_PREFIX_LENGTH; } }));
  1359. var utils_js_1 = __webpack_require__(766);
  1360. __webpack_unused_export__ = ({ enumerable: true, get: function () { return utils_js_1.int32; } });
  1361. __webpack_unused_export__ = ({ enumerable: true, get: function () { return utils_js_1.float32; } });
  1362. __webpack_unused_export__ = ({ enumerable: true, get: function () { return utils_js_1.float64; } });
  1363. __webpack_unused_export__ = ({ enumerable: true, get: function () { return utils_js_1.isLittleEndian; } });
  1364. var encoding_js_1 = __webpack_require__(650);
  1365. __webpack_unused_export__ = ({ enumerable: true, get: function () { return encoding_js_1.Encoding; } });
  1366. var builder_js_1 = __webpack_require__(962);
  1367. __webpack_unused_export__ = ({ enumerable: true, get: function () { return builder_js_1.Builder; } });
  1368. var byte_buffer_js_1 = __webpack_require__(505);
  1369. Object.defineProperty(exports, "cZ", ({ enumerable: true, get: function () { return byte_buffer_js_1.ByteBuffer; } }));
  1370. /***/ }),
  1371. /***/ 766:
  1372. /***/ ((__unused_webpack_module, exports) => {
  1373. "use strict";
  1374. Object.defineProperty(exports, "__esModule", ({ value: true }));
  1375. exports.isLittleEndian = exports.float64 = exports.float32 = exports.int32 = void 0;
  1376. exports.int32 = new Int32Array(2);
  1377. exports.float32 = new Float32Array(exports.int32.buffer);
  1378. exports.float64 = new Float64Array(exports.int32.buffer);
  1379. exports.isLittleEndian = new Uint16Array(new Uint8Array([1, 0]).buffer)[0] === 1;
  1380. /***/ }),
  1381. /***/ 186:
  1382. /***/ ((module) => {
  1383. var containers = []; // will store container HTMLElement references
  1384. var styleElements = []; // will store {prepend: HTMLElement, append: HTMLElement}
  1385. var usage = 'insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).';
  1386. function insertCss(css, options) {
  1387. options = options || {};
  1388. if (css === undefined) {
  1389. throw new Error(usage);
  1390. }
  1391. var position = options.prepend === true ? 'prepend' : 'append';
  1392. var container = options.container !== undefined ? options.container : document.querySelector('head');
  1393. var containerId = containers.indexOf(container);
  1394. // first time we see this container, create the necessary entries
  1395. if (containerId === -1) {
  1396. containerId = containers.push(container) - 1;
  1397. styleElements[containerId] = {};
  1398. }
  1399. // try to get the correponding container + position styleElement, create it otherwise
  1400. var styleElement;
  1401. if (styleElements[containerId] !== undefined && styleElements[containerId][position] !== undefined) {
  1402. styleElement = styleElements[containerId][position];
  1403. } else {
  1404. styleElement = styleElements[containerId][position] = createStyleElement();
  1405. if (position === 'prepend') {
  1406. container.insertBefore(styleElement, container.childNodes[0]);
  1407. } else {
  1408. container.appendChild(styleElement);
  1409. }
  1410. }
  1411. // strip potential UTF-8 BOM if css was read from a file
  1412. if (css.charCodeAt(0) === 0xFEFF) { css = css.substr(1, css.length); }
  1413. // actually add the stylesheet
  1414. if (styleElement.styleSheet) {
  1415. styleElement.styleSheet.cssText += css
  1416. } else {
  1417. styleElement.textContent += css;
  1418. }
  1419. return styleElement;
  1420. };
  1421. function createStyleElement() {
  1422. var styleElement = document.createElement('style');
  1423. styleElement.setAttribute('type', 'text/css');
  1424. return styleElement;
  1425. }
  1426. module.exports = insertCss;
  1427. module.exports.insertCss = insertCss;
  1428. /***/ }),
  1429. /***/ 465:
  1430. /***/ ((module, exports, __webpack_require__) => {
  1431. /* module decorator */ module = __webpack_require__.nmd(module);
  1432. /**
  1433. * lodash (Custom Build) <https://lodash.com/>
  1434. * Build: `lodash modularize exports="npm" -o ./`
  1435. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  1436. * Released under MIT license <https://lodash.com/license>
  1437. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  1438. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  1439. */
  1440. /** Used as the size to enable large array optimizations. */
  1441. var LARGE_ARRAY_SIZE = 200;
  1442. /** Used to stand-in for `undefined` hash values. */
  1443. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  1444. /** Used as references for various `Number` constants. */
  1445. var MAX_SAFE_INTEGER = 9007199254740991;
  1446. /** `Object#toString` result references. */
  1447. var argsTag = '[object Arguments]',
  1448. arrayTag = '[object Array]',
  1449. boolTag = '[object Boolean]',
  1450. dateTag = '[object Date]',
  1451. errorTag = '[object Error]',
  1452. funcTag = '[object Function]',
  1453. genTag = '[object GeneratorFunction]',
  1454. mapTag = '[object Map]',
  1455. numberTag = '[object Number]',
  1456. objectTag = '[object Object]',
  1457. promiseTag = '[object Promise]',
  1458. regexpTag = '[object RegExp]',
  1459. setTag = '[object Set]',
  1460. stringTag = '[object String]',
  1461. symbolTag = '[object Symbol]',
  1462. weakMapTag = '[object WeakMap]';
  1463. var arrayBufferTag = '[object ArrayBuffer]',
  1464. dataViewTag = '[object DataView]',
  1465. float32Tag = '[object Float32Array]',
  1466. float64Tag = '[object Float64Array]',
  1467. int8Tag = '[object Int8Array]',
  1468. int16Tag = '[object Int16Array]',
  1469. int32Tag = '[object Int32Array]',
  1470. uint8Tag = '[object Uint8Array]',
  1471. uint8ClampedTag = '[object Uint8ClampedArray]',
  1472. uint16Tag = '[object Uint16Array]',
  1473. uint32Tag = '[object Uint32Array]';
  1474. /**
  1475. * Used to match `RegExp`
  1476. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  1477. */
  1478. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  1479. /** Used to match `RegExp` flags from their coerced string values. */
  1480. var reFlags = /\w*$/;
  1481. /** Used to detect host constructors (Safari). */
  1482. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1483. /** Used to detect unsigned integer values. */
  1484. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1485. /** Used to identify `toStringTag` values supported by `_.clone`. */
  1486. var cloneableTags = {};
  1487. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  1488. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  1489. cloneableTags[boolTag] = cloneableTags[dateTag] =
  1490. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  1491. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  1492. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  1493. cloneableTags[numberTag] = cloneableTags[objectTag] =
  1494. cloneableTags[regexpTag] = cloneableTags[setTag] =
  1495. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  1496. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  1497. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  1498. cloneableTags[errorTag] = cloneableTags[funcTag] =
  1499. cloneableTags[weakMapTag] = false;
  1500. /** Detect free variable `global` from Node.js. */
  1501. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  1502. /** Detect free variable `self`. */
  1503. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  1504. /** Used as a reference to the global object. */
  1505. var root = freeGlobal || freeSelf || Function('return this')();
  1506. /** Detect free variable `exports`. */
  1507. var freeExports = true && exports && !exports.nodeType && exports;
  1508. /** Detect free variable `module`. */
  1509. var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
  1510. /** Detect the popular CommonJS extension `module.exports`. */
  1511. var moduleExports = freeModule && freeModule.exports === freeExports;
  1512. /**
  1513. * Adds the key-value `pair` to `map`.
  1514. *
  1515. * @private
  1516. * @param {Object} map The map to modify.
  1517. * @param {Array} pair The key-value pair to add.
  1518. * @returns {Object} Returns `map`.
  1519. */
  1520. function addMapEntry(map, pair) {
  1521. // Don't return `map.set` because it's not chainable in IE 11.
  1522. map.set(pair[0], pair[1]);
  1523. return map;
  1524. }
  1525. /**
  1526. * Adds `value` to `set`.
  1527. *
  1528. * @private
  1529. * @param {Object} set The set to modify.
  1530. * @param {*} value The value to add.
  1531. * @returns {Object} Returns `set`.
  1532. */
  1533. function addSetEntry(set, value) {
  1534. // Don't return `set.add` because it's not chainable in IE 11.
  1535. set.add(value);
  1536. return set;
  1537. }
  1538. /**
  1539. * A specialized version of `_.forEach` for arrays without support for
  1540. * iteratee shorthands.
  1541. *
  1542. * @private
  1543. * @param {Array} [array] The array to iterate over.
  1544. * @param {Function} iteratee The function invoked per iteration.
  1545. * @returns {Array} Returns `array`.
  1546. */
  1547. function arrayEach(array, iteratee) {
  1548. var index = -1,
  1549. length = array ? array.length : 0;
  1550. while (++index < length) {
  1551. if (iteratee(array[index], index, array) === false) {
  1552. break;
  1553. }
  1554. }
  1555. return array;
  1556. }
  1557. /**
  1558. * Appends the elements of `values` to `array`.
  1559. *
  1560. * @private
  1561. * @param {Array} array The array to modify.
  1562. * @param {Array} values The values to append.
  1563. * @returns {Array} Returns `array`.
  1564. */
  1565. function arrayPush(array, values) {
  1566. var index = -1,
  1567. length = values.length,
  1568. offset = array.length;
  1569. while (++index < length) {
  1570. array[offset + index] = values[index];
  1571. }
  1572. return array;
  1573. }
  1574. /**
  1575. * A specialized version of `_.reduce` for arrays without support for
  1576. * iteratee shorthands.
  1577. *
  1578. * @private
  1579. * @param {Array} [array] The array to iterate over.
  1580. * @param {Function} iteratee The function invoked per iteration.
  1581. * @param {*} [accumulator] The initial value.
  1582. * @param {boolean} [initAccum] Specify using the first element of `array` as
  1583. * the initial value.
  1584. * @returns {*} Returns the accumulated value.
  1585. */
  1586. function arrayReduce(array, iteratee, accumulator, initAccum) {
  1587. var index = -1,
  1588. length = array ? array.length : 0;
  1589. if (initAccum && length) {
  1590. accumulator = array[++index];
  1591. }
  1592. while (++index < length) {
  1593. accumulator = iteratee(accumulator, array[index], index, array);
  1594. }
  1595. return accumulator;
  1596. }
  1597. /**
  1598. * The base implementation of `_.times` without support for iteratee shorthands
  1599. * or max array length checks.
  1600. *
  1601. * @private
  1602. * @param {number} n The number of times to invoke `iteratee`.
  1603. * @param {Function} iteratee The function invoked per iteration.
  1604. * @returns {Array} Returns the array of results.
  1605. */
  1606. function baseTimes(n, iteratee) {
  1607. var index = -1,
  1608. result = Array(n);
  1609. while (++index < n) {
  1610. result[index] = iteratee(index);
  1611. }
  1612. return result;
  1613. }
  1614. /**
  1615. * Gets the value at `key` of `object`.
  1616. *
  1617. * @private
  1618. * @param {Object} [object] The object to query.
  1619. * @param {string} key The key of the property to get.
  1620. * @returns {*} Returns the property value.
  1621. */
  1622. function getValue(object, key) {
  1623. return object == null ? undefined : object[key];
  1624. }
  1625. /**
  1626. * Checks if `value` is a host object in IE < 9.
  1627. *
  1628. * @private
  1629. * @param {*} value The value to check.
  1630. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  1631. */
  1632. function isHostObject(value) {
  1633. // Many host objects are `Object` objects that can coerce to strings
  1634. // despite having improperly defined `toString` methods.
  1635. var result = false;
  1636. if (value != null && typeof value.toString != 'function') {
  1637. try {
  1638. result = !!(value + '');
  1639. } catch (e) {}
  1640. }
  1641. return result;
  1642. }
  1643. /**
  1644. * Converts `map` to its key-value pairs.
  1645. *
  1646. * @private
  1647. * @param {Object} map The map to convert.
  1648. * @returns {Array} Returns the key-value pairs.
  1649. */
  1650. function mapToArray(map) {
  1651. var index = -1,
  1652. result = Array(map.size);
  1653. map.forEach(function(value, key) {
  1654. result[++index] = [key, value];
  1655. });
  1656. return result;
  1657. }
  1658. /**
  1659. * Creates a unary function that invokes `func` with its argument transformed.
  1660. *
  1661. * @private
  1662. * @param {Function} func The function to wrap.
  1663. * @param {Function} transform The argument transform.
  1664. * @returns {Function} Returns the new function.
  1665. */
  1666. function overArg(func, transform) {
  1667. return function(arg) {
  1668. return func(transform(arg));
  1669. };
  1670. }
  1671. /**
  1672. * Converts `set` to an array of its values.
  1673. *
  1674. * @private
  1675. * @param {Object} set The set to convert.
  1676. * @returns {Array} Returns the values.
  1677. */
  1678. function setToArray(set) {
  1679. var index = -1,
  1680. result = Array(set.size);
  1681. set.forEach(function(value) {
  1682. result[++index] = value;
  1683. });
  1684. return result;
  1685. }
  1686. /** Used for built-in method references. */
  1687. var arrayProto = Array.prototype,
  1688. funcProto = Function.prototype,
  1689. objectProto = Object.prototype;
  1690. /** Used to detect overreaching core-js shims. */
  1691. var coreJsData = root['__core-js_shared__'];
  1692. /** Used to detect methods masquerading as native. */
  1693. var maskSrcKey = (function() {
  1694. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  1695. return uid ? ('Symbol(src)_1.' + uid) : '';
  1696. }());
  1697. /** Used to resolve the decompiled source of functions. */
  1698. var funcToString = funcProto.toString;
  1699. /** Used to check objects for own properties. */
  1700. var hasOwnProperty = objectProto.hasOwnProperty;
  1701. /**
  1702. * Used to resolve the
  1703. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  1704. * of values.
  1705. */
  1706. var objectToString = objectProto.toString;
  1707. /** Used to detect if a method is native. */
  1708. var reIsNative = RegExp('^' +
  1709. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  1710. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  1711. );
  1712. /** Built-in value references. */
  1713. var Buffer = moduleExports ? root.Buffer : undefined,
  1714. Symbol = root.Symbol,
  1715. Uint8Array = root.Uint8Array,
  1716. getPrototype = overArg(Object.getPrototypeOf, Object),
  1717. objectCreate = Object.create,
  1718. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  1719. splice = arrayProto.splice;
  1720. /* Built-in method references for those with the same name as other `lodash` methods. */
  1721. var nativeGetSymbols = Object.getOwnPropertySymbols,
  1722. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  1723. nativeKeys = overArg(Object.keys, Object);
  1724. /* Built-in method references that are verified to be native. */
  1725. var DataView = getNative(root, 'DataView'),
  1726. Map = getNative(root, 'Map'),
  1727. Promise = getNative(root, 'Promise'),
  1728. Set = getNative(root, 'Set'),
  1729. WeakMap = getNative(root, 'WeakMap'),
  1730. nativeCreate = getNative(Object, 'create');
  1731. /** Used to detect maps, sets, and weakmaps. */
  1732. var dataViewCtorString = toSource(DataView),
  1733. mapCtorString = toSource(Map),
  1734. promiseCtorString = toSource(Promise),
  1735. setCtorString = toSource(Set),
  1736. weakMapCtorString = toSource(WeakMap);
  1737. /** Used to convert symbols to primitives and strings. */
  1738. var symbolProto = Symbol ? Symbol.prototype : undefined,
  1739. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
  1740. /**
  1741. * Creates a hash object.
  1742. *
  1743. * @private
  1744. * @constructor
  1745. * @param {Array} [entries] The key-value pairs to cache.
  1746. */
  1747. function Hash(entries) {
  1748. var index = -1,
  1749. length = entries ? entries.length : 0;
  1750. this.clear();
  1751. while (++index < length) {
  1752. var entry = entries[index];
  1753. this.set(entry[0], entry[1]);
  1754. }
  1755. }
  1756. /**
  1757. * Removes all key-value entries from the hash.
  1758. *
  1759. * @private
  1760. * @name clear
  1761. * @memberOf Hash
  1762. */
  1763. function hashClear() {
  1764. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  1765. }
  1766. /**
  1767. * Removes `key` and its value from the hash.
  1768. *
  1769. * @private
  1770. * @name delete
  1771. * @memberOf Hash
  1772. * @param {Object} hash The hash to modify.
  1773. * @param {string} key The key of the value to remove.
  1774. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1775. */
  1776. function hashDelete(key) {
  1777. return this.has(key) && delete this.__data__[key];
  1778. }
  1779. /**
  1780. * Gets the hash value for `key`.
  1781. *
  1782. * @private
  1783. * @name get
  1784. * @memberOf Hash
  1785. * @param {string} key The key of the value to get.
  1786. * @returns {*} Returns the entry value.
  1787. */
  1788. function hashGet(key) {
  1789. var data = this.__data__;
  1790. if (nativeCreate) {
  1791. var result = data[key];
  1792. return result === HASH_UNDEFINED ? undefined : result;
  1793. }
  1794. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  1795. }
  1796. /**
  1797. * Checks if a hash value for `key` exists.
  1798. *
  1799. * @private
  1800. * @name has
  1801. * @memberOf Hash
  1802. * @param {string} key The key of the entry to check.
  1803. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1804. */
  1805. function hashHas(key) {
  1806. var data = this.__data__;
  1807. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  1808. }
  1809. /**
  1810. * Sets the hash `key` to `value`.
  1811. *
  1812. * @private
  1813. * @name set
  1814. * @memberOf Hash
  1815. * @param {string} key The key of the value to set.
  1816. * @param {*} value The value to set.
  1817. * @returns {Object} Returns the hash instance.
  1818. */
  1819. function hashSet(key, value) {
  1820. var data = this.__data__;
  1821. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  1822. return this;
  1823. }
  1824. // Add methods to `Hash`.
  1825. Hash.prototype.clear = hashClear;
  1826. Hash.prototype['delete'] = hashDelete;
  1827. Hash.prototype.get = hashGet;
  1828. Hash.prototype.has = hashHas;
  1829. Hash.prototype.set = hashSet;
  1830. /**
  1831. * Creates an list cache object.
  1832. *
  1833. * @private
  1834. * @constructor
  1835. * @param {Array} [entries] The key-value pairs to cache.
  1836. */
  1837. function ListCache(entries) {
  1838. var index = -1,
  1839. length = entries ? entries.length : 0;
  1840. this.clear();
  1841. while (++index < length) {
  1842. var entry = entries[index];
  1843. this.set(entry[0], entry[1]);
  1844. }
  1845. }
  1846. /**
  1847. * Removes all key-value entries from the list cache.
  1848. *
  1849. * @private
  1850. * @name clear
  1851. * @memberOf ListCache
  1852. */
  1853. function listCacheClear() {
  1854. this.__data__ = [];
  1855. }
  1856. /**
  1857. * Removes `key` and its value from the list cache.
  1858. *
  1859. * @private
  1860. * @name delete
  1861. * @memberOf ListCache
  1862. * @param {string} key The key of the value to remove.
  1863. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1864. */
  1865. function listCacheDelete(key) {
  1866. var data = this.__data__,
  1867. index = assocIndexOf(data, key);
  1868. if (index < 0) {
  1869. return false;
  1870. }
  1871. var lastIndex = data.length - 1;
  1872. if (index == lastIndex) {
  1873. data.pop();
  1874. } else {
  1875. splice.call(data, index, 1);
  1876. }
  1877. return true;
  1878. }
  1879. /**
  1880. * Gets the list cache value for `key`.
  1881. *
  1882. * @private
  1883. * @name get
  1884. * @memberOf ListCache
  1885. * @param {string} key The key of the value to get.
  1886. * @returns {*} Returns the entry value.
  1887. */
  1888. function listCacheGet(key) {
  1889. var data = this.__data__,
  1890. index = assocIndexOf(data, key);
  1891. return index < 0 ? undefined : data[index][1];
  1892. }
  1893. /**
  1894. * Checks if a list cache value for `key` exists.
  1895. *
  1896. * @private
  1897. * @name has
  1898. * @memberOf ListCache
  1899. * @param {string} key The key of the entry to check.
  1900. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1901. */
  1902. function listCacheHas(key) {
  1903. return assocIndexOf(this.__data__, key) > -1;
  1904. }
  1905. /**
  1906. * Sets the list cache `key` to `value`.
  1907. *
  1908. * @private
  1909. * @name set
  1910. * @memberOf ListCache
  1911. * @param {string} key The key of the value to set.
  1912. * @param {*} value The value to set.
  1913. * @returns {Object} Returns the list cache instance.
  1914. */
  1915. function listCacheSet(key, value) {
  1916. var data = this.__data__,
  1917. index = assocIndexOf(data, key);
  1918. if (index < 0) {
  1919. data.push([key, value]);
  1920. } else {
  1921. data[index][1] = value;
  1922. }
  1923. return this;
  1924. }
  1925. // Add methods to `ListCache`.
  1926. ListCache.prototype.clear = listCacheClear;
  1927. ListCache.prototype['delete'] = listCacheDelete;
  1928. ListCache.prototype.get = listCacheGet;
  1929. ListCache.prototype.has = listCacheHas;
  1930. ListCache.prototype.set = listCacheSet;
  1931. /**
  1932. * Creates a map cache object to store key-value pairs.
  1933. *
  1934. * @private
  1935. * @constructor
  1936. * @param {Array} [entries] The key-value pairs to cache.
  1937. */
  1938. function MapCache(entries) {
  1939. var index = -1,
  1940. length = entries ? entries.length : 0;
  1941. this.clear();
  1942. while (++index < length) {
  1943. var entry = entries[index];
  1944. this.set(entry[0], entry[1]);
  1945. }
  1946. }
  1947. /**
  1948. * Removes all key-value entries from the map.
  1949. *
  1950. * @private
  1951. * @name clear
  1952. * @memberOf MapCache
  1953. */
  1954. function mapCacheClear() {
  1955. this.__data__ = {
  1956. 'hash': new Hash,
  1957. 'map': new (Map || ListCache),
  1958. 'string': new Hash
  1959. };
  1960. }
  1961. /**
  1962. * Removes `key` and its value from the map.
  1963. *
  1964. * @private
  1965. * @name delete
  1966. * @memberOf MapCache
  1967. * @param {string} key The key of the value to remove.
  1968. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1969. */
  1970. function mapCacheDelete(key) {
  1971. return getMapData(this, key)['delete'](key);
  1972. }
  1973. /**
  1974. * Gets the map value for `key`.
  1975. *
  1976. * @private
  1977. * @name get
  1978. * @memberOf MapCache
  1979. * @param {string} key The key of the value to get.
  1980. * @returns {*} Returns the entry value.
  1981. */
  1982. function mapCacheGet(key) {
  1983. return getMapData(this, key).get(key);
  1984. }
  1985. /**
  1986. * Checks if a map value for `key` exists.
  1987. *
  1988. * @private
  1989. * @name has
  1990. * @memberOf MapCache
  1991. * @param {string} key The key of the entry to check.
  1992. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1993. */
  1994. function mapCacheHas(key) {
  1995. return getMapData(this, key).has(key);
  1996. }
  1997. /**
  1998. * Sets the map `key` to `value`.
  1999. *
  2000. * @private
  2001. * @name set
  2002. * @memberOf MapCache
  2003. * @param {string} key The key of the value to set.
  2004. * @param {*} value The value to set.
  2005. * @returns {Object} Returns the map cache instance.
  2006. */
  2007. function mapCacheSet(key, value) {
  2008. getMapData(this, key).set(key, value);
  2009. return this;
  2010. }
  2011. // Add methods to `MapCache`.
  2012. MapCache.prototype.clear = mapCacheClear;
  2013. MapCache.prototype['delete'] = mapCacheDelete;
  2014. MapCache.prototype.get = mapCacheGet;
  2015. MapCache.prototype.has = mapCacheHas;
  2016. MapCache.prototype.set = mapCacheSet;
  2017. /**
  2018. * Creates a stack cache object to store key-value pairs.
  2019. *
  2020. * @private
  2021. * @constructor
  2022. * @param {Array} [entries] The key-value pairs to cache.
  2023. */
  2024. function Stack(entries) {
  2025. this.__data__ = new ListCache(entries);
  2026. }
  2027. /**
  2028. * Removes all key-value entries from the stack.
  2029. *
  2030. * @private
  2031. * @name clear
  2032. * @memberOf Stack
  2033. */
  2034. function stackClear() {
  2035. this.__data__ = new ListCache;
  2036. }
  2037. /**
  2038. * Removes `key` and its value from the stack.
  2039. *
  2040. * @private
  2041. * @name delete
  2042. * @memberOf Stack
  2043. * @param {string} key The key of the value to remove.
  2044. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2045. */
  2046. function stackDelete(key) {
  2047. return this.__data__['delete'](key);
  2048. }
  2049. /**
  2050. * Gets the stack value for `key`.
  2051. *
  2052. * @private
  2053. * @name get
  2054. * @memberOf Stack
  2055. * @param {string} key The key of the value to get.
  2056. * @returns {*} Returns the entry value.
  2057. */
  2058. function stackGet(key) {
  2059. return this.__data__.get(key);
  2060. }
  2061. /**
  2062. * Checks if a stack value for `key` exists.
  2063. *
  2064. * @private
  2065. * @name has
  2066. * @memberOf Stack
  2067. * @param {string} key The key of the entry to check.
  2068. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2069. */
  2070. function stackHas(key) {
  2071. return this.__data__.has(key);
  2072. }
  2073. /**
  2074. * Sets the stack `key` to `value`.
  2075. *
  2076. * @private
  2077. * @name set
  2078. * @memberOf Stack
  2079. * @param {string} key The key of the value to set.
  2080. * @param {*} value The value to set.
  2081. * @returns {Object} Returns the stack cache instance.
  2082. */
  2083. function stackSet(key, value) {
  2084. var cache = this.__data__;
  2085. if (cache instanceof ListCache) {
  2086. var pairs = cache.__data__;
  2087. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  2088. pairs.push([key, value]);
  2089. return this;
  2090. }
  2091. cache = this.__data__ = new MapCache(pairs);
  2092. }
  2093. cache.set(key, value);
  2094. return this;
  2095. }
  2096. // Add methods to `Stack`.
  2097. Stack.prototype.clear = stackClear;
  2098. Stack.prototype['delete'] = stackDelete;
  2099. Stack.prototype.get = stackGet;
  2100. Stack.prototype.has = stackHas;
  2101. Stack.prototype.set = stackSet;
  2102. /**
  2103. * Creates an array of the enumerable property names of the array-like `value`.
  2104. *
  2105. * @private
  2106. * @param {*} value The value to query.
  2107. * @param {boolean} inherited Specify returning inherited property names.
  2108. * @returns {Array} Returns the array of property names.
  2109. */
  2110. function arrayLikeKeys(value, inherited) {
  2111. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  2112. // Safari 9 makes `arguments.length` enumerable in strict mode.
  2113. var result = (isArray(value) || isArguments(value))
  2114. ? baseTimes(value.length, String)
  2115. : [];
  2116. var length = result.length,
  2117. skipIndexes = !!length;
  2118. for (var key in value) {
  2119. if ((inherited || hasOwnProperty.call(value, key)) &&
  2120. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  2121. result.push(key);
  2122. }
  2123. }
  2124. return result;
  2125. }
  2126. /**
  2127. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  2128. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  2129. * for equality comparisons.
  2130. *
  2131. * @private
  2132. * @param {Object} object The object to modify.
  2133. * @param {string} key The key of the property to assign.
  2134. * @param {*} value The value to assign.
  2135. */
  2136. function assignValue(object, key, value) {
  2137. var objValue = object[key];
  2138. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  2139. (value === undefined && !(key in object))) {
  2140. object[key] = value;
  2141. }
  2142. }
  2143. /**
  2144. * Gets the index at which the `key` is found in `array` of key-value pairs.
  2145. *
  2146. * @private
  2147. * @param {Array} array The array to inspect.
  2148. * @param {*} key The key to search for.
  2149. * @returns {number} Returns the index of the matched value, else `-1`.
  2150. */
  2151. function assocIndexOf(array, key) {
  2152. var length = array.length;
  2153. while (length--) {
  2154. if (eq(array[length][0], key)) {
  2155. return length;
  2156. }
  2157. }
  2158. return -1;
  2159. }
  2160. /**
  2161. * The base implementation of `_.assign` without support for multiple sources
  2162. * or `customizer` functions.
  2163. *
  2164. * @private
  2165. * @param {Object} object The destination object.
  2166. * @param {Object} source The source object.
  2167. * @returns {Object} Returns `object`.
  2168. */
  2169. function baseAssign(object, source) {
  2170. return object && copyObject(source, keys(source), object);
  2171. }
  2172. /**
  2173. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  2174. * traversed objects.
  2175. *
  2176. * @private
  2177. * @param {*} value The value to clone.
  2178. * @param {boolean} [isDeep] Specify a deep clone.
  2179. * @param {boolean} [isFull] Specify a clone including symbols.
  2180. * @param {Function} [customizer] The function to customize cloning.
  2181. * @param {string} [key] The key of `value`.
  2182. * @param {Object} [object] The parent object of `value`.
  2183. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  2184. * @returns {*} Returns the cloned value.
  2185. */
  2186. function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
  2187. var result;
  2188. if (customizer) {
  2189. result = object ? customizer(value, key, object, stack) : customizer(value);
  2190. }
  2191. if (result !== undefined) {
  2192. return result;
  2193. }
  2194. if (!isObject(value)) {
  2195. return value;
  2196. }
  2197. var isArr = isArray(value);
  2198. if (isArr) {
  2199. result = initCloneArray(value);
  2200. if (!isDeep) {
  2201. return copyArray(value, result);
  2202. }
  2203. } else {
  2204. var tag = getTag(value),
  2205. isFunc = tag == funcTag || tag == genTag;
  2206. if (isBuffer(value)) {
  2207. return cloneBuffer(value, isDeep);
  2208. }
  2209. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  2210. if (isHostObject(value)) {
  2211. return object ? value : {};
  2212. }
  2213. result = initCloneObject(isFunc ? {} : value);
  2214. if (!isDeep) {
  2215. return copySymbols(value, baseAssign(result, value));
  2216. }
  2217. } else {
  2218. if (!cloneableTags[tag]) {
  2219. return object ? value : {};
  2220. }
  2221. result = initCloneByTag(value, tag, baseClone, isDeep);
  2222. }
  2223. }
  2224. // Check for circular references and return its corresponding clone.
  2225. stack || (stack = new Stack);
  2226. var stacked = stack.get(value);
  2227. if (stacked) {
  2228. return stacked;
  2229. }
  2230. stack.set(value, result);
  2231. if (!isArr) {
  2232. var props = isFull ? getAllKeys(value) : keys(value);
  2233. }
  2234. arrayEach(props || value, function(subValue, key) {
  2235. if (props) {
  2236. key = subValue;
  2237. subValue = value[key];
  2238. }
  2239. // Recursively populate clone (susceptible to call stack limits).
  2240. assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
  2241. });
  2242. return result;
  2243. }
  2244. /**
  2245. * The base implementation of `_.create` without support for assigning
  2246. * properties to the created object.
  2247. *
  2248. * @private
  2249. * @param {Object} prototype The object to inherit from.
  2250. * @returns {Object} Returns the new object.
  2251. */
  2252. function baseCreate(proto) {
  2253. return isObject(proto) ? objectCreate(proto) : {};
  2254. }
  2255. /**
  2256. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  2257. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  2258. * symbols of `object`.
  2259. *
  2260. * @private
  2261. * @param {Object} object The object to query.
  2262. * @param {Function} keysFunc The function to get the keys of `object`.
  2263. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  2264. * @returns {Array} Returns the array of property names and symbols.
  2265. */
  2266. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  2267. var result = keysFunc(object);
  2268. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  2269. }
  2270. /**
  2271. * The base implementation of `getTag`.
  2272. *
  2273. * @private
  2274. * @param {*} value The value to query.
  2275. * @returns {string} Returns the `toStringTag`.
  2276. */
  2277. function baseGetTag(value) {
  2278. return objectToString.call(value);
  2279. }
  2280. /**
  2281. * The base implementation of `_.isNative` without bad shim checks.
  2282. *
  2283. * @private
  2284. * @param {*} value The value to check.
  2285. * @returns {boolean} Returns `true` if `value` is a native function,
  2286. * else `false`.
  2287. */
  2288. function baseIsNative(value) {
  2289. if (!isObject(value) || isMasked(value)) {
  2290. return false;
  2291. }
  2292. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  2293. return pattern.test(toSource(value));
  2294. }
  2295. /**
  2296. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  2297. *
  2298. * @private
  2299. * @param {Object} object The object to query.
  2300. * @returns {Array} Returns the array of property names.
  2301. */
  2302. function baseKeys(object) {
  2303. if (!isPrototype(object)) {
  2304. return nativeKeys(object);
  2305. }
  2306. var result = [];
  2307. for (var key in Object(object)) {
  2308. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  2309. result.push(key);
  2310. }
  2311. }
  2312. return result;
  2313. }
  2314. /**
  2315. * Creates a clone of `buffer`.
  2316. *
  2317. * @private
  2318. * @param {Buffer} buffer The buffer to clone.
  2319. * @param {boolean} [isDeep] Specify a deep clone.
  2320. * @returns {Buffer} Returns the cloned buffer.
  2321. */
  2322. function cloneBuffer(buffer, isDeep) {
  2323. if (isDeep) {
  2324. return buffer.slice();
  2325. }
  2326. var result = new buffer.constructor(buffer.length);
  2327. buffer.copy(result);
  2328. return result;
  2329. }
  2330. /**
  2331. * Creates a clone of `arrayBuffer`.
  2332. *
  2333. * @private
  2334. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  2335. * @returns {ArrayBuffer} Returns the cloned array buffer.
  2336. */
  2337. function cloneArrayBuffer(arrayBuffer) {
  2338. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  2339. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  2340. return result;
  2341. }
  2342. /**
  2343. * Creates a clone of `dataView`.
  2344. *
  2345. * @private
  2346. * @param {Object} dataView The data view to clone.
  2347. * @param {boolean} [isDeep] Specify a deep clone.
  2348. * @returns {Object} Returns the cloned data view.
  2349. */
  2350. function cloneDataView(dataView, isDeep) {
  2351. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  2352. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  2353. }
  2354. /**
  2355. * Creates a clone of `map`.
  2356. *
  2357. * @private
  2358. * @param {Object} map The map to clone.
  2359. * @param {Function} cloneFunc The function to clone values.
  2360. * @param {boolean} [isDeep] Specify a deep clone.
  2361. * @returns {Object} Returns the cloned map.
  2362. */
  2363. function cloneMap(map, isDeep, cloneFunc) {
  2364. var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);
  2365. return arrayReduce(array, addMapEntry, new map.constructor);
  2366. }
  2367. /**
  2368. * Creates a clone of `regexp`.
  2369. *
  2370. * @private
  2371. * @param {Object} regexp The regexp to clone.
  2372. * @returns {Object} Returns the cloned regexp.
  2373. */
  2374. function cloneRegExp(regexp) {
  2375. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  2376. result.lastIndex = regexp.lastIndex;
  2377. return result;
  2378. }
  2379. /**
  2380. * Creates a clone of `set`.
  2381. *
  2382. * @private
  2383. * @param {Object} set The set to clone.
  2384. * @param {Function} cloneFunc The function to clone values.
  2385. * @param {boolean} [isDeep] Specify a deep clone.
  2386. * @returns {Object} Returns the cloned set.
  2387. */
  2388. function cloneSet(set, isDeep, cloneFunc) {
  2389. var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);
  2390. return arrayReduce(array, addSetEntry, new set.constructor);
  2391. }
  2392. /**
  2393. * Creates a clone of the `symbol` object.
  2394. *
  2395. * @private
  2396. * @param {Object} symbol The symbol object to clone.
  2397. * @returns {Object} Returns the cloned symbol object.
  2398. */
  2399. function cloneSymbol(symbol) {
  2400. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  2401. }
  2402. /**
  2403. * Creates a clone of `typedArray`.
  2404. *
  2405. * @private
  2406. * @param {Object} typedArray The typed array to clone.
  2407. * @param {boolean} [isDeep] Specify a deep clone.
  2408. * @returns {Object} Returns the cloned typed array.
  2409. */
  2410. function cloneTypedArray(typedArray, isDeep) {
  2411. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  2412. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  2413. }
  2414. /**
  2415. * Copies the values of `source` to `array`.
  2416. *
  2417. * @private
  2418. * @param {Array} source The array to copy values from.
  2419. * @param {Array} [array=[]] The array to copy values to.
  2420. * @returns {Array} Returns `array`.
  2421. */
  2422. function copyArray(source, array) {
  2423. var index = -1,
  2424. length = source.length;
  2425. array || (array = Array(length));
  2426. while (++index < length) {
  2427. array[index] = source[index];
  2428. }
  2429. return array;
  2430. }
  2431. /**
  2432. * Copies properties of `source` to `object`.
  2433. *
  2434. * @private
  2435. * @param {Object} source The object to copy properties from.
  2436. * @param {Array} props The property identifiers to copy.
  2437. * @param {Object} [object={}] The object to copy properties to.
  2438. * @param {Function} [customizer] The function to customize copied values.
  2439. * @returns {Object} Returns `object`.
  2440. */
  2441. function copyObject(source, props, object, customizer) {
  2442. object || (object = {});
  2443. var index = -1,
  2444. length = props.length;
  2445. while (++index < length) {
  2446. var key = props[index];
  2447. var newValue = customizer
  2448. ? customizer(object[key], source[key], key, object, source)
  2449. : undefined;
  2450. assignValue(object, key, newValue === undefined ? source[key] : newValue);
  2451. }
  2452. return object;
  2453. }
  2454. /**
  2455. * Copies own symbol properties of `source` to `object`.
  2456. *
  2457. * @private
  2458. * @param {Object} source The object to copy symbols from.
  2459. * @param {Object} [object={}] The object to copy symbols to.
  2460. * @returns {Object} Returns `object`.
  2461. */
  2462. function copySymbols(source, object) {
  2463. return copyObject(source, getSymbols(source), object);
  2464. }
  2465. /**
  2466. * Creates an array of own enumerable property names and symbols of `object`.
  2467. *
  2468. * @private
  2469. * @param {Object} object The object to query.
  2470. * @returns {Array} Returns the array of property names and symbols.
  2471. */
  2472. function getAllKeys(object) {
  2473. return baseGetAllKeys(object, keys, getSymbols);
  2474. }
  2475. /**
  2476. * Gets the data for `map`.
  2477. *
  2478. * @private
  2479. * @param {Object} map The map to query.
  2480. * @param {string} key The reference key.
  2481. * @returns {*} Returns the map data.
  2482. */
  2483. function getMapData(map, key) {
  2484. var data = map.__data__;
  2485. return isKeyable(key)
  2486. ? data[typeof key == 'string' ? 'string' : 'hash']
  2487. : data.map;
  2488. }
  2489. /**
  2490. * Gets the native function at `key` of `object`.
  2491. *
  2492. * @private
  2493. * @param {Object} object The object to query.
  2494. * @param {string} key The key of the method to get.
  2495. * @returns {*} Returns the function if it's native, else `undefined`.
  2496. */
  2497. function getNative(object, key) {
  2498. var value = getValue(object, key);
  2499. return baseIsNative(value) ? value : undefined;
  2500. }
  2501. /**
  2502. * Creates an array of the own enumerable symbol properties of `object`.
  2503. *
  2504. * @private
  2505. * @param {Object} object The object to query.
  2506. * @returns {Array} Returns the array of symbols.
  2507. */
  2508. var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;
  2509. /**
  2510. * Gets the `toStringTag` of `value`.
  2511. *
  2512. * @private
  2513. * @param {*} value The value to query.
  2514. * @returns {string} Returns the `toStringTag`.
  2515. */
  2516. var getTag = baseGetTag;
  2517. // Fallback for data views, maps, sets, and weak maps in IE 11,
  2518. // for data views in Edge < 14, and promises in Node.js.
  2519. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  2520. (Map && getTag(new Map) != mapTag) ||
  2521. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  2522. (Set && getTag(new Set) != setTag) ||
  2523. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  2524. getTag = function(value) {
  2525. var result = objectToString.call(value),
  2526. Ctor = result == objectTag ? value.constructor : undefined,
  2527. ctorString = Ctor ? toSource(Ctor) : undefined;
  2528. if (ctorString) {
  2529. switch (ctorString) {
  2530. case dataViewCtorString: return dataViewTag;
  2531. case mapCtorString: return mapTag;
  2532. case promiseCtorString: return promiseTag;
  2533. case setCtorString: return setTag;
  2534. case weakMapCtorString: return weakMapTag;
  2535. }
  2536. }
  2537. return result;
  2538. };
  2539. }
  2540. /**
  2541. * Initializes an array clone.
  2542. *
  2543. * @private
  2544. * @param {Array} array The array to clone.
  2545. * @returns {Array} Returns the initialized clone.
  2546. */
  2547. function initCloneArray(array) {
  2548. var length = array.length,
  2549. result = array.constructor(length);
  2550. // Add properties assigned by `RegExp#exec`.
  2551. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  2552. result.index = array.index;
  2553. result.input = array.input;
  2554. }
  2555. return result;
  2556. }
  2557. /**
  2558. * Initializes an object clone.
  2559. *
  2560. * @private
  2561. * @param {Object} object The object to clone.
  2562. * @returns {Object} Returns the initialized clone.
  2563. */
  2564. function initCloneObject(object) {
  2565. return (typeof object.constructor == 'function' && !isPrototype(object))
  2566. ? baseCreate(getPrototype(object))
  2567. : {};
  2568. }
  2569. /**
  2570. * Initializes an object clone based on its `toStringTag`.
  2571. *
  2572. * **Note:** This function only supports cloning values with tags of
  2573. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  2574. *
  2575. * @private
  2576. * @param {Object} object The object to clone.
  2577. * @param {string} tag The `toStringTag` of the object to clone.
  2578. * @param {Function} cloneFunc The function to clone values.
  2579. * @param {boolean} [isDeep] Specify a deep clone.
  2580. * @returns {Object} Returns the initialized clone.
  2581. */
  2582. function initCloneByTag(object, tag, cloneFunc, isDeep) {
  2583. var Ctor = object.constructor;
  2584. switch (tag) {
  2585. case arrayBufferTag:
  2586. return cloneArrayBuffer(object);
  2587. case boolTag:
  2588. case dateTag:
  2589. return new Ctor(+object);
  2590. case dataViewTag:
  2591. return cloneDataView(object, isDeep);
  2592. case float32Tag: case float64Tag:
  2593. case int8Tag: case int16Tag: case int32Tag:
  2594. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  2595. return cloneTypedArray(object, isDeep);
  2596. case mapTag:
  2597. return cloneMap(object, isDeep, cloneFunc);
  2598. case numberTag:
  2599. case stringTag:
  2600. return new Ctor(object);
  2601. case regexpTag:
  2602. return cloneRegExp(object);
  2603. case setTag:
  2604. return cloneSet(object, isDeep, cloneFunc);
  2605. case symbolTag:
  2606. return cloneSymbol(object);
  2607. }
  2608. }
  2609. /**
  2610. * Checks if `value` is a valid array-like index.
  2611. *
  2612. * @private
  2613. * @param {*} value The value to check.
  2614. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  2615. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  2616. */
  2617. function isIndex(value, length) {
  2618. length = length == null ? MAX_SAFE_INTEGER : length;
  2619. return !!length &&
  2620. (typeof value == 'number' || reIsUint.test(value)) &&
  2621. (value > -1 && value % 1 == 0 && value < length);
  2622. }
  2623. /**
  2624. * Checks if `value` is suitable for use as unique object key.
  2625. *
  2626. * @private
  2627. * @param {*} value The value to check.
  2628. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  2629. */
  2630. function isKeyable(value) {
  2631. var type = typeof value;
  2632. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  2633. ? (value !== '__proto__')
  2634. : (value === null);
  2635. }
  2636. /**
  2637. * Checks if `func` has its source masked.
  2638. *
  2639. * @private
  2640. * @param {Function} func The function to check.
  2641. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  2642. */
  2643. function isMasked(func) {
  2644. return !!maskSrcKey && (maskSrcKey in func);
  2645. }
  2646. /**
  2647. * Checks if `value` is likely a prototype object.
  2648. *
  2649. * @private
  2650. * @param {*} value The value to check.
  2651. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  2652. */
  2653. function isPrototype(value) {
  2654. var Ctor = value && value.constructor,
  2655. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  2656. return value === proto;
  2657. }
  2658. /**
  2659. * Converts `func` to its source code.
  2660. *
  2661. * @private
  2662. * @param {Function} func The function to process.
  2663. * @returns {string} Returns the source code.
  2664. */
  2665. function toSource(func) {
  2666. if (func != null) {
  2667. try {
  2668. return funcToString.call(func);
  2669. } catch (e) {}
  2670. try {
  2671. return (func + '');
  2672. } catch (e) {}
  2673. }
  2674. return '';
  2675. }
  2676. /**
  2677. * This method is like `_.clone` except that it recursively clones `value`.
  2678. *
  2679. * @static
  2680. * @memberOf _
  2681. * @since 1.0.0
  2682. * @category Lang
  2683. * @param {*} value The value to recursively clone.
  2684. * @returns {*} Returns the deep cloned value.
  2685. * @see _.clone
  2686. * @example
  2687. *
  2688. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  2689. *
  2690. * var deep = _.cloneDeep(objects);
  2691. * console.log(deep[0] === objects[0]);
  2692. * // => false
  2693. */
  2694. function cloneDeep(value) {
  2695. return baseClone(value, true, true);
  2696. }
  2697. /**
  2698. * Performs a
  2699. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  2700. * comparison between two values to determine if they are equivalent.
  2701. *
  2702. * @static
  2703. * @memberOf _
  2704. * @since 4.0.0
  2705. * @category Lang
  2706. * @param {*} value The value to compare.
  2707. * @param {*} other The other value to compare.
  2708. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  2709. * @example
  2710. *
  2711. * var object = { 'a': 1 };
  2712. * var other = { 'a': 1 };
  2713. *
  2714. * _.eq(object, object);
  2715. * // => true
  2716. *
  2717. * _.eq(object, other);
  2718. * // => false
  2719. *
  2720. * _.eq('a', 'a');
  2721. * // => true
  2722. *
  2723. * _.eq('a', Object('a'));
  2724. * // => false
  2725. *
  2726. * _.eq(NaN, NaN);
  2727. * // => true
  2728. */
  2729. function eq(value, other) {
  2730. return value === other || (value !== value && other !== other);
  2731. }
  2732. /**
  2733. * Checks if `value` is likely an `arguments` object.
  2734. *
  2735. * @static
  2736. * @memberOf _
  2737. * @since 0.1.0
  2738. * @category Lang
  2739. * @param {*} value The value to check.
  2740. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  2741. * else `false`.
  2742. * @example
  2743. *
  2744. * _.isArguments(function() { return arguments; }());
  2745. * // => true
  2746. *
  2747. * _.isArguments([1, 2, 3]);
  2748. * // => false
  2749. */
  2750. function isArguments(value) {
  2751. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  2752. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  2753. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  2754. }
  2755. /**
  2756. * Checks if `value` is classified as an `Array` object.
  2757. *
  2758. * @static
  2759. * @memberOf _
  2760. * @since 0.1.0
  2761. * @category Lang
  2762. * @param {*} value The value to check.
  2763. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  2764. * @example
  2765. *
  2766. * _.isArray([1, 2, 3]);
  2767. * // => true
  2768. *
  2769. * _.isArray(document.body.children);
  2770. * // => false
  2771. *
  2772. * _.isArray('abc');
  2773. * // => false
  2774. *
  2775. * _.isArray(_.noop);
  2776. * // => false
  2777. */
  2778. var isArray = Array.isArray;
  2779. /**
  2780. * Checks if `value` is array-like. A value is considered array-like if it's
  2781. * not a function and has a `value.length` that's an integer greater than or
  2782. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  2783. *
  2784. * @static
  2785. * @memberOf _
  2786. * @since 4.0.0
  2787. * @category Lang
  2788. * @param {*} value The value to check.
  2789. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  2790. * @example
  2791. *
  2792. * _.isArrayLike([1, 2, 3]);
  2793. * // => true
  2794. *
  2795. * _.isArrayLike(document.body.children);
  2796. * // => true
  2797. *
  2798. * _.isArrayLike('abc');
  2799. * // => true
  2800. *
  2801. * _.isArrayLike(_.noop);
  2802. * // => false
  2803. */
  2804. function isArrayLike(value) {
  2805. return value != null && isLength(value.length) && !isFunction(value);
  2806. }
  2807. /**
  2808. * This method is like `_.isArrayLike` except that it also checks if `value`
  2809. * is an object.
  2810. *
  2811. * @static
  2812. * @memberOf _
  2813. * @since 4.0.0
  2814. * @category Lang
  2815. * @param {*} value The value to check.
  2816. * @returns {boolean} Returns `true` if `value` is an array-like object,
  2817. * else `false`.
  2818. * @example
  2819. *
  2820. * _.isArrayLikeObject([1, 2, 3]);
  2821. * // => true
  2822. *
  2823. * _.isArrayLikeObject(document.body.children);
  2824. * // => true
  2825. *
  2826. * _.isArrayLikeObject('abc');
  2827. * // => false
  2828. *
  2829. * _.isArrayLikeObject(_.noop);
  2830. * // => false
  2831. */
  2832. function isArrayLikeObject(value) {
  2833. return isObjectLike(value) && isArrayLike(value);
  2834. }
  2835. /**
  2836. * Checks if `value` is a buffer.
  2837. *
  2838. * @static
  2839. * @memberOf _
  2840. * @since 4.3.0
  2841. * @category Lang
  2842. * @param {*} value The value to check.
  2843. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  2844. * @example
  2845. *
  2846. * _.isBuffer(new Buffer(2));
  2847. * // => true
  2848. *
  2849. * _.isBuffer(new Uint8Array(2));
  2850. * // => false
  2851. */
  2852. var isBuffer = nativeIsBuffer || stubFalse;
  2853. /**
  2854. * Checks if `value` is classified as a `Function` object.
  2855. *
  2856. * @static
  2857. * @memberOf _
  2858. * @since 0.1.0
  2859. * @category Lang
  2860. * @param {*} value The value to check.
  2861. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  2862. * @example
  2863. *
  2864. * _.isFunction(_);
  2865. * // => true
  2866. *
  2867. * _.isFunction(/abc/);
  2868. * // => false
  2869. */
  2870. function isFunction(value) {
  2871. // The use of `Object#toString` avoids issues with the `typeof` operator
  2872. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  2873. var tag = isObject(value) ? objectToString.call(value) : '';
  2874. return tag == funcTag || tag == genTag;
  2875. }
  2876. /**
  2877. * Checks if `value` is a valid array-like length.
  2878. *
  2879. * **Note:** This method is loosely based on
  2880. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  2881. *
  2882. * @static
  2883. * @memberOf _
  2884. * @since 4.0.0
  2885. * @category Lang
  2886. * @param {*} value The value to check.
  2887. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  2888. * @example
  2889. *
  2890. * _.isLength(3);
  2891. * // => true
  2892. *
  2893. * _.isLength(Number.MIN_VALUE);
  2894. * // => false
  2895. *
  2896. * _.isLength(Infinity);
  2897. * // => false
  2898. *
  2899. * _.isLength('3');
  2900. * // => false
  2901. */
  2902. function isLength(value) {
  2903. return typeof value == 'number' &&
  2904. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  2905. }
  2906. /**
  2907. * Checks if `value` is the
  2908. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  2909. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  2910. *
  2911. * @static
  2912. * @memberOf _
  2913. * @since 0.1.0
  2914. * @category Lang
  2915. * @param {*} value The value to check.
  2916. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  2917. * @example
  2918. *
  2919. * _.isObject({});
  2920. * // => true
  2921. *
  2922. * _.isObject([1, 2, 3]);
  2923. * // => true
  2924. *
  2925. * _.isObject(_.noop);
  2926. * // => true
  2927. *
  2928. * _.isObject(null);
  2929. * // => false
  2930. */
  2931. function isObject(value) {
  2932. var type = typeof value;
  2933. return !!value && (type == 'object' || type == 'function');
  2934. }
  2935. /**
  2936. * Checks if `value` is object-like. A value is object-like if it's not `null`
  2937. * and has a `typeof` result of "object".
  2938. *
  2939. * @static
  2940. * @memberOf _
  2941. * @since 4.0.0
  2942. * @category Lang
  2943. * @param {*} value The value to check.
  2944. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  2945. * @example
  2946. *
  2947. * _.isObjectLike({});
  2948. * // => true
  2949. *
  2950. * _.isObjectLike([1, 2, 3]);
  2951. * // => true
  2952. *
  2953. * _.isObjectLike(_.noop);
  2954. * // => false
  2955. *
  2956. * _.isObjectLike(null);
  2957. * // => false
  2958. */
  2959. function isObjectLike(value) {
  2960. return !!value && typeof value == 'object';
  2961. }
  2962. /**
  2963. * Creates an array of the own enumerable property names of `object`.
  2964. *
  2965. * **Note:** Non-object values are coerced to objects. See the
  2966. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  2967. * for more details.
  2968. *
  2969. * @static
  2970. * @since 0.1.0
  2971. * @memberOf _
  2972. * @category Object
  2973. * @param {Object} object The object to query.
  2974. * @returns {Array} Returns the array of property names.
  2975. * @example
  2976. *
  2977. * function Foo() {
  2978. * this.a = 1;
  2979. * this.b = 2;
  2980. * }
  2981. *
  2982. * Foo.prototype.c = 3;
  2983. *
  2984. * _.keys(new Foo);
  2985. * // => ['a', 'b'] (iteration order is not guaranteed)
  2986. *
  2987. * _.keys('hi');
  2988. * // => ['0', '1']
  2989. */
  2990. function keys(object) {
  2991. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  2992. }
  2993. /**
  2994. * This method returns a new empty array.
  2995. *
  2996. * @static
  2997. * @memberOf _
  2998. * @since 4.13.0
  2999. * @category Util
  3000. * @returns {Array} Returns the new empty array.
  3001. * @example
  3002. *
  3003. * var arrays = _.times(2, _.stubArray);
  3004. *
  3005. * console.log(arrays);
  3006. * // => [[], []]
  3007. *
  3008. * console.log(arrays[0] === arrays[1]);
  3009. * // => false
  3010. */
  3011. function stubArray() {
  3012. return [];
  3013. }
  3014. /**
  3015. * This method returns `false`.
  3016. *
  3017. * @static
  3018. * @memberOf _
  3019. * @since 4.13.0
  3020. * @category Util
  3021. * @returns {boolean} Returns `false`.
  3022. * @example
  3023. *
  3024. * _.times(2, _.stubFalse);
  3025. * // => [false, false]
  3026. */
  3027. function stubFalse() {
  3028. return false;
  3029. }
  3030. module.exports = cloneDeep;
  3031. /***/ }),
  3032. /***/ 52:
  3033. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  3034. /**
  3035. * lodash (Custom Build) <https://lodash.com/>
  3036. * Build: `lodash modularize exports="npm" -o ./`
  3037. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  3038. * Released under MIT license <https://lodash.com/license>
  3039. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  3040. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  3041. */
  3042. /** Used as references for various `Number` constants. */
  3043. var MAX_SAFE_INTEGER = 9007199254740991;
  3044. /** `Object#toString` result references. */
  3045. var argsTag = '[object Arguments]',
  3046. funcTag = '[object Function]',
  3047. genTag = '[object GeneratorFunction]',
  3048. mapTag = '[object Map]',
  3049. objectTag = '[object Object]',
  3050. promiseTag = '[object Promise]',
  3051. setTag = '[object Set]',
  3052. weakMapTag = '[object WeakMap]';
  3053. var dataViewTag = '[object DataView]';
  3054. /**
  3055. * Used to match `RegExp`
  3056. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  3057. */
  3058. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  3059. /** Used to detect host constructors (Safari). */
  3060. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  3061. /** Used to detect unsigned integer values. */
  3062. var reIsUint = /^(?:0|[1-9]\d*)$/;
  3063. /** Detect free variable `global` from Node.js. */
  3064. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  3065. /** Detect free variable `self`. */
  3066. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  3067. /** Used as a reference to the global object. */
  3068. var root = freeGlobal || freeSelf || Function('return this')();
  3069. /**
  3070. * A specialized version of `_.map` for arrays without support for iteratee
  3071. * shorthands.
  3072. *
  3073. * @private
  3074. * @param {Array} [array] The array to iterate over.
  3075. * @param {Function} iteratee The function invoked per iteration.
  3076. * @returns {Array} Returns the new mapped array.
  3077. */
  3078. function arrayMap(array, iteratee) {
  3079. var index = -1,
  3080. length = array ? array.length : 0,
  3081. result = Array(length);
  3082. while (++index < length) {
  3083. result[index] = iteratee(array[index], index, array);
  3084. }
  3085. return result;
  3086. }
  3087. /**
  3088. * The base implementation of `_.times` without support for iteratee shorthands
  3089. * or max array length checks.
  3090. *
  3091. * @private
  3092. * @param {number} n The number of times to invoke `iteratee`.
  3093. * @param {Function} iteratee The function invoked per iteration.
  3094. * @returns {Array} Returns the array of results.
  3095. */
  3096. function baseTimes(n, iteratee) {
  3097. var index = -1,
  3098. result = Array(n);
  3099. while (++index < n) {
  3100. result[index] = iteratee(index);
  3101. }
  3102. return result;
  3103. }
  3104. /**
  3105. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  3106. * of key-value pairs for `object` corresponding to the property names of `props`.
  3107. *
  3108. * @private
  3109. * @param {Object} object The object to query.
  3110. * @param {Array} props The property names to get values for.
  3111. * @returns {Object} Returns the key-value pairs.
  3112. */
  3113. function baseToPairs(object, props) {
  3114. return arrayMap(props, function(key) {
  3115. return [key, object[key]];
  3116. });
  3117. }
  3118. /**
  3119. * Gets the value at `key` of `object`.
  3120. *
  3121. * @private
  3122. * @param {Object} [object] The object to query.
  3123. * @param {string} key The key of the property to get.
  3124. * @returns {*} Returns the property value.
  3125. */
  3126. function getValue(object, key) {
  3127. return object == null ? undefined : object[key];
  3128. }
  3129. /**
  3130. * Checks if `value` is a host object in IE < 9.
  3131. *
  3132. * @private
  3133. * @param {*} value The value to check.
  3134. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  3135. */
  3136. function isHostObject(value) {
  3137. // Many host objects are `Object` objects that can coerce to strings
  3138. // despite having improperly defined `toString` methods.
  3139. var result = false;
  3140. if (value != null && typeof value.toString != 'function') {
  3141. try {
  3142. result = !!(value + '');
  3143. } catch (e) {}
  3144. }
  3145. return result;
  3146. }
  3147. /**
  3148. * Converts `map` to its key-value pairs.
  3149. *
  3150. * @private
  3151. * @param {Object} map The map to convert.
  3152. * @returns {Array} Returns the key-value pairs.
  3153. */
  3154. function mapToArray(map) {
  3155. var index = -1,
  3156. result = Array(map.size);
  3157. map.forEach(function(value, key) {
  3158. result[++index] = [key, value];
  3159. });
  3160. return result;
  3161. }
  3162. /**
  3163. * Creates a unary function that invokes `func` with its argument transformed.
  3164. *
  3165. * @private
  3166. * @param {Function} func The function to wrap.
  3167. * @param {Function} transform The argument transform.
  3168. * @returns {Function} Returns the new function.
  3169. */
  3170. function overArg(func, transform) {
  3171. return function(arg) {
  3172. return func(transform(arg));
  3173. };
  3174. }
  3175. /**
  3176. * Converts `set` to its value-value pairs.
  3177. *
  3178. * @private
  3179. * @param {Object} set The set to convert.
  3180. * @returns {Array} Returns the value-value pairs.
  3181. */
  3182. function setToPairs(set) {
  3183. var index = -1,
  3184. result = Array(set.size);
  3185. set.forEach(function(value) {
  3186. result[++index] = [value, value];
  3187. });
  3188. return result;
  3189. }
  3190. /** Used for built-in method references. */
  3191. var funcProto = Function.prototype,
  3192. objectProto = Object.prototype;
  3193. /** Used to detect overreaching core-js shims. */
  3194. var coreJsData = root['__core-js_shared__'];
  3195. /** Used to detect methods masquerading as native. */
  3196. var maskSrcKey = (function() {
  3197. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  3198. return uid ? ('Symbol(src)_1.' + uid) : '';
  3199. }());
  3200. /** Used to resolve the decompiled source of functions. */
  3201. var funcToString = funcProto.toString;
  3202. /** Used to check objects for own properties. */
  3203. var hasOwnProperty = objectProto.hasOwnProperty;
  3204. /**
  3205. * Used to resolve the
  3206. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  3207. * of values.
  3208. */
  3209. var objectToString = objectProto.toString;
  3210. /** Used to detect if a method is native. */
  3211. var reIsNative = RegExp('^' +
  3212. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  3213. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  3214. );
  3215. /** Built-in value references. */
  3216. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  3217. /* Built-in method references for those with the same name as other `lodash` methods. */
  3218. var nativeKeys = overArg(Object.keys, Object);
  3219. /* Built-in method references that are verified to be native. */
  3220. var DataView = getNative(root, 'DataView'),
  3221. Map = getNative(root, 'Map'),
  3222. Promise = getNative(root, 'Promise'),
  3223. Set = getNative(root, 'Set'),
  3224. WeakMap = getNative(root, 'WeakMap');
  3225. /** Used to detect maps, sets, and weakmaps. */
  3226. var dataViewCtorString = toSource(DataView),
  3227. mapCtorString = toSource(Map),
  3228. promiseCtorString = toSource(Promise),
  3229. setCtorString = toSource(Set),
  3230. weakMapCtorString = toSource(WeakMap);
  3231. /**
  3232. * Creates an array of the enumerable property names of the array-like `value`.
  3233. *
  3234. * @private
  3235. * @param {*} value The value to query.
  3236. * @param {boolean} inherited Specify returning inherited property names.
  3237. * @returns {Array} Returns the array of property names.
  3238. */
  3239. function arrayLikeKeys(value, inherited) {
  3240. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  3241. // Safari 9 makes `arguments.length` enumerable in strict mode.
  3242. var result = (isArray(value) || isArguments(value))
  3243. ? baseTimes(value.length, String)
  3244. : [];
  3245. var length = result.length,
  3246. skipIndexes = !!length;
  3247. for (var key in value) {
  3248. if ((inherited || hasOwnProperty.call(value, key)) &&
  3249. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  3250. result.push(key);
  3251. }
  3252. }
  3253. return result;
  3254. }
  3255. /**
  3256. * The base implementation of `getTag`.
  3257. *
  3258. * @private
  3259. * @param {*} value The value to query.
  3260. * @returns {string} Returns the `toStringTag`.
  3261. */
  3262. function baseGetTag(value) {
  3263. return objectToString.call(value);
  3264. }
  3265. /**
  3266. * The base implementation of `_.isNative` without bad shim checks.
  3267. *
  3268. * @private
  3269. * @param {*} value The value to check.
  3270. * @returns {boolean} Returns `true` if `value` is a native function,
  3271. * else `false`.
  3272. */
  3273. function baseIsNative(value) {
  3274. if (!isObject(value) || isMasked(value)) {
  3275. return false;
  3276. }
  3277. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  3278. return pattern.test(toSource(value));
  3279. }
  3280. /**
  3281. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  3282. *
  3283. * @private
  3284. * @param {Object} object The object to query.
  3285. * @returns {Array} Returns the array of property names.
  3286. */
  3287. function baseKeys(object) {
  3288. if (!isPrototype(object)) {
  3289. return nativeKeys(object);
  3290. }
  3291. var result = [];
  3292. for (var key in Object(object)) {
  3293. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  3294. result.push(key);
  3295. }
  3296. }
  3297. return result;
  3298. }
  3299. /**
  3300. * Creates a `_.toPairs` or `_.toPairsIn` function.
  3301. *
  3302. * @private
  3303. * @param {Function} keysFunc The function to get the keys of a given object.
  3304. * @returns {Function} Returns the new pairs function.
  3305. */
  3306. function createToPairs(keysFunc) {
  3307. return function(object) {
  3308. var tag = getTag(object);
  3309. if (tag == mapTag) {
  3310. return mapToArray(object);
  3311. }
  3312. if (tag == setTag) {
  3313. return setToPairs(object);
  3314. }
  3315. return baseToPairs(object, keysFunc(object));
  3316. };
  3317. }
  3318. /**
  3319. * Gets the native function at `key` of `object`.
  3320. *
  3321. * @private
  3322. * @param {Object} object The object to query.
  3323. * @param {string} key The key of the method to get.
  3324. * @returns {*} Returns the function if it's native, else `undefined`.
  3325. */
  3326. function getNative(object, key) {
  3327. var value = getValue(object, key);
  3328. return baseIsNative(value) ? value : undefined;
  3329. }
  3330. /**
  3331. * Gets the `toStringTag` of `value`.
  3332. *
  3333. * @private
  3334. * @param {*} value The value to query.
  3335. * @returns {string} Returns the `toStringTag`.
  3336. */
  3337. var getTag = baseGetTag;
  3338. // Fallback for data views, maps, sets, and weak maps in IE 11,
  3339. // for data views in Edge < 14, and promises in Node.js.
  3340. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  3341. (Map && getTag(new Map) != mapTag) ||
  3342. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  3343. (Set && getTag(new Set) != setTag) ||
  3344. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  3345. getTag = function(value) {
  3346. var result = objectToString.call(value),
  3347. Ctor = result == objectTag ? value.constructor : undefined,
  3348. ctorString = Ctor ? toSource(Ctor) : undefined;
  3349. if (ctorString) {
  3350. switch (ctorString) {
  3351. case dataViewCtorString: return dataViewTag;
  3352. case mapCtorString: return mapTag;
  3353. case promiseCtorString: return promiseTag;
  3354. case setCtorString: return setTag;
  3355. case weakMapCtorString: return weakMapTag;
  3356. }
  3357. }
  3358. return result;
  3359. };
  3360. }
  3361. /**
  3362. * Checks if `value` is a valid array-like index.
  3363. *
  3364. * @private
  3365. * @param {*} value The value to check.
  3366. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  3367. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  3368. */
  3369. function isIndex(value, length) {
  3370. length = length == null ? MAX_SAFE_INTEGER : length;
  3371. return !!length &&
  3372. (typeof value == 'number' || reIsUint.test(value)) &&
  3373. (value > -1 && value % 1 == 0 && value < length);
  3374. }
  3375. /**
  3376. * Checks if `func` has its source masked.
  3377. *
  3378. * @private
  3379. * @param {Function} func The function to check.
  3380. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  3381. */
  3382. function isMasked(func) {
  3383. return !!maskSrcKey && (maskSrcKey in func);
  3384. }
  3385. /**
  3386. * Checks if `value` is likely a prototype object.
  3387. *
  3388. * @private
  3389. * @param {*} value The value to check.
  3390. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  3391. */
  3392. function isPrototype(value) {
  3393. var Ctor = value && value.constructor,
  3394. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  3395. return value === proto;
  3396. }
  3397. /**
  3398. * Converts `func` to its source code.
  3399. *
  3400. * @private
  3401. * @param {Function} func The function to process.
  3402. * @returns {string} Returns the source code.
  3403. */
  3404. function toSource(func) {
  3405. if (func != null) {
  3406. try {
  3407. return funcToString.call(func);
  3408. } catch (e) {}
  3409. try {
  3410. return (func + '');
  3411. } catch (e) {}
  3412. }
  3413. return '';
  3414. }
  3415. /**
  3416. * Checks if `value` is likely an `arguments` object.
  3417. *
  3418. * @static
  3419. * @memberOf _
  3420. * @since 0.1.0
  3421. * @category Lang
  3422. * @param {*} value The value to check.
  3423. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  3424. * else `false`.
  3425. * @example
  3426. *
  3427. * _.isArguments(function() { return arguments; }());
  3428. * // => true
  3429. *
  3430. * _.isArguments([1, 2, 3]);
  3431. * // => false
  3432. */
  3433. function isArguments(value) {
  3434. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  3435. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  3436. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  3437. }
  3438. /**
  3439. * Checks if `value` is classified as an `Array` object.
  3440. *
  3441. * @static
  3442. * @memberOf _
  3443. * @since 0.1.0
  3444. * @category Lang
  3445. * @param {*} value The value to check.
  3446. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  3447. * @example
  3448. *
  3449. * _.isArray([1, 2, 3]);
  3450. * // => true
  3451. *
  3452. * _.isArray(document.body.children);
  3453. * // => false
  3454. *
  3455. * _.isArray('abc');
  3456. * // => false
  3457. *
  3458. * _.isArray(_.noop);
  3459. * // => false
  3460. */
  3461. var isArray = Array.isArray;
  3462. /**
  3463. * Checks if `value` is array-like. A value is considered array-like if it's
  3464. * not a function and has a `value.length` that's an integer greater than or
  3465. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  3466. *
  3467. * @static
  3468. * @memberOf _
  3469. * @since 4.0.0
  3470. * @category Lang
  3471. * @param {*} value The value to check.
  3472. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  3473. * @example
  3474. *
  3475. * _.isArrayLike([1, 2, 3]);
  3476. * // => true
  3477. *
  3478. * _.isArrayLike(document.body.children);
  3479. * // => true
  3480. *
  3481. * _.isArrayLike('abc');
  3482. * // => true
  3483. *
  3484. * _.isArrayLike(_.noop);
  3485. * // => false
  3486. */
  3487. function isArrayLike(value) {
  3488. return value != null && isLength(value.length) && !isFunction(value);
  3489. }
  3490. /**
  3491. * This method is like `_.isArrayLike` except that it also checks if `value`
  3492. * is an object.
  3493. *
  3494. * @static
  3495. * @memberOf _
  3496. * @since 4.0.0
  3497. * @category Lang
  3498. * @param {*} value The value to check.
  3499. * @returns {boolean} Returns `true` if `value` is an array-like object,
  3500. * else `false`.
  3501. * @example
  3502. *
  3503. * _.isArrayLikeObject([1, 2, 3]);
  3504. * // => true
  3505. *
  3506. * _.isArrayLikeObject(document.body.children);
  3507. * // => true
  3508. *
  3509. * _.isArrayLikeObject('abc');
  3510. * // => false
  3511. *
  3512. * _.isArrayLikeObject(_.noop);
  3513. * // => false
  3514. */
  3515. function isArrayLikeObject(value) {
  3516. return isObjectLike(value) && isArrayLike(value);
  3517. }
  3518. /**
  3519. * Checks if `value` is classified as a `Function` object.
  3520. *
  3521. * @static
  3522. * @memberOf _
  3523. * @since 0.1.0
  3524. * @category Lang
  3525. * @param {*} value The value to check.
  3526. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  3527. * @example
  3528. *
  3529. * _.isFunction(_);
  3530. * // => true
  3531. *
  3532. * _.isFunction(/abc/);
  3533. * // => false
  3534. */
  3535. function isFunction(value) {
  3536. // The use of `Object#toString` avoids issues with the `typeof` operator
  3537. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  3538. var tag = isObject(value) ? objectToString.call(value) : '';
  3539. return tag == funcTag || tag == genTag;
  3540. }
  3541. /**
  3542. * Checks if `value` is a valid array-like length.
  3543. *
  3544. * **Note:** This method is loosely based on
  3545. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  3546. *
  3547. * @static
  3548. * @memberOf _
  3549. * @since 4.0.0
  3550. * @category Lang
  3551. * @param {*} value The value to check.
  3552. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  3553. * @example
  3554. *
  3555. * _.isLength(3);
  3556. * // => true
  3557. *
  3558. * _.isLength(Number.MIN_VALUE);
  3559. * // => false
  3560. *
  3561. * _.isLength(Infinity);
  3562. * // => false
  3563. *
  3564. * _.isLength('3');
  3565. * // => false
  3566. */
  3567. function isLength(value) {
  3568. return typeof value == 'number' &&
  3569. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  3570. }
  3571. /**
  3572. * Checks if `value` is the
  3573. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  3574. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  3575. *
  3576. * @static
  3577. * @memberOf _
  3578. * @since 0.1.0
  3579. * @category Lang
  3580. * @param {*} value The value to check.
  3581. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  3582. * @example
  3583. *
  3584. * _.isObject({});
  3585. * // => true
  3586. *
  3587. * _.isObject([1, 2, 3]);
  3588. * // => true
  3589. *
  3590. * _.isObject(_.noop);
  3591. * // => true
  3592. *
  3593. * _.isObject(null);
  3594. * // => false
  3595. */
  3596. function isObject(value) {
  3597. var type = typeof value;
  3598. return !!value && (type == 'object' || type == 'function');
  3599. }
  3600. /**
  3601. * Checks if `value` is object-like. A value is object-like if it's not `null`
  3602. * and has a `typeof` result of "object".
  3603. *
  3604. * @static
  3605. * @memberOf _
  3606. * @since 4.0.0
  3607. * @category Lang
  3608. * @param {*} value The value to check.
  3609. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  3610. * @example
  3611. *
  3612. * _.isObjectLike({});
  3613. * // => true
  3614. *
  3615. * _.isObjectLike([1, 2, 3]);
  3616. * // => true
  3617. *
  3618. * _.isObjectLike(_.noop);
  3619. * // => false
  3620. *
  3621. * _.isObjectLike(null);
  3622. * // => false
  3623. */
  3624. function isObjectLike(value) {
  3625. return !!value && typeof value == 'object';
  3626. }
  3627. /**
  3628. * Creates an array of the own enumerable property names of `object`.
  3629. *
  3630. * **Note:** Non-object values are coerced to objects. See the
  3631. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  3632. * for more details.
  3633. *
  3634. * @static
  3635. * @since 0.1.0
  3636. * @memberOf _
  3637. * @category Object
  3638. * @param {Object} object The object to query.
  3639. * @returns {Array} Returns the array of property names.
  3640. * @example
  3641. *
  3642. * function Foo() {
  3643. * this.a = 1;
  3644. * this.b = 2;
  3645. * }
  3646. *
  3647. * Foo.prototype.c = 3;
  3648. *
  3649. * _.keys(new Foo);
  3650. * // => ['a', 'b'] (iteration order is not guaranteed)
  3651. *
  3652. * _.keys('hi');
  3653. * // => ['0', '1']
  3654. */
  3655. function keys(object) {
  3656. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  3657. }
  3658. /**
  3659. * Creates an array of own enumerable string keyed-value pairs for `object`
  3660. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  3661. * entries are returned.
  3662. *
  3663. * @static
  3664. * @memberOf _
  3665. * @since 4.0.0
  3666. * @alias entries
  3667. * @category Object
  3668. * @param {Object} object The object to query.
  3669. * @returns {Array} Returns the key-value pairs.
  3670. * @example
  3671. *
  3672. * function Foo() {
  3673. * this.a = 1;
  3674. * this.b = 2;
  3675. * }
  3676. *
  3677. * Foo.prototype.c = 3;
  3678. *
  3679. * _.toPairs(new Foo);
  3680. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  3681. */
  3682. var toPairs = createToPairs(keys);
  3683. module.exports = toPairs;
  3684. /***/ }),
  3685. /***/ 618:
  3686. /***/ ((module, exports, __webpack_require__) => {
  3687. /* module decorator */ module = __webpack_require__.nmd(module);
  3688. /**
  3689. * lodash (Custom Build) <https://lodash.com/>
  3690. * Build: `lodash modularize exports="npm" -o ./`
  3691. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  3692. * Released under MIT license <https://lodash.com/license>
  3693. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  3694. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  3695. */
  3696. /** Used as the size to enable large array optimizations. */
  3697. var LARGE_ARRAY_SIZE = 200;
  3698. /** Used as the `TypeError` message for "Functions" methods. */
  3699. var FUNC_ERROR_TEXT = 'Expected a function';
  3700. /** Used to stand-in for `undefined` hash values. */
  3701. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  3702. /** Used to compose bitmasks for comparison styles. */
  3703. var UNORDERED_COMPARE_FLAG = 1,
  3704. PARTIAL_COMPARE_FLAG = 2;
  3705. /** Used as references for various `Number` constants. */
  3706. var INFINITY = 1 / 0,
  3707. MAX_SAFE_INTEGER = 9007199254740991;
  3708. /** `Object#toString` result references. */
  3709. var argsTag = '[object Arguments]',
  3710. arrayTag = '[object Array]',
  3711. boolTag = '[object Boolean]',
  3712. dateTag = '[object Date]',
  3713. errorTag = '[object Error]',
  3714. funcTag = '[object Function]',
  3715. genTag = '[object GeneratorFunction]',
  3716. mapTag = '[object Map]',
  3717. numberTag = '[object Number]',
  3718. objectTag = '[object Object]',
  3719. promiseTag = '[object Promise]',
  3720. regexpTag = '[object RegExp]',
  3721. setTag = '[object Set]',
  3722. stringTag = '[object String]',
  3723. symbolTag = '[object Symbol]',
  3724. weakMapTag = '[object WeakMap]';
  3725. var arrayBufferTag = '[object ArrayBuffer]',
  3726. dataViewTag = '[object DataView]',
  3727. float32Tag = '[object Float32Array]',
  3728. float64Tag = '[object Float64Array]',
  3729. int8Tag = '[object Int8Array]',
  3730. int16Tag = '[object Int16Array]',
  3731. int32Tag = '[object Int32Array]',
  3732. uint8Tag = '[object Uint8Array]',
  3733. uint8ClampedTag = '[object Uint8ClampedArray]',
  3734. uint16Tag = '[object Uint16Array]',
  3735. uint32Tag = '[object Uint32Array]';
  3736. /** Used to match property names within property paths. */
  3737. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  3738. reIsPlainProp = /^\w*$/,
  3739. reLeadingDot = /^\./,
  3740. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  3741. /**
  3742. * Used to match `RegExp`
  3743. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  3744. */
  3745. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  3746. /** Used to match backslashes in property paths. */
  3747. var reEscapeChar = /\\(\\)?/g;
  3748. /** Used to detect host constructors (Safari). */
  3749. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  3750. /** Used to detect unsigned integer values. */
  3751. var reIsUint = /^(?:0|[1-9]\d*)$/;
  3752. /** Used to identify `toStringTag` values of typed arrays. */
  3753. var typedArrayTags = {};
  3754. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  3755. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  3756. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  3757. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  3758. typedArrayTags[uint32Tag] = true;
  3759. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  3760. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  3761. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  3762. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  3763. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  3764. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  3765. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  3766. typedArrayTags[weakMapTag] = false;
  3767. /** Detect free variable `global` from Node.js. */
  3768. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  3769. /** Detect free variable `self`. */
  3770. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  3771. /** Used as a reference to the global object. */
  3772. var root = freeGlobal || freeSelf || Function('return this')();
  3773. /** Detect free variable `exports`. */
  3774. var freeExports = true && exports && !exports.nodeType && exports;
  3775. /** Detect free variable `module`. */
  3776. var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
  3777. /** Detect the popular CommonJS extension `module.exports`. */
  3778. var moduleExports = freeModule && freeModule.exports === freeExports;
  3779. /** Detect free variable `process` from Node.js. */
  3780. var freeProcess = moduleExports && freeGlobal.process;
  3781. /** Used to access faster Node.js helpers. */
  3782. var nodeUtil = (function() {
  3783. try {
  3784. return freeProcess && freeProcess.binding('util');
  3785. } catch (e) {}
  3786. }());
  3787. /* Node.js helper references. */
  3788. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  3789. /**
  3790. * A specialized version of `_.includes` for arrays without support for
  3791. * specifying an index to search from.
  3792. *
  3793. * @private
  3794. * @param {Array} [array] The array to inspect.
  3795. * @param {*} target The value to search for.
  3796. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  3797. */
  3798. function arrayIncludes(array, value) {
  3799. var length = array ? array.length : 0;
  3800. return !!length && baseIndexOf(array, value, 0) > -1;
  3801. }
  3802. /**
  3803. * This function is like `arrayIncludes` except that it accepts a comparator.
  3804. *
  3805. * @private
  3806. * @param {Array} [array] The array to inspect.
  3807. * @param {*} target The value to search for.
  3808. * @param {Function} comparator The comparator invoked per element.
  3809. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  3810. */
  3811. function arrayIncludesWith(array, value, comparator) {
  3812. var index = -1,
  3813. length = array ? array.length : 0;
  3814. while (++index < length) {
  3815. if (comparator(value, array[index])) {
  3816. return true;
  3817. }
  3818. }
  3819. return false;
  3820. }
  3821. /**
  3822. * A specialized version of `_.some` for arrays without support for iteratee
  3823. * shorthands.
  3824. *
  3825. * @private
  3826. * @param {Array} [array] The array to iterate over.
  3827. * @param {Function} predicate The function invoked per iteration.
  3828. * @returns {boolean} Returns `true` if any element passes the predicate check,
  3829. * else `false`.
  3830. */
  3831. function arraySome(array, predicate) {
  3832. var index = -1,
  3833. length = array ? array.length : 0;
  3834. while (++index < length) {
  3835. if (predicate(array[index], index, array)) {
  3836. return true;
  3837. }
  3838. }
  3839. return false;
  3840. }
  3841. /**
  3842. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  3843. * support for iteratee shorthands.
  3844. *
  3845. * @private
  3846. * @param {Array} array The array to inspect.
  3847. * @param {Function} predicate The function invoked per iteration.
  3848. * @param {number} fromIndex The index to search from.
  3849. * @param {boolean} [fromRight] Specify iterating from right to left.
  3850. * @returns {number} Returns the index of the matched value, else `-1`.
  3851. */
  3852. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  3853. var length = array.length,
  3854. index = fromIndex + (fromRight ? 1 : -1);
  3855. while ((fromRight ? index-- : ++index < length)) {
  3856. if (predicate(array[index], index, array)) {
  3857. return index;
  3858. }
  3859. }
  3860. return -1;
  3861. }
  3862. /**
  3863. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  3864. *
  3865. * @private
  3866. * @param {Array} array The array to inspect.
  3867. * @param {*} value The value to search for.
  3868. * @param {number} fromIndex The index to search from.
  3869. * @returns {number} Returns the index of the matched value, else `-1`.
  3870. */
  3871. function baseIndexOf(array, value, fromIndex) {
  3872. if (value !== value) {
  3873. return baseFindIndex(array, baseIsNaN, fromIndex);
  3874. }
  3875. var index = fromIndex - 1,
  3876. length = array.length;
  3877. while (++index < length) {
  3878. if (array[index] === value) {
  3879. return index;
  3880. }
  3881. }
  3882. return -1;
  3883. }
  3884. /**
  3885. * The base implementation of `_.isNaN` without support for number objects.
  3886. *
  3887. * @private
  3888. * @param {*} value The value to check.
  3889. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  3890. */
  3891. function baseIsNaN(value) {
  3892. return value !== value;
  3893. }
  3894. /**
  3895. * The base implementation of `_.property` without support for deep paths.
  3896. *
  3897. * @private
  3898. * @param {string} key The key of the property to get.
  3899. * @returns {Function} Returns the new accessor function.
  3900. */
  3901. function baseProperty(key) {
  3902. return function(object) {
  3903. return object == null ? undefined : object[key];
  3904. };
  3905. }
  3906. /**
  3907. * The base implementation of `_.times` without support for iteratee shorthands
  3908. * or max array length checks.
  3909. *
  3910. * @private
  3911. * @param {number} n The number of times to invoke `iteratee`.
  3912. * @param {Function} iteratee The function invoked per iteration.
  3913. * @returns {Array} Returns the array of results.
  3914. */
  3915. function baseTimes(n, iteratee) {
  3916. var index = -1,
  3917. result = Array(n);
  3918. while (++index < n) {
  3919. result[index] = iteratee(index);
  3920. }
  3921. return result;
  3922. }
  3923. /**
  3924. * The base implementation of `_.unary` without support for storing metadata.
  3925. *
  3926. * @private
  3927. * @param {Function} func The function to cap arguments for.
  3928. * @returns {Function} Returns the new capped function.
  3929. */
  3930. function baseUnary(func) {
  3931. return function(value) {
  3932. return func(value);
  3933. };
  3934. }
  3935. /**
  3936. * Checks if a cache value for `key` exists.
  3937. *
  3938. * @private
  3939. * @param {Object} cache The cache to query.
  3940. * @param {string} key The key of the entry to check.
  3941. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3942. */
  3943. function cacheHas(cache, key) {
  3944. return cache.has(key);
  3945. }
  3946. /**
  3947. * Gets the value at `key` of `object`.
  3948. *
  3949. * @private
  3950. * @param {Object} [object] The object to query.
  3951. * @param {string} key The key of the property to get.
  3952. * @returns {*} Returns the property value.
  3953. */
  3954. function getValue(object, key) {
  3955. return object == null ? undefined : object[key];
  3956. }
  3957. /**
  3958. * Checks if `value` is a host object in IE < 9.
  3959. *
  3960. * @private
  3961. * @param {*} value The value to check.
  3962. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  3963. */
  3964. function isHostObject(value) {
  3965. // Many host objects are `Object` objects that can coerce to strings
  3966. // despite having improperly defined `toString` methods.
  3967. var result = false;
  3968. if (value != null && typeof value.toString != 'function') {
  3969. try {
  3970. result = !!(value + '');
  3971. } catch (e) {}
  3972. }
  3973. return result;
  3974. }
  3975. /**
  3976. * Converts `map` to its key-value pairs.
  3977. *
  3978. * @private
  3979. * @param {Object} map The map to convert.
  3980. * @returns {Array} Returns the key-value pairs.
  3981. */
  3982. function mapToArray(map) {
  3983. var index = -1,
  3984. result = Array(map.size);
  3985. map.forEach(function(value, key) {
  3986. result[++index] = [key, value];
  3987. });
  3988. return result;
  3989. }
  3990. /**
  3991. * Creates a unary function that invokes `func` with its argument transformed.
  3992. *
  3993. * @private
  3994. * @param {Function} func The function to wrap.
  3995. * @param {Function} transform The argument transform.
  3996. * @returns {Function} Returns the new function.
  3997. */
  3998. function overArg(func, transform) {
  3999. return function(arg) {
  4000. return func(transform(arg));
  4001. };
  4002. }
  4003. /**
  4004. * Converts `set` to an array of its values.
  4005. *
  4006. * @private
  4007. * @param {Object} set The set to convert.
  4008. * @returns {Array} Returns the values.
  4009. */
  4010. function setToArray(set) {
  4011. var index = -1,
  4012. result = Array(set.size);
  4013. set.forEach(function(value) {
  4014. result[++index] = value;
  4015. });
  4016. return result;
  4017. }
  4018. /** Used for built-in method references. */
  4019. var arrayProto = Array.prototype,
  4020. funcProto = Function.prototype,
  4021. objectProto = Object.prototype;
  4022. /** Used to detect overreaching core-js shims. */
  4023. var coreJsData = root['__core-js_shared__'];
  4024. /** Used to detect methods masquerading as native. */
  4025. var maskSrcKey = (function() {
  4026. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  4027. return uid ? ('Symbol(src)_1.' + uid) : '';
  4028. }());
  4029. /** Used to resolve the decompiled source of functions. */
  4030. var funcToString = funcProto.toString;
  4031. /** Used to check objects for own properties. */
  4032. var hasOwnProperty = objectProto.hasOwnProperty;
  4033. /**
  4034. * Used to resolve the
  4035. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  4036. * of values.
  4037. */
  4038. var objectToString = objectProto.toString;
  4039. /** Used to detect if a method is native. */
  4040. var reIsNative = RegExp('^' +
  4041. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  4042. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  4043. );
  4044. /** Built-in value references. */
  4045. var Symbol = root.Symbol,
  4046. Uint8Array = root.Uint8Array,
  4047. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  4048. splice = arrayProto.splice;
  4049. /* Built-in method references for those with the same name as other `lodash` methods. */
  4050. var nativeKeys = overArg(Object.keys, Object);
  4051. /* Built-in method references that are verified to be native. */
  4052. var DataView = getNative(root, 'DataView'),
  4053. Map = getNative(root, 'Map'),
  4054. Promise = getNative(root, 'Promise'),
  4055. Set = getNative(root, 'Set'),
  4056. WeakMap = getNative(root, 'WeakMap'),
  4057. nativeCreate = getNative(Object, 'create');
  4058. /** Used to detect maps, sets, and weakmaps. */
  4059. var dataViewCtorString = toSource(DataView),
  4060. mapCtorString = toSource(Map),
  4061. promiseCtorString = toSource(Promise),
  4062. setCtorString = toSource(Set),
  4063. weakMapCtorString = toSource(WeakMap);
  4064. /** Used to convert symbols to primitives and strings. */
  4065. var symbolProto = Symbol ? Symbol.prototype : undefined,
  4066. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  4067. symbolToString = symbolProto ? symbolProto.toString : undefined;
  4068. /**
  4069. * Creates a hash object.
  4070. *
  4071. * @private
  4072. * @constructor
  4073. * @param {Array} [entries] The key-value pairs to cache.
  4074. */
  4075. function Hash(entries) {
  4076. var index = -1,
  4077. length = entries ? entries.length : 0;
  4078. this.clear();
  4079. while (++index < length) {
  4080. var entry = entries[index];
  4081. this.set(entry[0], entry[1]);
  4082. }
  4083. }
  4084. /**
  4085. * Removes all key-value entries from the hash.
  4086. *
  4087. * @private
  4088. * @name clear
  4089. * @memberOf Hash
  4090. */
  4091. function hashClear() {
  4092. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  4093. }
  4094. /**
  4095. * Removes `key` and its value from the hash.
  4096. *
  4097. * @private
  4098. * @name delete
  4099. * @memberOf Hash
  4100. * @param {Object} hash The hash to modify.
  4101. * @param {string} key The key of the value to remove.
  4102. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4103. */
  4104. function hashDelete(key) {
  4105. return this.has(key) && delete this.__data__[key];
  4106. }
  4107. /**
  4108. * Gets the hash value for `key`.
  4109. *
  4110. * @private
  4111. * @name get
  4112. * @memberOf Hash
  4113. * @param {string} key The key of the value to get.
  4114. * @returns {*} Returns the entry value.
  4115. */
  4116. function hashGet(key) {
  4117. var data = this.__data__;
  4118. if (nativeCreate) {
  4119. var result = data[key];
  4120. return result === HASH_UNDEFINED ? undefined : result;
  4121. }
  4122. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  4123. }
  4124. /**
  4125. * Checks if a hash value for `key` exists.
  4126. *
  4127. * @private
  4128. * @name has
  4129. * @memberOf Hash
  4130. * @param {string} key The key of the entry to check.
  4131. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4132. */
  4133. function hashHas(key) {
  4134. var data = this.__data__;
  4135. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  4136. }
  4137. /**
  4138. * Sets the hash `key` to `value`.
  4139. *
  4140. * @private
  4141. * @name set
  4142. * @memberOf Hash
  4143. * @param {string} key The key of the value to set.
  4144. * @param {*} value The value to set.
  4145. * @returns {Object} Returns the hash instance.
  4146. */
  4147. function hashSet(key, value) {
  4148. var data = this.__data__;
  4149. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  4150. return this;
  4151. }
  4152. // Add methods to `Hash`.
  4153. Hash.prototype.clear = hashClear;
  4154. Hash.prototype['delete'] = hashDelete;
  4155. Hash.prototype.get = hashGet;
  4156. Hash.prototype.has = hashHas;
  4157. Hash.prototype.set = hashSet;
  4158. /**
  4159. * Creates an list cache object.
  4160. *
  4161. * @private
  4162. * @constructor
  4163. * @param {Array} [entries] The key-value pairs to cache.
  4164. */
  4165. function ListCache(entries) {
  4166. var index = -1,
  4167. length = entries ? entries.length : 0;
  4168. this.clear();
  4169. while (++index < length) {
  4170. var entry = entries[index];
  4171. this.set(entry[0], entry[1]);
  4172. }
  4173. }
  4174. /**
  4175. * Removes all key-value entries from the list cache.
  4176. *
  4177. * @private
  4178. * @name clear
  4179. * @memberOf ListCache
  4180. */
  4181. function listCacheClear() {
  4182. this.__data__ = [];
  4183. }
  4184. /**
  4185. * Removes `key` and its value from the list cache.
  4186. *
  4187. * @private
  4188. * @name delete
  4189. * @memberOf ListCache
  4190. * @param {string} key The key of the value to remove.
  4191. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4192. */
  4193. function listCacheDelete(key) {
  4194. var data = this.__data__,
  4195. index = assocIndexOf(data, key);
  4196. if (index < 0) {
  4197. return false;
  4198. }
  4199. var lastIndex = data.length - 1;
  4200. if (index == lastIndex) {
  4201. data.pop();
  4202. } else {
  4203. splice.call(data, index, 1);
  4204. }
  4205. return true;
  4206. }
  4207. /**
  4208. * Gets the list cache value for `key`.
  4209. *
  4210. * @private
  4211. * @name get
  4212. * @memberOf ListCache
  4213. * @param {string} key The key of the value to get.
  4214. * @returns {*} Returns the entry value.
  4215. */
  4216. function listCacheGet(key) {
  4217. var data = this.__data__,
  4218. index = assocIndexOf(data, key);
  4219. return index < 0 ? undefined : data[index][1];
  4220. }
  4221. /**
  4222. * Checks if a list cache value for `key` exists.
  4223. *
  4224. * @private
  4225. * @name has
  4226. * @memberOf ListCache
  4227. * @param {string} key The key of the entry to check.
  4228. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4229. */
  4230. function listCacheHas(key) {
  4231. return assocIndexOf(this.__data__, key) > -1;
  4232. }
  4233. /**
  4234. * Sets the list cache `key` to `value`.
  4235. *
  4236. * @private
  4237. * @name set
  4238. * @memberOf ListCache
  4239. * @param {string} key The key of the value to set.
  4240. * @param {*} value The value to set.
  4241. * @returns {Object} Returns the list cache instance.
  4242. */
  4243. function listCacheSet(key, value) {
  4244. var data = this.__data__,
  4245. index = assocIndexOf(data, key);
  4246. if (index < 0) {
  4247. data.push([key, value]);
  4248. } else {
  4249. data[index][1] = value;
  4250. }
  4251. return this;
  4252. }
  4253. // Add methods to `ListCache`.
  4254. ListCache.prototype.clear = listCacheClear;
  4255. ListCache.prototype['delete'] = listCacheDelete;
  4256. ListCache.prototype.get = listCacheGet;
  4257. ListCache.prototype.has = listCacheHas;
  4258. ListCache.prototype.set = listCacheSet;
  4259. /**
  4260. * Creates a map cache object to store key-value pairs.
  4261. *
  4262. * @private
  4263. * @constructor
  4264. * @param {Array} [entries] The key-value pairs to cache.
  4265. */
  4266. function MapCache(entries) {
  4267. var index = -1,
  4268. length = entries ? entries.length : 0;
  4269. this.clear();
  4270. while (++index < length) {
  4271. var entry = entries[index];
  4272. this.set(entry[0], entry[1]);
  4273. }
  4274. }
  4275. /**
  4276. * Removes all key-value entries from the map.
  4277. *
  4278. * @private
  4279. * @name clear
  4280. * @memberOf MapCache
  4281. */
  4282. function mapCacheClear() {
  4283. this.__data__ = {
  4284. 'hash': new Hash,
  4285. 'map': new (Map || ListCache),
  4286. 'string': new Hash
  4287. };
  4288. }
  4289. /**
  4290. * Removes `key` and its value from the map.
  4291. *
  4292. * @private
  4293. * @name delete
  4294. * @memberOf MapCache
  4295. * @param {string} key The key of the value to remove.
  4296. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4297. */
  4298. function mapCacheDelete(key) {
  4299. return getMapData(this, key)['delete'](key);
  4300. }
  4301. /**
  4302. * Gets the map value for `key`.
  4303. *
  4304. * @private
  4305. * @name get
  4306. * @memberOf MapCache
  4307. * @param {string} key The key of the value to get.
  4308. * @returns {*} Returns the entry value.
  4309. */
  4310. function mapCacheGet(key) {
  4311. return getMapData(this, key).get(key);
  4312. }
  4313. /**
  4314. * Checks if a map value for `key` exists.
  4315. *
  4316. * @private
  4317. * @name has
  4318. * @memberOf MapCache
  4319. * @param {string} key The key of the entry to check.
  4320. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4321. */
  4322. function mapCacheHas(key) {
  4323. return getMapData(this, key).has(key);
  4324. }
  4325. /**
  4326. * Sets the map `key` to `value`.
  4327. *
  4328. * @private
  4329. * @name set
  4330. * @memberOf MapCache
  4331. * @param {string} key The key of the value to set.
  4332. * @param {*} value The value to set.
  4333. * @returns {Object} Returns the map cache instance.
  4334. */
  4335. function mapCacheSet(key, value) {
  4336. getMapData(this, key).set(key, value);
  4337. return this;
  4338. }
  4339. // Add methods to `MapCache`.
  4340. MapCache.prototype.clear = mapCacheClear;
  4341. MapCache.prototype['delete'] = mapCacheDelete;
  4342. MapCache.prototype.get = mapCacheGet;
  4343. MapCache.prototype.has = mapCacheHas;
  4344. MapCache.prototype.set = mapCacheSet;
  4345. /**
  4346. *
  4347. * Creates an array cache object to store unique values.
  4348. *
  4349. * @private
  4350. * @constructor
  4351. * @param {Array} [values] The values to cache.
  4352. */
  4353. function SetCache(values) {
  4354. var index = -1,
  4355. length = values ? values.length : 0;
  4356. this.__data__ = new MapCache;
  4357. while (++index < length) {
  4358. this.add(values[index]);
  4359. }
  4360. }
  4361. /**
  4362. * Adds `value` to the array cache.
  4363. *
  4364. * @private
  4365. * @name add
  4366. * @memberOf SetCache
  4367. * @alias push
  4368. * @param {*} value The value to cache.
  4369. * @returns {Object} Returns the cache instance.
  4370. */
  4371. function setCacheAdd(value) {
  4372. this.__data__.set(value, HASH_UNDEFINED);
  4373. return this;
  4374. }
  4375. /**
  4376. * Checks if `value` is in the array cache.
  4377. *
  4378. * @private
  4379. * @name has
  4380. * @memberOf SetCache
  4381. * @param {*} value The value to search for.
  4382. * @returns {number} Returns `true` if `value` is found, else `false`.
  4383. */
  4384. function setCacheHas(value) {
  4385. return this.__data__.has(value);
  4386. }
  4387. // Add methods to `SetCache`.
  4388. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  4389. SetCache.prototype.has = setCacheHas;
  4390. /**
  4391. * Creates a stack cache object to store key-value pairs.
  4392. *
  4393. * @private
  4394. * @constructor
  4395. * @param {Array} [entries] The key-value pairs to cache.
  4396. */
  4397. function Stack(entries) {
  4398. this.__data__ = new ListCache(entries);
  4399. }
  4400. /**
  4401. * Removes all key-value entries from the stack.
  4402. *
  4403. * @private
  4404. * @name clear
  4405. * @memberOf Stack
  4406. */
  4407. function stackClear() {
  4408. this.__data__ = new ListCache;
  4409. }
  4410. /**
  4411. * Removes `key` and its value from the stack.
  4412. *
  4413. * @private
  4414. * @name delete
  4415. * @memberOf Stack
  4416. * @param {string} key The key of the value to remove.
  4417. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4418. */
  4419. function stackDelete(key) {
  4420. return this.__data__['delete'](key);
  4421. }
  4422. /**
  4423. * Gets the stack value for `key`.
  4424. *
  4425. * @private
  4426. * @name get
  4427. * @memberOf Stack
  4428. * @param {string} key The key of the value to get.
  4429. * @returns {*} Returns the entry value.
  4430. */
  4431. function stackGet(key) {
  4432. return this.__data__.get(key);
  4433. }
  4434. /**
  4435. * Checks if a stack value for `key` exists.
  4436. *
  4437. * @private
  4438. * @name has
  4439. * @memberOf Stack
  4440. * @param {string} key The key of the entry to check.
  4441. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4442. */
  4443. function stackHas(key) {
  4444. return this.__data__.has(key);
  4445. }
  4446. /**
  4447. * Sets the stack `key` to `value`.
  4448. *
  4449. * @private
  4450. * @name set
  4451. * @memberOf Stack
  4452. * @param {string} key The key of the value to set.
  4453. * @param {*} value The value to set.
  4454. * @returns {Object} Returns the stack cache instance.
  4455. */
  4456. function stackSet(key, value) {
  4457. var cache = this.__data__;
  4458. if (cache instanceof ListCache) {
  4459. var pairs = cache.__data__;
  4460. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  4461. pairs.push([key, value]);
  4462. return this;
  4463. }
  4464. cache = this.__data__ = new MapCache(pairs);
  4465. }
  4466. cache.set(key, value);
  4467. return this;
  4468. }
  4469. // Add methods to `Stack`.
  4470. Stack.prototype.clear = stackClear;
  4471. Stack.prototype['delete'] = stackDelete;
  4472. Stack.prototype.get = stackGet;
  4473. Stack.prototype.has = stackHas;
  4474. Stack.prototype.set = stackSet;
  4475. /**
  4476. * Creates an array of the enumerable property names of the array-like `value`.
  4477. *
  4478. * @private
  4479. * @param {*} value The value to query.
  4480. * @param {boolean} inherited Specify returning inherited property names.
  4481. * @returns {Array} Returns the array of property names.
  4482. */
  4483. function arrayLikeKeys(value, inherited) {
  4484. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  4485. // Safari 9 makes `arguments.length` enumerable in strict mode.
  4486. var result = (isArray(value) || isArguments(value))
  4487. ? baseTimes(value.length, String)
  4488. : [];
  4489. var length = result.length,
  4490. skipIndexes = !!length;
  4491. for (var key in value) {
  4492. if ((inherited || hasOwnProperty.call(value, key)) &&
  4493. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  4494. result.push(key);
  4495. }
  4496. }
  4497. return result;
  4498. }
  4499. /**
  4500. * Gets the index at which the `key` is found in `array` of key-value pairs.
  4501. *
  4502. * @private
  4503. * @param {Array} array The array to inspect.
  4504. * @param {*} key The key to search for.
  4505. * @returns {number} Returns the index of the matched value, else `-1`.
  4506. */
  4507. function assocIndexOf(array, key) {
  4508. var length = array.length;
  4509. while (length--) {
  4510. if (eq(array[length][0], key)) {
  4511. return length;
  4512. }
  4513. }
  4514. return -1;
  4515. }
  4516. /**
  4517. * The base implementation of `_.get` without support for default values.
  4518. *
  4519. * @private
  4520. * @param {Object} object The object to query.
  4521. * @param {Array|string} path The path of the property to get.
  4522. * @returns {*} Returns the resolved value.
  4523. */
  4524. function baseGet(object, path) {
  4525. path = isKey(path, object) ? [path] : castPath(path);
  4526. var index = 0,
  4527. length = path.length;
  4528. while (object != null && index < length) {
  4529. object = object[toKey(path[index++])];
  4530. }
  4531. return (index && index == length) ? object : undefined;
  4532. }
  4533. /**
  4534. * The base implementation of `getTag`.
  4535. *
  4536. * @private
  4537. * @param {*} value The value to query.
  4538. * @returns {string} Returns the `toStringTag`.
  4539. */
  4540. function baseGetTag(value) {
  4541. return objectToString.call(value);
  4542. }
  4543. /**
  4544. * The base implementation of `_.hasIn` without support for deep paths.
  4545. *
  4546. * @private
  4547. * @param {Object} [object] The object to query.
  4548. * @param {Array|string} key The key to check.
  4549. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  4550. */
  4551. function baseHasIn(object, key) {
  4552. return object != null && key in Object(object);
  4553. }
  4554. /**
  4555. * The base implementation of `_.isEqual` which supports partial comparisons
  4556. * and tracks traversed objects.
  4557. *
  4558. * @private
  4559. * @param {*} value The value to compare.
  4560. * @param {*} other The other value to compare.
  4561. * @param {Function} [customizer] The function to customize comparisons.
  4562. * @param {boolean} [bitmask] The bitmask of comparison flags.
  4563. * The bitmask may be composed of the following flags:
  4564. * 1 - Unordered comparison
  4565. * 2 - Partial comparison
  4566. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  4567. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  4568. */
  4569. function baseIsEqual(value, other, customizer, bitmask, stack) {
  4570. if (value === other) {
  4571. return true;
  4572. }
  4573. if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
  4574. return value !== value && other !== other;
  4575. }
  4576. return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
  4577. }
  4578. /**
  4579. * A specialized version of `baseIsEqual` for arrays and objects which performs
  4580. * deep comparisons and tracks traversed objects enabling objects with circular
  4581. * references to be compared.
  4582. *
  4583. * @private
  4584. * @param {Object} object The object to compare.
  4585. * @param {Object} other The other object to compare.
  4586. * @param {Function} equalFunc The function to determine equivalents of values.
  4587. * @param {Function} [customizer] The function to customize comparisons.
  4588. * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
  4589. * for more details.
  4590. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  4591. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  4592. */
  4593. function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
  4594. var objIsArr = isArray(object),
  4595. othIsArr = isArray(other),
  4596. objTag = arrayTag,
  4597. othTag = arrayTag;
  4598. if (!objIsArr) {
  4599. objTag = getTag(object);
  4600. objTag = objTag == argsTag ? objectTag : objTag;
  4601. }
  4602. if (!othIsArr) {
  4603. othTag = getTag(other);
  4604. othTag = othTag == argsTag ? objectTag : othTag;
  4605. }
  4606. var objIsObj = objTag == objectTag && !isHostObject(object),
  4607. othIsObj = othTag == objectTag && !isHostObject(other),
  4608. isSameTag = objTag == othTag;
  4609. if (isSameTag && !objIsObj) {
  4610. stack || (stack = new Stack);
  4611. return (objIsArr || isTypedArray(object))
  4612. ? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
  4613. : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
  4614. }
  4615. if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
  4616. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  4617. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  4618. if (objIsWrapped || othIsWrapped) {
  4619. var objUnwrapped = objIsWrapped ? object.value() : object,
  4620. othUnwrapped = othIsWrapped ? other.value() : other;
  4621. stack || (stack = new Stack);
  4622. return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
  4623. }
  4624. }
  4625. if (!isSameTag) {
  4626. return false;
  4627. }
  4628. stack || (stack = new Stack);
  4629. return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
  4630. }
  4631. /**
  4632. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  4633. *
  4634. * @private
  4635. * @param {Object} object The object to inspect.
  4636. * @param {Object} source The object of property values to match.
  4637. * @param {Array} matchData The property names, values, and compare flags to match.
  4638. * @param {Function} [customizer] The function to customize comparisons.
  4639. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  4640. */
  4641. function baseIsMatch(object, source, matchData, customizer) {
  4642. var index = matchData.length,
  4643. length = index,
  4644. noCustomizer = !customizer;
  4645. if (object == null) {
  4646. return !length;
  4647. }
  4648. object = Object(object);
  4649. while (index--) {
  4650. var data = matchData[index];
  4651. if ((noCustomizer && data[2])
  4652. ? data[1] !== object[data[0]]
  4653. : !(data[0] in object)
  4654. ) {
  4655. return false;
  4656. }
  4657. }
  4658. while (++index < length) {
  4659. data = matchData[index];
  4660. var key = data[0],
  4661. objValue = object[key],
  4662. srcValue = data[1];
  4663. if (noCustomizer && data[2]) {
  4664. if (objValue === undefined && !(key in object)) {
  4665. return false;
  4666. }
  4667. } else {
  4668. var stack = new Stack;
  4669. if (customizer) {
  4670. var result = customizer(objValue, srcValue, key, object, source, stack);
  4671. }
  4672. if (!(result === undefined
  4673. ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
  4674. : result
  4675. )) {
  4676. return false;
  4677. }
  4678. }
  4679. }
  4680. return true;
  4681. }
  4682. /**
  4683. * The base implementation of `_.isNative` without bad shim checks.
  4684. *
  4685. * @private
  4686. * @param {*} value The value to check.
  4687. * @returns {boolean} Returns `true` if `value` is a native function,
  4688. * else `false`.
  4689. */
  4690. function baseIsNative(value) {
  4691. if (!isObject(value) || isMasked(value)) {
  4692. return false;
  4693. }
  4694. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  4695. return pattern.test(toSource(value));
  4696. }
  4697. /**
  4698. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  4699. *
  4700. * @private
  4701. * @param {*} value The value to check.
  4702. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  4703. */
  4704. function baseIsTypedArray(value) {
  4705. return isObjectLike(value) &&
  4706. isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
  4707. }
  4708. /**
  4709. * The base implementation of `_.iteratee`.
  4710. *
  4711. * @private
  4712. * @param {*} [value=_.identity] The value to convert to an iteratee.
  4713. * @returns {Function} Returns the iteratee.
  4714. */
  4715. function baseIteratee(value) {
  4716. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  4717. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  4718. if (typeof value == 'function') {
  4719. return value;
  4720. }
  4721. if (value == null) {
  4722. return identity;
  4723. }
  4724. if (typeof value == 'object') {
  4725. return isArray(value)
  4726. ? baseMatchesProperty(value[0], value[1])
  4727. : baseMatches(value);
  4728. }
  4729. return property(value);
  4730. }
  4731. /**
  4732. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  4733. *
  4734. * @private
  4735. * @param {Object} object The object to query.
  4736. * @returns {Array} Returns the array of property names.
  4737. */
  4738. function baseKeys(object) {
  4739. if (!isPrototype(object)) {
  4740. return nativeKeys(object);
  4741. }
  4742. var result = [];
  4743. for (var key in Object(object)) {
  4744. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  4745. result.push(key);
  4746. }
  4747. }
  4748. return result;
  4749. }
  4750. /**
  4751. * The base implementation of `_.matches` which doesn't clone `source`.
  4752. *
  4753. * @private
  4754. * @param {Object} source The object of property values to match.
  4755. * @returns {Function} Returns the new spec function.
  4756. */
  4757. function baseMatches(source) {
  4758. var matchData = getMatchData(source);
  4759. if (matchData.length == 1 && matchData[0][2]) {
  4760. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  4761. }
  4762. return function(object) {
  4763. return object === source || baseIsMatch(object, source, matchData);
  4764. };
  4765. }
  4766. /**
  4767. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  4768. *
  4769. * @private
  4770. * @param {string} path The path of the property to get.
  4771. * @param {*} srcValue The value to match.
  4772. * @returns {Function} Returns the new spec function.
  4773. */
  4774. function baseMatchesProperty(path, srcValue) {
  4775. if (isKey(path) && isStrictComparable(srcValue)) {
  4776. return matchesStrictComparable(toKey(path), srcValue);
  4777. }
  4778. return function(object) {
  4779. var objValue = get(object, path);
  4780. return (objValue === undefined && objValue === srcValue)
  4781. ? hasIn(object, path)
  4782. : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
  4783. };
  4784. }
  4785. /**
  4786. * A specialized version of `baseProperty` which supports deep paths.
  4787. *
  4788. * @private
  4789. * @param {Array|string} path The path of the property to get.
  4790. * @returns {Function} Returns the new accessor function.
  4791. */
  4792. function basePropertyDeep(path) {
  4793. return function(object) {
  4794. return baseGet(object, path);
  4795. };
  4796. }
  4797. /**
  4798. * The base implementation of `_.toString` which doesn't convert nullish
  4799. * values to empty strings.
  4800. *
  4801. * @private
  4802. * @param {*} value The value to process.
  4803. * @returns {string} Returns the string.
  4804. */
  4805. function baseToString(value) {
  4806. // Exit early for strings to avoid a performance hit in some environments.
  4807. if (typeof value == 'string') {
  4808. return value;
  4809. }
  4810. if (isSymbol(value)) {
  4811. return symbolToString ? symbolToString.call(value) : '';
  4812. }
  4813. var result = (value + '');
  4814. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  4815. }
  4816. /**
  4817. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  4818. *
  4819. * @private
  4820. * @param {Array} array The array to inspect.
  4821. * @param {Function} [iteratee] The iteratee invoked per element.
  4822. * @param {Function} [comparator] The comparator invoked per element.
  4823. * @returns {Array} Returns the new duplicate free array.
  4824. */
  4825. function baseUniq(array, iteratee, comparator) {
  4826. var index = -1,
  4827. includes = arrayIncludes,
  4828. length = array.length,
  4829. isCommon = true,
  4830. result = [],
  4831. seen = result;
  4832. if (comparator) {
  4833. isCommon = false;
  4834. includes = arrayIncludesWith;
  4835. }
  4836. else if (length >= LARGE_ARRAY_SIZE) {
  4837. var set = iteratee ? null : createSet(array);
  4838. if (set) {
  4839. return setToArray(set);
  4840. }
  4841. isCommon = false;
  4842. includes = cacheHas;
  4843. seen = new SetCache;
  4844. }
  4845. else {
  4846. seen = iteratee ? [] : result;
  4847. }
  4848. outer:
  4849. while (++index < length) {
  4850. var value = array[index],
  4851. computed = iteratee ? iteratee(value) : value;
  4852. value = (comparator || value !== 0) ? value : 0;
  4853. if (isCommon && computed === computed) {
  4854. var seenIndex = seen.length;
  4855. while (seenIndex--) {
  4856. if (seen[seenIndex] === computed) {
  4857. continue outer;
  4858. }
  4859. }
  4860. if (iteratee) {
  4861. seen.push(computed);
  4862. }
  4863. result.push(value);
  4864. }
  4865. else if (!includes(seen, computed, comparator)) {
  4866. if (seen !== result) {
  4867. seen.push(computed);
  4868. }
  4869. result.push(value);
  4870. }
  4871. }
  4872. return result;
  4873. }
  4874. /**
  4875. * Casts `value` to a path array if it's not one.
  4876. *
  4877. * @private
  4878. * @param {*} value The value to inspect.
  4879. * @returns {Array} Returns the cast property path array.
  4880. */
  4881. function castPath(value) {
  4882. return isArray(value) ? value : stringToPath(value);
  4883. }
  4884. /**
  4885. * Creates a set object of `values`.
  4886. *
  4887. * @private
  4888. * @param {Array} values The values to add to the set.
  4889. * @returns {Object} Returns the new set.
  4890. */
  4891. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  4892. return new Set(values);
  4893. };
  4894. /**
  4895. * A specialized version of `baseIsEqualDeep` for arrays with support for
  4896. * partial deep comparisons.
  4897. *
  4898. * @private
  4899. * @param {Array} array The array to compare.
  4900. * @param {Array} other The other array to compare.
  4901. * @param {Function} equalFunc The function to determine equivalents of values.
  4902. * @param {Function} customizer The function to customize comparisons.
  4903. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  4904. * for more details.
  4905. * @param {Object} stack Tracks traversed `array` and `other` objects.
  4906. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  4907. */
  4908. function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
  4909. var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
  4910. arrLength = array.length,
  4911. othLength = other.length;
  4912. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  4913. return false;
  4914. }
  4915. // Assume cyclic values are equal.
  4916. var stacked = stack.get(array);
  4917. if (stacked && stack.get(other)) {
  4918. return stacked == other;
  4919. }
  4920. var index = -1,
  4921. result = true,
  4922. seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
  4923. stack.set(array, other);
  4924. stack.set(other, array);
  4925. // Ignore non-index properties.
  4926. while (++index < arrLength) {
  4927. var arrValue = array[index],
  4928. othValue = other[index];
  4929. if (customizer) {
  4930. var compared = isPartial
  4931. ? customizer(othValue, arrValue, index, other, array, stack)
  4932. : customizer(arrValue, othValue, index, array, other, stack);
  4933. }
  4934. if (compared !== undefined) {
  4935. if (compared) {
  4936. continue;
  4937. }
  4938. result = false;
  4939. break;
  4940. }
  4941. // Recursively compare arrays (susceptible to call stack limits).
  4942. if (seen) {
  4943. if (!arraySome(other, function(othValue, othIndex) {
  4944. if (!seen.has(othIndex) &&
  4945. (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
  4946. return seen.add(othIndex);
  4947. }
  4948. })) {
  4949. result = false;
  4950. break;
  4951. }
  4952. } else if (!(
  4953. arrValue === othValue ||
  4954. equalFunc(arrValue, othValue, customizer, bitmask, stack)
  4955. )) {
  4956. result = false;
  4957. break;
  4958. }
  4959. }
  4960. stack['delete'](array);
  4961. stack['delete'](other);
  4962. return result;
  4963. }
  4964. /**
  4965. * A specialized version of `baseIsEqualDeep` for comparing objects of
  4966. * the same `toStringTag`.
  4967. *
  4968. * **Note:** This function only supports comparing values with tags of
  4969. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  4970. *
  4971. * @private
  4972. * @param {Object} object The object to compare.
  4973. * @param {Object} other The other object to compare.
  4974. * @param {string} tag The `toStringTag` of the objects to compare.
  4975. * @param {Function} equalFunc The function to determine equivalents of values.
  4976. * @param {Function} customizer The function to customize comparisons.
  4977. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  4978. * for more details.
  4979. * @param {Object} stack Tracks traversed `object` and `other` objects.
  4980. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  4981. */
  4982. function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
  4983. switch (tag) {
  4984. case dataViewTag:
  4985. if ((object.byteLength != other.byteLength) ||
  4986. (object.byteOffset != other.byteOffset)) {
  4987. return false;
  4988. }
  4989. object = object.buffer;
  4990. other = other.buffer;
  4991. case arrayBufferTag:
  4992. if ((object.byteLength != other.byteLength) ||
  4993. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  4994. return false;
  4995. }
  4996. return true;
  4997. case boolTag:
  4998. case dateTag:
  4999. case numberTag:
  5000. // Coerce booleans to `1` or `0` and dates to milliseconds.
  5001. // Invalid dates are coerced to `NaN`.
  5002. return eq(+object, +other);
  5003. case errorTag:
  5004. return object.name == other.name && object.message == other.message;
  5005. case regexpTag:
  5006. case stringTag:
  5007. // Coerce regexes to strings and treat strings, primitives and objects,
  5008. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  5009. // for more details.
  5010. return object == (other + '');
  5011. case mapTag:
  5012. var convert = mapToArray;
  5013. case setTag:
  5014. var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
  5015. convert || (convert = setToArray);
  5016. if (object.size != other.size && !isPartial) {
  5017. return false;
  5018. }
  5019. // Assume cyclic values are equal.
  5020. var stacked = stack.get(object);
  5021. if (stacked) {
  5022. return stacked == other;
  5023. }
  5024. bitmask |= UNORDERED_COMPARE_FLAG;
  5025. // Recursively compare objects (susceptible to call stack limits).
  5026. stack.set(object, other);
  5027. var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
  5028. stack['delete'](object);
  5029. return result;
  5030. case symbolTag:
  5031. if (symbolValueOf) {
  5032. return symbolValueOf.call(object) == symbolValueOf.call(other);
  5033. }
  5034. }
  5035. return false;
  5036. }
  5037. /**
  5038. * A specialized version of `baseIsEqualDeep` for objects with support for
  5039. * partial deep comparisons.
  5040. *
  5041. * @private
  5042. * @param {Object} object The object to compare.
  5043. * @param {Object} other The other object to compare.
  5044. * @param {Function} equalFunc The function to determine equivalents of values.
  5045. * @param {Function} customizer The function to customize comparisons.
  5046. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  5047. * for more details.
  5048. * @param {Object} stack Tracks traversed `object` and `other` objects.
  5049. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  5050. */
  5051. function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
  5052. var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
  5053. objProps = keys(object),
  5054. objLength = objProps.length,
  5055. othProps = keys(other),
  5056. othLength = othProps.length;
  5057. if (objLength != othLength && !isPartial) {
  5058. return false;
  5059. }
  5060. var index = objLength;
  5061. while (index--) {
  5062. var key = objProps[index];
  5063. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  5064. return false;
  5065. }
  5066. }
  5067. // Assume cyclic values are equal.
  5068. var stacked = stack.get(object);
  5069. if (stacked && stack.get(other)) {
  5070. return stacked == other;
  5071. }
  5072. var result = true;
  5073. stack.set(object, other);
  5074. stack.set(other, object);
  5075. var skipCtor = isPartial;
  5076. while (++index < objLength) {
  5077. key = objProps[index];
  5078. var objValue = object[key],
  5079. othValue = other[key];
  5080. if (customizer) {
  5081. var compared = isPartial
  5082. ? customizer(othValue, objValue, key, other, object, stack)
  5083. : customizer(objValue, othValue, key, object, other, stack);
  5084. }
  5085. // Recursively compare objects (susceptible to call stack limits).
  5086. if (!(compared === undefined
  5087. ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
  5088. : compared
  5089. )) {
  5090. result = false;
  5091. break;
  5092. }
  5093. skipCtor || (skipCtor = key == 'constructor');
  5094. }
  5095. if (result && !skipCtor) {
  5096. var objCtor = object.constructor,
  5097. othCtor = other.constructor;
  5098. // Non `Object` object instances with different constructors are not equal.
  5099. if (objCtor != othCtor &&
  5100. ('constructor' in object && 'constructor' in other) &&
  5101. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  5102. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  5103. result = false;
  5104. }
  5105. }
  5106. stack['delete'](object);
  5107. stack['delete'](other);
  5108. return result;
  5109. }
  5110. /**
  5111. * Gets the data for `map`.
  5112. *
  5113. * @private
  5114. * @param {Object} map The map to query.
  5115. * @param {string} key The reference key.
  5116. * @returns {*} Returns the map data.
  5117. */
  5118. function getMapData(map, key) {
  5119. var data = map.__data__;
  5120. return isKeyable(key)
  5121. ? data[typeof key == 'string' ? 'string' : 'hash']
  5122. : data.map;
  5123. }
  5124. /**
  5125. * Gets the property names, values, and compare flags of `object`.
  5126. *
  5127. * @private
  5128. * @param {Object} object The object to query.
  5129. * @returns {Array} Returns the match data of `object`.
  5130. */
  5131. function getMatchData(object) {
  5132. var result = keys(object),
  5133. length = result.length;
  5134. while (length--) {
  5135. var key = result[length],
  5136. value = object[key];
  5137. result[length] = [key, value, isStrictComparable(value)];
  5138. }
  5139. return result;
  5140. }
  5141. /**
  5142. * Gets the native function at `key` of `object`.
  5143. *
  5144. * @private
  5145. * @param {Object} object The object to query.
  5146. * @param {string} key The key of the method to get.
  5147. * @returns {*} Returns the function if it's native, else `undefined`.
  5148. */
  5149. function getNative(object, key) {
  5150. var value = getValue(object, key);
  5151. return baseIsNative(value) ? value : undefined;
  5152. }
  5153. /**
  5154. * Gets the `toStringTag` of `value`.
  5155. *
  5156. * @private
  5157. * @param {*} value The value to query.
  5158. * @returns {string} Returns the `toStringTag`.
  5159. */
  5160. var getTag = baseGetTag;
  5161. // Fallback for data views, maps, sets, and weak maps in IE 11,
  5162. // for data views in Edge < 14, and promises in Node.js.
  5163. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  5164. (Map && getTag(new Map) != mapTag) ||
  5165. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  5166. (Set && getTag(new Set) != setTag) ||
  5167. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  5168. getTag = function(value) {
  5169. var result = objectToString.call(value),
  5170. Ctor = result == objectTag ? value.constructor : undefined,
  5171. ctorString = Ctor ? toSource(Ctor) : undefined;
  5172. if (ctorString) {
  5173. switch (ctorString) {
  5174. case dataViewCtorString: return dataViewTag;
  5175. case mapCtorString: return mapTag;
  5176. case promiseCtorString: return promiseTag;
  5177. case setCtorString: return setTag;
  5178. case weakMapCtorString: return weakMapTag;
  5179. }
  5180. }
  5181. return result;
  5182. };
  5183. }
  5184. /**
  5185. * Checks if `path` exists on `object`.
  5186. *
  5187. * @private
  5188. * @param {Object} object The object to query.
  5189. * @param {Array|string} path The path to check.
  5190. * @param {Function} hasFunc The function to check properties.
  5191. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  5192. */
  5193. function hasPath(object, path, hasFunc) {
  5194. path = isKey(path, object) ? [path] : castPath(path);
  5195. var result,
  5196. index = -1,
  5197. length = path.length;
  5198. while (++index < length) {
  5199. var key = toKey(path[index]);
  5200. if (!(result = object != null && hasFunc(object, key))) {
  5201. break;
  5202. }
  5203. object = object[key];
  5204. }
  5205. if (result) {
  5206. return result;
  5207. }
  5208. var length = object ? object.length : 0;
  5209. return !!length && isLength(length) && isIndex(key, length) &&
  5210. (isArray(object) || isArguments(object));
  5211. }
  5212. /**
  5213. * Checks if `value` is a valid array-like index.
  5214. *
  5215. * @private
  5216. * @param {*} value The value to check.
  5217. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  5218. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  5219. */
  5220. function isIndex(value, length) {
  5221. length = length == null ? MAX_SAFE_INTEGER : length;
  5222. return !!length &&
  5223. (typeof value == 'number' || reIsUint.test(value)) &&
  5224. (value > -1 && value % 1 == 0 && value < length);
  5225. }
  5226. /**
  5227. * Checks if `value` is a property name and not a property path.
  5228. *
  5229. * @private
  5230. * @param {*} value The value to check.
  5231. * @param {Object} [object] The object to query keys on.
  5232. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  5233. */
  5234. function isKey(value, object) {
  5235. if (isArray(value)) {
  5236. return false;
  5237. }
  5238. var type = typeof value;
  5239. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  5240. value == null || isSymbol(value)) {
  5241. return true;
  5242. }
  5243. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  5244. (object != null && value in Object(object));
  5245. }
  5246. /**
  5247. * Checks if `value` is suitable for use as unique object key.
  5248. *
  5249. * @private
  5250. * @param {*} value The value to check.
  5251. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  5252. */
  5253. function isKeyable(value) {
  5254. var type = typeof value;
  5255. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  5256. ? (value !== '__proto__')
  5257. : (value === null);
  5258. }
  5259. /**
  5260. * Checks if `func` has its source masked.
  5261. *
  5262. * @private
  5263. * @param {Function} func The function to check.
  5264. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  5265. */
  5266. function isMasked(func) {
  5267. return !!maskSrcKey && (maskSrcKey in func);
  5268. }
  5269. /**
  5270. * Checks if `value` is likely a prototype object.
  5271. *
  5272. * @private
  5273. * @param {*} value The value to check.
  5274. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  5275. */
  5276. function isPrototype(value) {
  5277. var Ctor = value && value.constructor,
  5278. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  5279. return value === proto;
  5280. }
  5281. /**
  5282. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  5283. *
  5284. * @private
  5285. * @param {*} value The value to check.
  5286. * @returns {boolean} Returns `true` if `value` if suitable for strict
  5287. * equality comparisons, else `false`.
  5288. */
  5289. function isStrictComparable(value) {
  5290. return value === value && !isObject(value);
  5291. }
  5292. /**
  5293. * A specialized version of `matchesProperty` for source values suitable
  5294. * for strict equality comparisons, i.e. `===`.
  5295. *
  5296. * @private
  5297. * @param {string} key The key of the property to get.
  5298. * @param {*} srcValue The value to match.
  5299. * @returns {Function} Returns the new spec function.
  5300. */
  5301. function matchesStrictComparable(key, srcValue) {
  5302. return function(object) {
  5303. if (object == null) {
  5304. return false;
  5305. }
  5306. return object[key] === srcValue &&
  5307. (srcValue !== undefined || (key in Object(object)));
  5308. };
  5309. }
  5310. /**
  5311. * Converts `string` to a property path array.
  5312. *
  5313. * @private
  5314. * @param {string} string The string to convert.
  5315. * @returns {Array} Returns the property path array.
  5316. */
  5317. var stringToPath = memoize(function(string) {
  5318. string = toString(string);
  5319. var result = [];
  5320. if (reLeadingDot.test(string)) {
  5321. result.push('');
  5322. }
  5323. string.replace(rePropName, function(match, number, quote, string) {
  5324. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  5325. });
  5326. return result;
  5327. });
  5328. /**
  5329. * Converts `value` to a string key if it's not a string or symbol.
  5330. *
  5331. * @private
  5332. * @param {*} value The value to inspect.
  5333. * @returns {string|symbol} Returns the key.
  5334. */
  5335. function toKey(value) {
  5336. if (typeof value == 'string' || isSymbol(value)) {
  5337. return value;
  5338. }
  5339. var result = (value + '');
  5340. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  5341. }
  5342. /**
  5343. * Converts `func` to its source code.
  5344. *
  5345. * @private
  5346. * @param {Function} func The function to process.
  5347. * @returns {string} Returns the source code.
  5348. */
  5349. function toSource(func) {
  5350. if (func != null) {
  5351. try {
  5352. return funcToString.call(func);
  5353. } catch (e) {}
  5354. try {
  5355. return (func + '');
  5356. } catch (e) {}
  5357. }
  5358. return '';
  5359. }
  5360. /**
  5361. * This method is like `_.uniq` except that it accepts `iteratee` which is
  5362. * invoked for each element in `array` to generate the criterion by which
  5363. * uniqueness is computed. The iteratee is invoked with one argument: (value).
  5364. *
  5365. * @static
  5366. * @memberOf _
  5367. * @since 4.0.0
  5368. * @category Array
  5369. * @param {Array} array The array to inspect.
  5370. * @param {Function} [iteratee=_.identity]
  5371. * The iteratee invoked per element.
  5372. * @returns {Array} Returns the new duplicate free array.
  5373. * @example
  5374. *
  5375. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  5376. * // => [2.1, 1.2]
  5377. *
  5378. * // The `_.property` iteratee shorthand.
  5379. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  5380. * // => [{ 'x': 1 }, { 'x': 2 }]
  5381. */
  5382. function uniqBy(array, iteratee) {
  5383. return (array && array.length)
  5384. ? baseUniq(array, baseIteratee(iteratee, 2))
  5385. : [];
  5386. }
  5387. /**
  5388. * Creates a function that memoizes the result of `func`. If `resolver` is
  5389. * provided, it determines the cache key for storing the result based on the
  5390. * arguments provided to the memoized function. By default, the first argument
  5391. * provided to the memoized function is used as the map cache key. The `func`
  5392. * is invoked with the `this` binding of the memoized function.
  5393. *
  5394. * **Note:** The cache is exposed as the `cache` property on the memoized
  5395. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  5396. * constructor with one whose instances implement the
  5397. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  5398. * method interface of `delete`, `get`, `has`, and `set`.
  5399. *
  5400. * @static
  5401. * @memberOf _
  5402. * @since 0.1.0
  5403. * @category Function
  5404. * @param {Function} func The function to have its output memoized.
  5405. * @param {Function} [resolver] The function to resolve the cache key.
  5406. * @returns {Function} Returns the new memoized function.
  5407. * @example
  5408. *
  5409. * var object = { 'a': 1, 'b': 2 };
  5410. * var other = { 'c': 3, 'd': 4 };
  5411. *
  5412. * var values = _.memoize(_.values);
  5413. * values(object);
  5414. * // => [1, 2]
  5415. *
  5416. * values(other);
  5417. * // => [3, 4]
  5418. *
  5419. * object.a = 2;
  5420. * values(object);
  5421. * // => [1, 2]
  5422. *
  5423. * // Modify the result cache.
  5424. * values.cache.set(object, ['a', 'b']);
  5425. * values(object);
  5426. * // => ['a', 'b']
  5427. *
  5428. * // Replace `_.memoize.Cache`.
  5429. * _.memoize.Cache = WeakMap;
  5430. */
  5431. function memoize(func, resolver) {
  5432. if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
  5433. throw new TypeError(FUNC_ERROR_TEXT);
  5434. }
  5435. var memoized = function() {
  5436. var args = arguments,
  5437. key = resolver ? resolver.apply(this, args) : args[0],
  5438. cache = memoized.cache;
  5439. if (cache.has(key)) {
  5440. return cache.get(key);
  5441. }
  5442. var result = func.apply(this, args);
  5443. memoized.cache = cache.set(key, result);
  5444. return result;
  5445. };
  5446. memoized.cache = new (memoize.Cache || MapCache);
  5447. return memoized;
  5448. }
  5449. // Assign cache to `_.memoize`.
  5450. memoize.Cache = MapCache;
  5451. /**
  5452. * Performs a
  5453. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  5454. * comparison between two values to determine if they are equivalent.
  5455. *
  5456. * @static
  5457. * @memberOf _
  5458. * @since 4.0.0
  5459. * @category Lang
  5460. * @param {*} value The value to compare.
  5461. * @param {*} other The other value to compare.
  5462. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  5463. * @example
  5464. *
  5465. * var object = { 'a': 1 };
  5466. * var other = { 'a': 1 };
  5467. *
  5468. * _.eq(object, object);
  5469. * // => true
  5470. *
  5471. * _.eq(object, other);
  5472. * // => false
  5473. *
  5474. * _.eq('a', 'a');
  5475. * // => true
  5476. *
  5477. * _.eq('a', Object('a'));
  5478. * // => false
  5479. *
  5480. * _.eq(NaN, NaN);
  5481. * // => true
  5482. */
  5483. function eq(value, other) {
  5484. return value === other || (value !== value && other !== other);
  5485. }
  5486. /**
  5487. * Checks if `value` is likely an `arguments` object.
  5488. *
  5489. * @static
  5490. * @memberOf _
  5491. * @since 0.1.0
  5492. * @category Lang
  5493. * @param {*} value The value to check.
  5494. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  5495. * else `false`.
  5496. * @example
  5497. *
  5498. * _.isArguments(function() { return arguments; }());
  5499. * // => true
  5500. *
  5501. * _.isArguments([1, 2, 3]);
  5502. * // => false
  5503. */
  5504. function isArguments(value) {
  5505. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  5506. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  5507. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  5508. }
  5509. /**
  5510. * Checks if `value` is classified as an `Array` object.
  5511. *
  5512. * @static
  5513. * @memberOf _
  5514. * @since 0.1.0
  5515. * @category Lang
  5516. * @param {*} value The value to check.
  5517. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  5518. * @example
  5519. *
  5520. * _.isArray([1, 2, 3]);
  5521. * // => true
  5522. *
  5523. * _.isArray(document.body.children);
  5524. * // => false
  5525. *
  5526. * _.isArray('abc');
  5527. * // => false
  5528. *
  5529. * _.isArray(_.noop);
  5530. * // => false
  5531. */
  5532. var isArray = Array.isArray;
  5533. /**
  5534. * Checks if `value` is array-like. A value is considered array-like if it's
  5535. * not a function and has a `value.length` that's an integer greater than or
  5536. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  5537. *
  5538. * @static
  5539. * @memberOf _
  5540. * @since 4.0.0
  5541. * @category Lang
  5542. * @param {*} value The value to check.
  5543. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  5544. * @example
  5545. *
  5546. * _.isArrayLike([1, 2, 3]);
  5547. * // => true
  5548. *
  5549. * _.isArrayLike(document.body.children);
  5550. * // => true
  5551. *
  5552. * _.isArrayLike('abc');
  5553. * // => true
  5554. *
  5555. * _.isArrayLike(_.noop);
  5556. * // => false
  5557. */
  5558. function isArrayLike(value) {
  5559. return value != null && isLength(value.length) && !isFunction(value);
  5560. }
  5561. /**
  5562. * This method is like `_.isArrayLike` except that it also checks if `value`
  5563. * is an object.
  5564. *
  5565. * @static
  5566. * @memberOf _
  5567. * @since 4.0.0
  5568. * @category Lang
  5569. * @param {*} value The value to check.
  5570. * @returns {boolean} Returns `true` if `value` is an array-like object,
  5571. * else `false`.
  5572. * @example
  5573. *
  5574. * _.isArrayLikeObject([1, 2, 3]);
  5575. * // => true
  5576. *
  5577. * _.isArrayLikeObject(document.body.children);
  5578. * // => true
  5579. *
  5580. * _.isArrayLikeObject('abc');
  5581. * // => false
  5582. *
  5583. * _.isArrayLikeObject(_.noop);
  5584. * // => false
  5585. */
  5586. function isArrayLikeObject(value) {
  5587. return isObjectLike(value) && isArrayLike(value);
  5588. }
  5589. /**
  5590. * Checks if `value` is classified as a `Function` object.
  5591. *
  5592. * @static
  5593. * @memberOf _
  5594. * @since 0.1.0
  5595. * @category Lang
  5596. * @param {*} value The value to check.
  5597. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  5598. * @example
  5599. *
  5600. * _.isFunction(_);
  5601. * // => true
  5602. *
  5603. * _.isFunction(/abc/);
  5604. * // => false
  5605. */
  5606. function isFunction(value) {
  5607. // The use of `Object#toString` avoids issues with the `typeof` operator
  5608. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  5609. var tag = isObject(value) ? objectToString.call(value) : '';
  5610. return tag == funcTag || tag == genTag;
  5611. }
  5612. /**
  5613. * Checks if `value` is a valid array-like length.
  5614. *
  5615. * **Note:** This method is loosely based on
  5616. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  5617. *
  5618. * @static
  5619. * @memberOf _
  5620. * @since 4.0.0
  5621. * @category Lang
  5622. * @param {*} value The value to check.
  5623. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  5624. * @example
  5625. *
  5626. * _.isLength(3);
  5627. * // => true
  5628. *
  5629. * _.isLength(Number.MIN_VALUE);
  5630. * // => false
  5631. *
  5632. * _.isLength(Infinity);
  5633. * // => false
  5634. *
  5635. * _.isLength('3');
  5636. * // => false
  5637. */
  5638. function isLength(value) {
  5639. return typeof value == 'number' &&
  5640. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  5641. }
  5642. /**
  5643. * Checks if `value` is the
  5644. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  5645. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  5646. *
  5647. * @static
  5648. * @memberOf _
  5649. * @since 0.1.0
  5650. * @category Lang
  5651. * @param {*} value The value to check.
  5652. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  5653. * @example
  5654. *
  5655. * _.isObject({});
  5656. * // => true
  5657. *
  5658. * _.isObject([1, 2, 3]);
  5659. * // => true
  5660. *
  5661. * _.isObject(_.noop);
  5662. * // => true
  5663. *
  5664. * _.isObject(null);
  5665. * // => false
  5666. */
  5667. function isObject(value) {
  5668. var type = typeof value;
  5669. return !!value && (type == 'object' || type == 'function');
  5670. }
  5671. /**
  5672. * Checks if `value` is object-like. A value is object-like if it's not `null`
  5673. * and has a `typeof` result of "object".
  5674. *
  5675. * @static
  5676. * @memberOf _
  5677. * @since 4.0.0
  5678. * @category Lang
  5679. * @param {*} value The value to check.
  5680. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  5681. * @example
  5682. *
  5683. * _.isObjectLike({});
  5684. * // => true
  5685. *
  5686. * _.isObjectLike([1, 2, 3]);
  5687. * // => true
  5688. *
  5689. * _.isObjectLike(_.noop);
  5690. * // => false
  5691. *
  5692. * _.isObjectLike(null);
  5693. * // => false
  5694. */
  5695. function isObjectLike(value) {
  5696. return !!value && typeof value == 'object';
  5697. }
  5698. /**
  5699. * Checks if `value` is classified as a `Symbol` primitive or object.
  5700. *
  5701. * @static
  5702. * @memberOf _
  5703. * @since 4.0.0
  5704. * @category Lang
  5705. * @param {*} value The value to check.
  5706. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  5707. * @example
  5708. *
  5709. * _.isSymbol(Symbol.iterator);
  5710. * // => true
  5711. *
  5712. * _.isSymbol('abc');
  5713. * // => false
  5714. */
  5715. function isSymbol(value) {
  5716. return typeof value == 'symbol' ||
  5717. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  5718. }
  5719. /**
  5720. * Checks if `value` is classified as a typed array.
  5721. *
  5722. * @static
  5723. * @memberOf _
  5724. * @since 3.0.0
  5725. * @category Lang
  5726. * @param {*} value The value to check.
  5727. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  5728. * @example
  5729. *
  5730. * _.isTypedArray(new Uint8Array);
  5731. * // => true
  5732. *
  5733. * _.isTypedArray([]);
  5734. * // => false
  5735. */
  5736. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  5737. /**
  5738. * Converts `value` to a string. An empty string is returned for `null`
  5739. * and `undefined` values. The sign of `-0` is preserved.
  5740. *
  5741. * @static
  5742. * @memberOf _
  5743. * @since 4.0.0
  5744. * @category Lang
  5745. * @param {*} value The value to process.
  5746. * @returns {string} Returns the string.
  5747. * @example
  5748. *
  5749. * _.toString(null);
  5750. * // => ''
  5751. *
  5752. * _.toString(-0);
  5753. * // => '-0'
  5754. *
  5755. * _.toString([1, 2, 3]);
  5756. * // => '1,2,3'
  5757. */
  5758. function toString(value) {
  5759. return value == null ? '' : baseToString(value);
  5760. }
  5761. /**
  5762. * Gets the value at `path` of `object`. If the resolved value is
  5763. * `undefined`, the `defaultValue` is returned in its place.
  5764. *
  5765. * @static
  5766. * @memberOf _
  5767. * @since 3.7.0
  5768. * @category Object
  5769. * @param {Object} object The object to query.
  5770. * @param {Array|string} path The path of the property to get.
  5771. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  5772. * @returns {*} Returns the resolved value.
  5773. * @example
  5774. *
  5775. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  5776. *
  5777. * _.get(object, 'a[0].b.c');
  5778. * // => 3
  5779. *
  5780. * _.get(object, ['a', '0', 'b', 'c']);
  5781. * // => 3
  5782. *
  5783. * _.get(object, 'a.b.c', 'default');
  5784. * // => 'default'
  5785. */
  5786. function get(object, path, defaultValue) {
  5787. var result = object == null ? undefined : baseGet(object, path);
  5788. return result === undefined ? defaultValue : result;
  5789. }
  5790. /**
  5791. * Checks if `path` is a direct or inherited property of `object`.
  5792. *
  5793. * @static
  5794. * @memberOf _
  5795. * @since 4.0.0
  5796. * @category Object
  5797. * @param {Object} object The object to query.
  5798. * @param {Array|string} path The path to check.
  5799. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  5800. * @example
  5801. *
  5802. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  5803. *
  5804. * _.hasIn(object, 'a');
  5805. * // => true
  5806. *
  5807. * _.hasIn(object, 'a.b');
  5808. * // => true
  5809. *
  5810. * _.hasIn(object, ['a', 'b']);
  5811. * // => true
  5812. *
  5813. * _.hasIn(object, 'b');
  5814. * // => false
  5815. */
  5816. function hasIn(object, path) {
  5817. return object != null && hasPath(object, path, baseHasIn);
  5818. }
  5819. /**
  5820. * Creates an array of the own enumerable property names of `object`.
  5821. *
  5822. * **Note:** Non-object values are coerced to objects. See the
  5823. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  5824. * for more details.
  5825. *
  5826. * @static
  5827. * @since 0.1.0
  5828. * @memberOf _
  5829. * @category Object
  5830. * @param {Object} object The object to query.
  5831. * @returns {Array} Returns the array of property names.
  5832. * @example
  5833. *
  5834. * function Foo() {
  5835. * this.a = 1;
  5836. * this.b = 2;
  5837. * }
  5838. *
  5839. * Foo.prototype.c = 3;
  5840. *
  5841. * _.keys(new Foo);
  5842. * // => ['a', 'b'] (iteration order is not guaranteed)
  5843. *
  5844. * _.keys('hi');
  5845. * // => ['0', '1']
  5846. */
  5847. function keys(object) {
  5848. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  5849. }
  5850. /**
  5851. * This method returns the first argument it receives.
  5852. *
  5853. * @static
  5854. * @since 0.1.0
  5855. * @memberOf _
  5856. * @category Util
  5857. * @param {*} value Any value.
  5858. * @returns {*} Returns `value`.
  5859. * @example
  5860. *
  5861. * var object = { 'a': 1 };
  5862. *
  5863. * console.log(_.identity(object) === object);
  5864. * // => true
  5865. */
  5866. function identity(value) {
  5867. return value;
  5868. }
  5869. /**
  5870. * This method returns `undefined`.
  5871. *
  5872. * @static
  5873. * @memberOf _
  5874. * @since 2.3.0
  5875. * @category Util
  5876. * @example
  5877. *
  5878. * _.times(2, _.noop);
  5879. * // => [undefined, undefined]
  5880. */
  5881. function noop() {
  5882. // No operation performed.
  5883. }
  5884. /**
  5885. * Creates a function that returns the value at `path` of a given object.
  5886. *
  5887. * @static
  5888. * @memberOf _
  5889. * @since 2.4.0
  5890. * @category Util
  5891. * @param {Array|string} path The path of the property to get.
  5892. * @returns {Function} Returns the new accessor function.
  5893. * @example
  5894. *
  5895. * var objects = [
  5896. * { 'a': { 'b': 2 } },
  5897. * { 'a': { 'b': 1 } }
  5898. * ];
  5899. *
  5900. * _.map(objects, _.property('a.b'));
  5901. * // => [2, 1]
  5902. *
  5903. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  5904. * // => [1, 2]
  5905. */
  5906. function property(path) {
  5907. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  5908. }
  5909. module.exports = uniqBy;
  5910. /***/ }),
  5911. /***/ 107:
  5912. /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
  5913. (function (global, factory) {
  5914. true ? factory() :
  5915. 0;
  5916. }(this, (function () { 'use strict';
  5917. /**
  5918. * @this {Promise}
  5919. */
  5920. function finallyConstructor(callback) {
  5921. var constructor = this.constructor;
  5922. return this.then(
  5923. function(value) {
  5924. // @ts-ignore
  5925. return constructor.resolve(callback()).then(function() {
  5926. return value;
  5927. });
  5928. },
  5929. function(reason) {
  5930. // @ts-ignore
  5931. return constructor.resolve(callback()).then(function() {
  5932. // @ts-ignore
  5933. return constructor.reject(reason);
  5934. });
  5935. }
  5936. );
  5937. }
  5938. function allSettled(arr) {
  5939. var P = this;
  5940. return new P(function(resolve, reject) {
  5941. if (!(arr && typeof arr.length !== 'undefined')) {
  5942. return reject(
  5943. new TypeError(
  5944. typeof arr +
  5945. ' ' +
  5946. arr +
  5947. ' is not iterable(cannot read property Symbol(Symbol.iterator))'
  5948. )
  5949. );
  5950. }
  5951. var args = Array.prototype.slice.call(arr);
  5952. if (args.length === 0) return resolve([]);
  5953. var remaining = args.length;
  5954. function res(i, val) {
  5955. if (val && (typeof val === 'object' || typeof val === 'function')) {
  5956. var then = val.then;
  5957. if (typeof then === 'function') {
  5958. then.call(
  5959. val,
  5960. function(val) {
  5961. res(i, val);
  5962. },
  5963. function(e) {
  5964. args[i] = { status: 'rejected', reason: e };
  5965. if (--remaining === 0) {
  5966. resolve(args);
  5967. }
  5968. }
  5969. );
  5970. return;
  5971. }
  5972. }
  5973. args[i] = { status: 'fulfilled', value: val };
  5974. if (--remaining === 0) {
  5975. resolve(args);
  5976. }
  5977. }
  5978. for (var i = 0; i < args.length; i++) {
  5979. res(i, args[i]);
  5980. }
  5981. });
  5982. }
  5983. // Store setTimeout reference so promise-polyfill will be unaffected by
  5984. // other code modifying setTimeout (like sinon.useFakeTimers())
  5985. var setTimeoutFunc = setTimeout;
  5986. function isArray(x) {
  5987. return Boolean(x && typeof x.length !== 'undefined');
  5988. }
  5989. function noop() {}
  5990. // Polyfill for Function.prototype.bind
  5991. function bind(fn, thisArg) {
  5992. return function() {
  5993. fn.apply(thisArg, arguments);
  5994. };
  5995. }
  5996. /**
  5997. * @constructor
  5998. * @param {Function} fn
  5999. */
  6000. function Promise(fn) {
  6001. if (!(this instanceof Promise))
  6002. throw new TypeError('Promises must be constructed via new');
  6003. if (typeof fn !== 'function') throw new TypeError('not a function');
  6004. /** @type {!number} */
  6005. this._state = 0;
  6006. /** @type {!boolean} */
  6007. this._handled = false;
  6008. /** @type {Promise|undefined} */
  6009. this._value = undefined;
  6010. /** @type {!Array<!Function>} */
  6011. this._deferreds = [];
  6012. doResolve(fn, this);
  6013. }
  6014. function handle(self, deferred) {
  6015. while (self._state === 3) {
  6016. self = self._value;
  6017. }
  6018. if (self._state === 0) {
  6019. self._deferreds.push(deferred);
  6020. return;
  6021. }
  6022. self._handled = true;
  6023. Promise._immediateFn(function() {
  6024. var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
  6025. if (cb === null) {
  6026. (self._state === 1 ? resolve : reject)(deferred.promise, self._value);
  6027. return;
  6028. }
  6029. var ret;
  6030. try {
  6031. ret = cb(self._value);
  6032. } catch (e) {
  6033. reject(deferred.promise, e);
  6034. return;
  6035. }
  6036. resolve(deferred.promise, ret);
  6037. });
  6038. }
  6039. function resolve(self, newValue) {
  6040. try {
  6041. // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
  6042. if (newValue === self)
  6043. throw new TypeError('A promise cannot be resolved with itself.');
  6044. if (
  6045. newValue &&
  6046. (typeof newValue === 'object' || typeof newValue === 'function')
  6047. ) {
  6048. var then = newValue.then;
  6049. if (newValue instanceof Promise) {
  6050. self._state = 3;
  6051. self._value = newValue;
  6052. finale(self);
  6053. return;
  6054. } else if (typeof then === 'function') {
  6055. doResolve(bind(then, newValue), self);
  6056. return;
  6057. }
  6058. }
  6059. self._state = 1;
  6060. self._value = newValue;
  6061. finale(self);
  6062. } catch (e) {
  6063. reject(self, e);
  6064. }
  6065. }
  6066. function reject(self, newValue) {
  6067. self._state = 2;
  6068. self._value = newValue;
  6069. finale(self);
  6070. }
  6071. function finale(self) {
  6072. if (self._state === 2 && self._deferreds.length === 0) {
  6073. Promise._immediateFn(function() {
  6074. if (!self._handled) {
  6075. Promise._unhandledRejectionFn(self._value);
  6076. }
  6077. });
  6078. }
  6079. for (var i = 0, len = self._deferreds.length; i < len; i++) {
  6080. handle(self, self._deferreds[i]);
  6081. }
  6082. self._deferreds = null;
  6083. }
  6084. /**
  6085. * @constructor
  6086. */
  6087. function Handler(onFulfilled, onRejected, promise) {
  6088. this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
  6089. this.onRejected = typeof onRejected === 'function' ? onRejected : null;
  6090. this.promise = promise;
  6091. }
  6092. /**
  6093. * Take a potentially misbehaving resolver function and make sure
  6094. * onFulfilled and onRejected are only called once.
  6095. *
  6096. * Makes no guarantees about asynchrony.
  6097. */
  6098. function doResolve(fn, self) {
  6099. var done = false;
  6100. try {
  6101. fn(
  6102. function(value) {
  6103. if (done) return;
  6104. done = true;
  6105. resolve(self, value);
  6106. },
  6107. function(reason) {
  6108. if (done) return;
  6109. done = true;
  6110. reject(self, reason);
  6111. }
  6112. );
  6113. } catch (ex) {
  6114. if (done) return;
  6115. done = true;
  6116. reject(self, ex);
  6117. }
  6118. }
  6119. Promise.prototype['catch'] = function(onRejected) {
  6120. return this.then(null, onRejected);
  6121. };
  6122. Promise.prototype.then = function(onFulfilled, onRejected) {
  6123. // @ts-ignore
  6124. var prom = new this.constructor(noop);
  6125. handle(this, new Handler(onFulfilled, onRejected, prom));
  6126. return prom;
  6127. };
  6128. Promise.prototype['finally'] = finallyConstructor;
  6129. Promise.all = function(arr) {
  6130. return new Promise(function(resolve, reject) {
  6131. if (!isArray(arr)) {
  6132. return reject(new TypeError('Promise.all accepts an array'));
  6133. }
  6134. var args = Array.prototype.slice.call(arr);
  6135. if (args.length === 0) return resolve([]);
  6136. var remaining = args.length;
  6137. function res(i, val) {
  6138. try {
  6139. if (val && (typeof val === 'object' || typeof val === 'function')) {
  6140. var then = val.then;
  6141. if (typeof then === 'function') {
  6142. then.call(
  6143. val,
  6144. function(val) {
  6145. res(i, val);
  6146. },
  6147. reject
  6148. );
  6149. return;
  6150. }
  6151. }
  6152. args[i] = val;
  6153. if (--remaining === 0) {
  6154. resolve(args);
  6155. }
  6156. } catch (ex) {
  6157. reject(ex);
  6158. }
  6159. }
  6160. for (var i = 0; i < args.length; i++) {
  6161. res(i, args[i]);
  6162. }
  6163. });
  6164. };
  6165. Promise.allSettled = allSettled;
  6166. Promise.resolve = function(value) {
  6167. if (value && typeof value === 'object' && value.constructor === Promise) {
  6168. return value;
  6169. }
  6170. return new Promise(function(resolve) {
  6171. resolve(value);
  6172. });
  6173. };
  6174. Promise.reject = function(value) {
  6175. return new Promise(function(resolve, reject) {
  6176. reject(value);
  6177. });
  6178. };
  6179. Promise.race = function(arr) {
  6180. return new Promise(function(resolve, reject) {
  6181. if (!isArray(arr)) {
  6182. return reject(new TypeError('Promise.race accepts an array'));
  6183. }
  6184. for (var i = 0, len = arr.length; i < len; i++) {
  6185. Promise.resolve(arr[i]).then(resolve, reject);
  6186. }
  6187. });
  6188. };
  6189. // Use polyfill for setImmediate for performance gains
  6190. Promise._immediateFn =
  6191. // @ts-ignore
  6192. (typeof setImmediate === 'function' &&
  6193. function(fn) {
  6194. // @ts-ignore
  6195. setImmediate(fn);
  6196. }) ||
  6197. function(fn) {
  6198. setTimeoutFunc(fn, 0);
  6199. };
  6200. Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
  6201. if (typeof console !== 'undefined' && console) {
  6202. console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
  6203. }
  6204. };
  6205. /** @suppress {undefinedVars} */
  6206. var globalNS = (function() {
  6207. // the only reliable means to get the global object is
  6208. // `Function('return this')()`
  6209. // However, this causes CSP violations in Chrome apps.
  6210. if (typeof self !== 'undefined') {
  6211. return self;
  6212. }
  6213. if (typeof window !== 'undefined') {
  6214. return window;
  6215. }
  6216. if (typeof __webpack_require__.g !== 'undefined') {
  6217. return __webpack_require__.g;
  6218. }
  6219. throw new Error('unable to locate global object');
  6220. })();
  6221. // Expose the polyfill if Promise is undefined or set to a
  6222. // non-function value. The latter can be due to a named HTMLElement
  6223. // being exposed by browsers for legacy reasons.
  6224. // https://github.com/taylorhakes/promise-polyfill/issues/114
  6225. if (typeof globalNS['Promise'] !== 'function') {
  6226. globalNS['Promise'] = Promise;
  6227. } else {
  6228. if (!globalNS.Promise.prototype['finally']) {
  6229. globalNS.Promise.prototype['finally'] = finallyConstructor;
  6230. }
  6231. if (!globalNS.Promise.allSettled) {
  6232. globalNS.Promise.allSettled = allSettled;
  6233. }
  6234. }
  6235. })));
  6236. /***/ }),
  6237. /***/ 166:
  6238. /***/ (function(module) {
  6239. (function (global, factory) {
  6240. true ? module.exports = factory() :
  6241. 0;
  6242. }(this, (function () { 'use strict';
  6243. function quickselect(arr, k, left, right, compare) {
  6244. quickselectStep(arr, k, left || 0, right || (arr.length - 1), compare || defaultCompare);
  6245. }
  6246. function quickselectStep(arr, k, left, right, compare) {
  6247. while (right > left) {
  6248. if (right - left > 600) {
  6249. var n = right - left + 1;
  6250. var m = k - left + 1;
  6251. var z = Math.log(n);
  6252. var s = 0.5 * Math.exp(2 * z / 3);
  6253. var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
  6254. var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
  6255. var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
  6256. quickselectStep(arr, k, newLeft, newRight, compare);
  6257. }
  6258. var t = arr[k];
  6259. var i = left;
  6260. var j = right;
  6261. swap(arr, left, k);
  6262. if (compare(arr[right], t) > 0) swap(arr, left, right);
  6263. while (i < j) {
  6264. swap(arr, i, j);
  6265. i++;
  6266. j--;
  6267. while (compare(arr[i], t) < 0) i++;
  6268. while (compare(arr[j], t) > 0) j--;
  6269. }
  6270. if (compare(arr[left], t) === 0) swap(arr, left, j);
  6271. else {
  6272. j++;
  6273. swap(arr, j, right);
  6274. }
  6275. if (j <= k) left = j + 1;
  6276. if (k <= j) right = j - 1;
  6277. }
  6278. }
  6279. function swap(arr, i, j) {
  6280. var tmp = arr[i];
  6281. arr[i] = arr[j];
  6282. arr[j] = tmp;
  6283. }
  6284. function defaultCompare(a, b) {
  6285. return a < b ? -1 : a > b ? 1 : 0;
  6286. }
  6287. return quickselect;
  6288. })));
  6289. /***/ }),
  6290. /***/ 510:
  6291. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  6292. "use strict";
  6293. module.exports = rbush;
  6294. module.exports["default"] = rbush;
  6295. var quickselect = __webpack_require__(166);
  6296. function rbush(maxEntries, format) {
  6297. if (!(this instanceof rbush)) return new rbush(maxEntries, format);
  6298. // max entries in a node is 9 by default; min node fill is 40% for best performance
  6299. this._maxEntries = Math.max(4, maxEntries || 9);
  6300. this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
  6301. if (format) {
  6302. this._initFormat(format);
  6303. }
  6304. this.clear();
  6305. }
  6306. rbush.prototype = {
  6307. all: function () {
  6308. return this._all(this.data, []);
  6309. },
  6310. search: function (bbox) {
  6311. var node = this.data,
  6312. result = [],
  6313. toBBox = this.toBBox;
  6314. if (!intersects(bbox, node)) return result;
  6315. var nodesToSearch = [],
  6316. i, len, child, childBBox;
  6317. while (node) {
  6318. for (i = 0, len = node.children.length; i < len; i++) {
  6319. child = node.children[i];
  6320. childBBox = node.leaf ? toBBox(child) : child;
  6321. if (intersects(bbox, childBBox)) {
  6322. if (node.leaf) result.push(child);
  6323. else if (contains(bbox, childBBox)) this._all(child, result);
  6324. else nodesToSearch.push(child);
  6325. }
  6326. }
  6327. node = nodesToSearch.pop();
  6328. }
  6329. return result;
  6330. },
  6331. collides: function (bbox) {
  6332. var node = this.data,
  6333. toBBox = this.toBBox;
  6334. if (!intersects(bbox, node)) return false;
  6335. var nodesToSearch = [],
  6336. i, len, child, childBBox;
  6337. while (node) {
  6338. for (i = 0, len = node.children.length; i < len; i++) {
  6339. child = node.children[i];
  6340. childBBox = node.leaf ? toBBox(child) : child;
  6341. if (intersects(bbox, childBBox)) {
  6342. if (node.leaf || contains(bbox, childBBox)) return true;
  6343. nodesToSearch.push(child);
  6344. }
  6345. }
  6346. node = nodesToSearch.pop();
  6347. }
  6348. return false;
  6349. },
  6350. load: function (data) {
  6351. if (!(data && data.length)) return this;
  6352. if (data.length < this._minEntries) {
  6353. for (var i = 0, len = data.length; i < len; i++) {
  6354. this.insert(data[i]);
  6355. }
  6356. return this;
  6357. }
  6358. // recursively build the tree with the given data from scratch using OMT algorithm
  6359. var node = this._build(data.slice(), 0, data.length - 1, 0);
  6360. if (!this.data.children.length) {
  6361. // save as is if tree is empty
  6362. this.data = node;
  6363. } else if (this.data.height === node.height) {
  6364. // split root if trees have the same height
  6365. this._splitRoot(this.data, node);
  6366. } else {
  6367. if (this.data.height < node.height) {
  6368. // swap trees if inserted one is bigger
  6369. var tmpNode = this.data;
  6370. this.data = node;
  6371. node = tmpNode;
  6372. }
  6373. // insert the small tree into the large tree at appropriate level
  6374. this._insert(node, this.data.height - node.height - 1, true);
  6375. }
  6376. return this;
  6377. },
  6378. insert: function (item) {
  6379. if (item) this._insert(item, this.data.height - 1);
  6380. return this;
  6381. },
  6382. clear: function () {
  6383. this.data = createNode([]);
  6384. return this;
  6385. },
  6386. remove: function (item, equalsFn) {
  6387. if (!item) return this;
  6388. var node = this.data,
  6389. bbox = this.toBBox(item),
  6390. path = [],
  6391. indexes = [],
  6392. i, parent, index, goingUp;
  6393. // depth-first iterative tree traversal
  6394. while (node || path.length) {
  6395. if (!node) { // go up
  6396. node = path.pop();
  6397. parent = path[path.length - 1];
  6398. i = indexes.pop();
  6399. goingUp = true;
  6400. }
  6401. if (node.leaf) { // check current node
  6402. index = findItem(item, node.children, equalsFn);
  6403. if (index !== -1) {
  6404. // item found, remove the item and condense tree upwards
  6405. node.children.splice(index, 1);
  6406. path.push(node);
  6407. this._condense(path);
  6408. return this;
  6409. }
  6410. }
  6411. if (!goingUp && !node.leaf && contains(node, bbox)) { // go down
  6412. path.push(node);
  6413. indexes.push(i);
  6414. i = 0;
  6415. parent = node;
  6416. node = node.children[0];
  6417. } else if (parent) { // go right
  6418. i++;
  6419. node = parent.children[i];
  6420. goingUp = false;
  6421. } else node = null; // nothing found
  6422. }
  6423. return this;
  6424. },
  6425. toBBox: function (item) { return item; },
  6426. compareMinX: compareNodeMinX,
  6427. compareMinY: compareNodeMinY,
  6428. toJSON: function () { return this.data; },
  6429. fromJSON: function (data) {
  6430. this.data = data;
  6431. return this;
  6432. },
  6433. _all: function (node, result) {
  6434. var nodesToSearch = [];
  6435. while (node) {
  6436. if (node.leaf) result.push.apply(result, node.children);
  6437. else nodesToSearch.push.apply(nodesToSearch, node.children);
  6438. node = nodesToSearch.pop();
  6439. }
  6440. return result;
  6441. },
  6442. _build: function (items, left, right, height) {
  6443. var N = right - left + 1,
  6444. M = this._maxEntries,
  6445. node;
  6446. if (N <= M) {
  6447. // reached leaf level; return leaf
  6448. node = createNode(items.slice(left, right + 1));
  6449. calcBBox(node, this.toBBox);
  6450. return node;
  6451. }
  6452. if (!height) {
  6453. // target height of the bulk-loaded tree
  6454. height = Math.ceil(Math.log(N) / Math.log(M));
  6455. // target number of root entries to maximize storage utilization
  6456. M = Math.ceil(N / Math.pow(M, height - 1));
  6457. }
  6458. node = createNode([]);
  6459. node.leaf = false;
  6460. node.height = height;
  6461. // split the items into M mostly square tiles
  6462. var N2 = Math.ceil(N / M),
  6463. N1 = N2 * Math.ceil(Math.sqrt(M)),
  6464. i, j, right2, right3;
  6465. multiSelect(items, left, right, N1, this.compareMinX);
  6466. for (i = left; i <= right; i += N1) {
  6467. right2 = Math.min(i + N1 - 1, right);
  6468. multiSelect(items, i, right2, N2, this.compareMinY);
  6469. for (j = i; j <= right2; j += N2) {
  6470. right3 = Math.min(j + N2 - 1, right2);
  6471. // pack each entry recursively
  6472. node.children.push(this._build(items, j, right3, height - 1));
  6473. }
  6474. }
  6475. calcBBox(node, this.toBBox);
  6476. return node;
  6477. },
  6478. _chooseSubtree: function (bbox, node, level, path) {
  6479. var i, len, child, targetNode, area, enlargement, minArea, minEnlargement;
  6480. while (true) {
  6481. path.push(node);
  6482. if (node.leaf || path.length - 1 === level) break;
  6483. minArea = minEnlargement = Infinity;
  6484. for (i = 0, len = node.children.length; i < len; i++) {
  6485. child = node.children[i];
  6486. area = bboxArea(child);
  6487. enlargement = enlargedArea(bbox, child) - area;
  6488. // choose entry with the least area enlargement
  6489. if (enlargement < minEnlargement) {
  6490. minEnlargement = enlargement;
  6491. minArea = area < minArea ? area : minArea;
  6492. targetNode = child;
  6493. } else if (enlargement === minEnlargement) {
  6494. // otherwise choose one with the smallest area
  6495. if (area < minArea) {
  6496. minArea = area;
  6497. targetNode = child;
  6498. }
  6499. }
  6500. }
  6501. node = targetNode || node.children[0];
  6502. }
  6503. return node;
  6504. },
  6505. _insert: function (item, level, isNode) {
  6506. var toBBox = this.toBBox,
  6507. bbox = isNode ? item : toBBox(item),
  6508. insertPath = [];
  6509. // find the best node for accommodating the item, saving all nodes along the path too
  6510. var node = this._chooseSubtree(bbox, this.data, level, insertPath);
  6511. // put the item into the node
  6512. node.children.push(item);
  6513. extend(node, bbox);
  6514. // split on node overflow; propagate upwards if necessary
  6515. while (level >= 0) {
  6516. if (insertPath[level].children.length > this._maxEntries) {
  6517. this._split(insertPath, level);
  6518. level--;
  6519. } else break;
  6520. }
  6521. // adjust bboxes along the insertion path
  6522. this._adjustParentBBoxes(bbox, insertPath, level);
  6523. },
  6524. // split overflowed node into two
  6525. _split: function (insertPath, level) {
  6526. var node = insertPath[level],
  6527. M = node.children.length,
  6528. m = this._minEntries;
  6529. this._chooseSplitAxis(node, m, M);
  6530. var splitIndex = this._chooseSplitIndex(node, m, M);
  6531. var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
  6532. newNode.height = node.height;
  6533. newNode.leaf = node.leaf;
  6534. calcBBox(node, this.toBBox);
  6535. calcBBox(newNode, this.toBBox);
  6536. if (level) insertPath[level - 1].children.push(newNode);
  6537. else this._splitRoot(node, newNode);
  6538. },
  6539. _splitRoot: function (node, newNode) {
  6540. // split root node
  6541. this.data = createNode([node, newNode]);
  6542. this.data.height = node.height + 1;
  6543. this.data.leaf = false;
  6544. calcBBox(this.data, this.toBBox);
  6545. },
  6546. _chooseSplitIndex: function (node, m, M) {
  6547. var i, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
  6548. minOverlap = minArea = Infinity;
  6549. for (i = m; i <= M - m; i++) {
  6550. bbox1 = distBBox(node, 0, i, this.toBBox);
  6551. bbox2 = distBBox(node, i, M, this.toBBox);
  6552. overlap = intersectionArea(bbox1, bbox2);
  6553. area = bboxArea(bbox1) + bboxArea(bbox2);
  6554. // choose distribution with minimum overlap
  6555. if (overlap < minOverlap) {
  6556. minOverlap = overlap;
  6557. index = i;
  6558. minArea = area < minArea ? area : minArea;
  6559. } else if (overlap === minOverlap) {
  6560. // otherwise choose distribution with minimum area
  6561. if (area < minArea) {
  6562. minArea = area;
  6563. index = i;
  6564. }
  6565. }
  6566. }
  6567. return index;
  6568. },
  6569. // sorts node children by the best axis for split
  6570. _chooseSplitAxis: function (node, m, M) {
  6571. var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX,
  6572. compareMinY = node.leaf ? this.compareMinY : compareNodeMinY,
  6573. xMargin = this._allDistMargin(node, m, M, compareMinX),
  6574. yMargin = this._allDistMargin(node, m, M, compareMinY);
  6575. // if total distributions margin value is minimal for x, sort by minX,
  6576. // otherwise it's already sorted by minY
  6577. if (xMargin < yMargin) node.children.sort(compareMinX);
  6578. },
  6579. // total margin of all possible split distributions where each node is at least m full
  6580. _allDistMargin: function (node, m, M, compare) {
  6581. node.children.sort(compare);
  6582. var toBBox = this.toBBox,
  6583. leftBBox = distBBox(node, 0, m, toBBox),
  6584. rightBBox = distBBox(node, M - m, M, toBBox),
  6585. margin = bboxMargin(leftBBox) + bboxMargin(rightBBox),
  6586. i, child;
  6587. for (i = m; i < M - m; i++) {
  6588. child = node.children[i];
  6589. extend(leftBBox, node.leaf ? toBBox(child) : child);
  6590. margin += bboxMargin(leftBBox);
  6591. }
  6592. for (i = M - m - 1; i >= m; i--) {
  6593. child = node.children[i];
  6594. extend(rightBBox, node.leaf ? toBBox(child) : child);
  6595. margin += bboxMargin(rightBBox);
  6596. }
  6597. return margin;
  6598. },
  6599. _adjustParentBBoxes: function (bbox, path, level) {
  6600. // adjust bboxes along the given tree path
  6601. for (var i = level; i >= 0; i--) {
  6602. extend(path[i], bbox);
  6603. }
  6604. },
  6605. _condense: function (path) {
  6606. // go through the path, removing empty nodes and updating bboxes
  6607. for (var i = path.length - 1, siblings; i >= 0; i--) {
  6608. if (path[i].children.length === 0) {
  6609. if (i > 0) {
  6610. siblings = path[i - 1].children;
  6611. siblings.splice(siblings.indexOf(path[i]), 1);
  6612. } else this.clear();
  6613. } else calcBBox(path[i], this.toBBox);
  6614. }
  6615. },
  6616. _initFormat: function (format) {
  6617. // data format (minX, minY, maxX, maxY accessors)
  6618. // uses eval-type function compilation instead of just accepting a toBBox function
  6619. // because the algorithms are very sensitive to sorting functions performance,
  6620. // so they should be dead simple and without inner calls
  6621. var compareArr = ['return a', ' - b', ';'];
  6622. this.compareMinX = new Function('a', 'b', compareArr.join(format[0]));
  6623. this.compareMinY = new Function('a', 'b', compareArr.join(format[1]));
  6624. this.toBBox = new Function('a',
  6625. 'return {minX: a' + format[0] +
  6626. ', minY: a' + format[1] +
  6627. ', maxX: a' + format[2] +
  6628. ', maxY: a' + format[3] + '};');
  6629. }
  6630. };
  6631. function findItem(item, items, equalsFn) {
  6632. if (!equalsFn) return items.indexOf(item);
  6633. for (var i = 0; i < items.length; i++) {
  6634. if (equalsFn(item, items[i])) return i;
  6635. }
  6636. return -1;
  6637. }
  6638. // calculate node's bbox from bboxes of its children
  6639. function calcBBox(node, toBBox) {
  6640. distBBox(node, 0, node.children.length, toBBox, node);
  6641. }
  6642. // min bounding rectangle of node children from k to p-1
  6643. function distBBox(node, k, p, toBBox, destNode) {
  6644. if (!destNode) destNode = createNode(null);
  6645. destNode.minX = Infinity;
  6646. destNode.minY = Infinity;
  6647. destNode.maxX = -Infinity;
  6648. destNode.maxY = -Infinity;
  6649. for (var i = k, child; i < p; i++) {
  6650. child = node.children[i];
  6651. extend(destNode, node.leaf ? toBBox(child) : child);
  6652. }
  6653. return destNode;
  6654. }
  6655. function extend(a, b) {
  6656. a.minX = Math.min(a.minX, b.minX);
  6657. a.minY = Math.min(a.minY, b.minY);
  6658. a.maxX = Math.max(a.maxX, b.maxX);
  6659. a.maxY = Math.max(a.maxY, b.maxY);
  6660. return a;
  6661. }
  6662. function compareNodeMinX(a, b) { return a.minX - b.minX; }
  6663. function compareNodeMinY(a, b) { return a.minY - b.minY; }
  6664. function bboxArea(a) { return (a.maxX - a.minX) * (a.maxY - a.minY); }
  6665. function bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); }
  6666. function enlargedArea(a, b) {
  6667. return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) *
  6668. (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));
  6669. }
  6670. function intersectionArea(a, b) {
  6671. var minX = Math.max(a.minX, b.minX),
  6672. minY = Math.max(a.minY, b.minY),
  6673. maxX = Math.min(a.maxX, b.maxX),
  6674. maxY = Math.min(a.maxY, b.maxY);
  6675. return Math.max(0, maxX - minX) *
  6676. Math.max(0, maxY - minY);
  6677. }
  6678. function contains(a, b) {
  6679. return a.minX <= b.minX &&
  6680. a.minY <= b.minY &&
  6681. b.maxX <= a.maxX &&
  6682. b.maxY <= a.maxY;
  6683. }
  6684. function intersects(a, b) {
  6685. return b.minX <= a.maxX &&
  6686. b.minY <= a.maxY &&
  6687. b.maxX >= a.minX &&
  6688. b.maxY >= a.minY;
  6689. }
  6690. function createNode(children) {
  6691. return {
  6692. children: children,
  6693. height: 1,
  6694. leaf: true,
  6695. minX: Infinity,
  6696. minY: Infinity,
  6697. maxX: -Infinity,
  6698. maxY: -Infinity
  6699. };
  6700. }
  6701. // sort an array so that items come in groups of n unsorted items, with groups sorted between each other;
  6702. // combines selection algorithm with binary divide & conquer approach
  6703. function multiSelect(arr, left, right, n, compare) {
  6704. var stack = [left, right],
  6705. mid;
  6706. while (stack.length) {
  6707. right = stack.pop();
  6708. left = stack.pop();
  6709. if (right - left <= n) continue;
  6710. mid = left + Math.ceil((right - left) / n / 2) * n;
  6711. quickselect(arr, mid, left, right, compare);
  6712. stack.push(left, mid, mid, right);
  6713. }
  6714. }
  6715. /***/ }),
  6716. /***/ 901:
  6717. /***/ (function(module) {
  6718. // https://github.com/mbostock/slice-source Version 0.4.1. Copyright 2016 Mike Bostock.
  6719. (function (global, factory) {
  6720. true ? module.exports = factory() :
  6721. 0;
  6722. }(this, (function () { 'use strict';
  6723. var empty = new Uint8Array(0);
  6724. function slice_cancel() {
  6725. return this._source.cancel();
  6726. }
  6727. function concat(a, b) {
  6728. if (!a.length) return b;
  6729. if (!b.length) return a;
  6730. var c = new Uint8Array(a.length + b.length);
  6731. c.set(a);
  6732. c.set(b, a.length);
  6733. return c;
  6734. }
  6735. function slice_read() {
  6736. var that = this, array = that._array.subarray(that._index);
  6737. return that._source.read().then(function(result) {
  6738. that._array = empty;
  6739. that._index = 0;
  6740. return result.done ? (array.length > 0
  6741. ? {done: false, value: array}
  6742. : {done: true, value: undefined})
  6743. : {done: false, value: concat(array, result.value)};
  6744. });
  6745. }
  6746. function slice_slice(length) {
  6747. if ((length |= 0) < 0) throw new Error("invalid length");
  6748. var that = this, index = this._array.length - this._index;
  6749. // If the request fits within the remaining buffer, resolve it immediately.
  6750. if (this._index + length <= this._array.length) {
  6751. return Promise.resolve(this._array.subarray(this._index, this._index += length));
  6752. }
  6753. // Otherwise, read chunks repeatedly until the request is fulfilled.
  6754. var array = new Uint8Array(length);
  6755. array.set(this._array.subarray(this._index));
  6756. return (function read() {
  6757. return that._source.read().then(function(result) {
  6758. // When done, it’s possible the request wasn’t fully fullfilled!
  6759. // If so, the pre-allocated array is too big and needs slicing.
  6760. if (result.done) {
  6761. that._array = empty;
  6762. that._index = 0;
  6763. return index > 0 ? array.subarray(0, index) : null;
  6764. }
  6765. // If this chunk fulfills the request, return the resulting array.
  6766. if (index + result.value.length >= length) {
  6767. that._array = result.value;
  6768. that._index = length - index;
  6769. array.set(result.value.subarray(0, length - index), index);
  6770. return array;
  6771. }
  6772. // Otherwise copy this chunk into the array, then read the next chunk.
  6773. array.set(result.value, index);
  6774. index += result.value.length;
  6775. return read();
  6776. });
  6777. })();
  6778. }
  6779. function slice(source) {
  6780. return typeof source.slice === "function" ? source :
  6781. new SliceSource(typeof source.read === "function" ? source
  6782. : source.getReader());
  6783. }
  6784. function SliceSource(source) {
  6785. this._source = source;
  6786. this._array = empty;
  6787. this._index = 0;
  6788. }
  6789. SliceSource.prototype.read = slice_read;
  6790. SliceSource.prototype.slice = slice_slice;
  6791. SliceSource.prototype.cancel = slice_cancel;
  6792. return slice;
  6793. })));
  6794. /***/ }),
  6795. /***/ 982:
  6796. /***/ ((__unused_webpack_module, exports) => {
  6797. "use strict";
  6798. var __webpack_unused_export__;
  6799. __webpack_unused_export__ = ({ value: true });
  6800. /*! *****************************************************************************
  6801. Copyright (c) Microsoft Corporation.
  6802. Permission to use, copy, modify, and/or distribute this software for any
  6803. purpose with or without fee is hereby granted.
  6804. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  6805. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  6806. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  6807. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  6808. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  6809. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  6810. PERFORMANCE OF THIS SOFTWARE.
  6811. ***************************************************************************** */
  6812. /* global Reflect, Promise */
  6813. var extendStatics = function(d, b) {
  6814. extendStatics = Object.setPrototypeOf ||
  6815. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6816. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6817. return extendStatics(d, b);
  6818. };
  6819. function __extends(d, b) {
  6820. extendStatics(d, b);
  6821. function __() { this.constructor = d; }
  6822. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6823. }
  6824. function __awaiter(thisArg, _arguments, P, generator) {
  6825. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  6826. return new (P || (P = Promise))(function (resolve, reject) {
  6827. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  6828. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  6829. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  6830. step((generator = generator.apply(thisArg, _arguments || [])).next());
  6831. });
  6832. }
  6833. function __generator(thisArg, body) {
  6834. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  6835. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  6836. function verb(n) { return function (v) { return step([n, v]); }; }
  6837. function step(op) {
  6838. if (f) throw new TypeError("Generator is already executing.");
  6839. while (_) try {
  6840. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  6841. if (y = 0, t) op = [op[0] & 2, t.value];
  6842. switch (op[0]) {
  6843. case 0: case 1: t = op; break;
  6844. case 4: _.label++; return { value: op[1], done: false };
  6845. case 5: _.label++; y = op[1]; op = [0]; continue;
  6846. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  6847. default:
  6848. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  6849. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  6850. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  6851. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  6852. if (t[2]) _.ops.pop();
  6853. _.trys.pop(); continue;
  6854. }
  6855. op = body.call(thisArg, _);
  6856. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  6857. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  6858. }
  6859. }
  6860. function __values(o) {
  6861. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  6862. if (m) return m.call(o);
  6863. if (o && typeof o.length === "number") return {
  6864. next: function () {
  6865. if (o && i >= o.length) o = void 0;
  6866. return { value: o && o[i++], done: !o };
  6867. }
  6868. };
  6869. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  6870. }
  6871. function __await(v) {
  6872. return this instanceof __await ? (this.v = v, this) : new __await(v);
  6873. }
  6874. function __asyncGenerator(thisArg, _arguments, generator) {
  6875. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  6876. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  6877. return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
  6878. function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
  6879. function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
  6880. function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
  6881. function fulfill(value) { resume("next", value); }
  6882. function reject(value) { resume("throw", value); }
  6883. function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  6884. }
  6885. /** An error subclass which is thrown when there are too many pending push or next operations on a single repeater. */
  6886. var RepeaterOverflowError = /** @class */ (function (_super) {
  6887. __extends(RepeaterOverflowError, _super);
  6888. function RepeaterOverflowError(message) {
  6889. var _this = _super.call(this, message) || this;
  6890. Object.defineProperty(_this, "name", {
  6891. value: "RepeaterOverflowError",
  6892. enumerable: false,
  6893. });
  6894. if (typeof Object.setPrototypeOf === "function") {
  6895. Object.setPrototypeOf(_this, _this.constructor.prototype);
  6896. }
  6897. else {
  6898. _this.__proto__ = _this.constructor.prototype;
  6899. }
  6900. if (typeof Error.captureStackTrace === "function") {
  6901. Error.captureStackTrace(_this, _this.constructor);
  6902. }
  6903. return _this;
  6904. }
  6905. return RepeaterOverflowError;
  6906. }(Error));
  6907. /** A buffer which allows you to push a set amount of values to the repeater without pushes waiting or throwing errors. */
  6908. var FixedBuffer = /** @class */ (function () {
  6909. function FixedBuffer(capacity) {
  6910. if (capacity < 0) {
  6911. throw new RangeError("Capacity may not be less than 0");
  6912. }
  6913. this._c = capacity;
  6914. this._q = [];
  6915. }
  6916. Object.defineProperty(FixedBuffer.prototype, "empty", {
  6917. get: function () {
  6918. return this._q.length === 0;
  6919. },
  6920. enumerable: false,
  6921. configurable: true
  6922. });
  6923. Object.defineProperty(FixedBuffer.prototype, "full", {
  6924. get: function () {
  6925. return this._q.length >= this._c;
  6926. },
  6927. enumerable: false,
  6928. configurable: true
  6929. });
  6930. FixedBuffer.prototype.add = function (value) {
  6931. if (this.full) {
  6932. throw new Error("Buffer full");
  6933. }
  6934. else {
  6935. this._q.push(value);
  6936. }
  6937. };
  6938. FixedBuffer.prototype.remove = function () {
  6939. if (this.empty) {
  6940. throw new Error("Buffer empty");
  6941. }
  6942. return this._q.shift();
  6943. };
  6944. return FixedBuffer;
  6945. }());
  6946. // TODO: Use a circular buffer here.
  6947. /** Sliding buffers allow you to push a set amount of values to the repeater without pushes waiting or throwing errors. If the number of values exceeds the capacity set in the constructor, the buffer will discard the earliest values added. */
  6948. var SlidingBuffer = /** @class */ (function () {
  6949. function SlidingBuffer(capacity) {
  6950. if (capacity < 1) {
  6951. throw new RangeError("Capacity may not be less than 1");
  6952. }
  6953. this._c = capacity;
  6954. this._q = [];
  6955. }
  6956. Object.defineProperty(SlidingBuffer.prototype, "empty", {
  6957. get: function () {
  6958. return this._q.length === 0;
  6959. },
  6960. enumerable: false,
  6961. configurable: true
  6962. });
  6963. Object.defineProperty(SlidingBuffer.prototype, "full", {
  6964. get: function () {
  6965. return false;
  6966. },
  6967. enumerable: false,
  6968. configurable: true
  6969. });
  6970. SlidingBuffer.prototype.add = function (value) {
  6971. while (this._q.length >= this._c) {
  6972. this._q.shift();
  6973. }
  6974. this._q.push(value);
  6975. };
  6976. SlidingBuffer.prototype.remove = function () {
  6977. if (this.empty) {
  6978. throw new Error("Buffer empty");
  6979. }
  6980. return this._q.shift();
  6981. };
  6982. return SlidingBuffer;
  6983. }());
  6984. /** Dropping buffers allow you to push a set amount of values to the repeater without the push function waiting or throwing errors. If the number of values exceeds the capacity set in the constructor, the buffer will discard the latest values added. */
  6985. var DroppingBuffer = /** @class */ (function () {
  6986. function DroppingBuffer(capacity) {
  6987. if (capacity < 1) {
  6988. throw new RangeError("Capacity may not be less than 1");
  6989. }
  6990. this._c = capacity;
  6991. this._q = [];
  6992. }
  6993. Object.defineProperty(DroppingBuffer.prototype, "empty", {
  6994. get: function () {
  6995. return this._q.length === 0;
  6996. },
  6997. enumerable: false,
  6998. configurable: true
  6999. });
  7000. Object.defineProperty(DroppingBuffer.prototype, "full", {
  7001. get: function () {
  7002. return false;
  7003. },
  7004. enumerable: false,
  7005. configurable: true
  7006. });
  7007. DroppingBuffer.prototype.add = function (value) {
  7008. if (this._q.length < this._c) {
  7009. this._q.push(value);
  7010. }
  7011. };
  7012. DroppingBuffer.prototype.remove = function () {
  7013. if (this.empty) {
  7014. throw new Error("Buffer empty");
  7015. }
  7016. return this._q.shift();
  7017. };
  7018. return DroppingBuffer;
  7019. }());
  7020. /** Makes sure promise-likes don’t cause unhandled rejections. */
  7021. function swallow(value) {
  7022. if (value != null && typeof value.then === "function") {
  7023. value.then(NOOP, NOOP);
  7024. }
  7025. }
  7026. /*** REPEATER STATES ***/
  7027. /** The following is an enumeration of all possible repeater states. These states are ordered, and a repeater may only advance to higher states. */
  7028. /** The initial state of the repeater. */
  7029. var Initial = 0;
  7030. /** Repeaters advance to this state the first time the next method is called on the repeater. */
  7031. var Started = 1;
  7032. /** Repeaters advance to this state when the stop function is called. */
  7033. var Stopped = 2;
  7034. /** Repeaters advance to this state when there are no values left to be pulled from the repeater. */
  7035. var Done = 3;
  7036. /** Repeaters advance to this state if an error is thrown into the repeater. */
  7037. var Rejected = 4;
  7038. /** The maximum number of push or next operations which may exist on a single repeater. */
  7039. var MAX_QUEUE_LENGTH = 1024;
  7040. var NOOP = function () { };
  7041. /** A helper function used to mimic the behavior of async generators where the final iteration is consumed. */
  7042. function consumeExecution(r) {
  7043. var err = r.err;
  7044. var execution = Promise.resolve(r.execution).then(function (value) {
  7045. if (err != null) {
  7046. throw err;
  7047. }
  7048. return value;
  7049. });
  7050. r.err = undefined;
  7051. r.execution = execution.then(function () { return undefined; }, function () { return undefined; });
  7052. return r.pending === undefined ? execution : r.pending.then(function () { return execution; });
  7053. }
  7054. /** A helper function for building iterations from values. Promises are unwrapped, so that iterations never have their value property set to a promise. */
  7055. function createIteration(r, value) {
  7056. var done = r.state >= Done;
  7057. return Promise.resolve(value).then(function (value) {
  7058. if (!done && r.state >= Rejected) {
  7059. return consumeExecution(r).then(function (value) { return ({
  7060. value: value,
  7061. done: true,
  7062. }); });
  7063. }
  7064. return { value: value, done: done };
  7065. });
  7066. }
  7067. /**
  7068. * This function is bound and passed to the executor as the stop argument.
  7069. *
  7070. * Advances state to Stopped.
  7071. */
  7072. function stop(r, err) {
  7073. var e_1, _a;
  7074. if (r.state >= Stopped) {
  7075. return;
  7076. }
  7077. r.state = Stopped;
  7078. r.onnext();
  7079. r.onstop();
  7080. if (r.err == null) {
  7081. r.err = err;
  7082. }
  7083. if (r.pushes.length === 0 &&
  7084. (typeof r.buffer === "undefined" || r.buffer.empty)) {
  7085. finish(r);
  7086. }
  7087. else {
  7088. try {
  7089. for (var _b = __values(r.pushes), _d = _b.next(); !_d.done; _d = _b.next()) {
  7090. var push_1 = _d.value;
  7091. push_1.resolve();
  7092. }
  7093. }
  7094. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  7095. finally {
  7096. try {
  7097. if (_d && !_d.done && (_a = _b.return)) _a.call(_b);
  7098. }
  7099. finally { if (e_1) throw e_1.error; }
  7100. }
  7101. }
  7102. }
  7103. /**
  7104. * The difference between stopping a repeater vs finishing a repeater is that stopping a repeater allows next to continue to drain values from the push queue and buffer, while finishing a repeater will clear all pending values and end iteration immediately. Once, a repeater is finished, all iterations will have the done property set to true.
  7105. *
  7106. * Advances state to Done.
  7107. */
  7108. function finish(r) {
  7109. var e_2, _a;
  7110. if (r.state >= Done) {
  7111. return;
  7112. }
  7113. if (r.state < Stopped) {
  7114. stop(r);
  7115. }
  7116. r.state = Done;
  7117. r.buffer = undefined;
  7118. try {
  7119. for (var _b = __values(r.nexts), _d = _b.next(); !_d.done; _d = _b.next()) {
  7120. var next = _d.value;
  7121. var execution = r.pending === undefined
  7122. ? consumeExecution(r)
  7123. : r.pending.then(function () { return consumeExecution(r); });
  7124. next.resolve(createIteration(r, execution));
  7125. }
  7126. }
  7127. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  7128. finally {
  7129. try {
  7130. if (_d && !_d.done && (_a = _b.return)) _a.call(_b);
  7131. }
  7132. finally { if (e_2) throw e_2.error; }
  7133. }
  7134. r.pushes = [];
  7135. r.nexts = [];
  7136. }
  7137. /**
  7138. * Called when a promise passed to push rejects, or when a push call is unhandled.
  7139. *
  7140. * Advances state to Rejected.
  7141. */
  7142. function reject(r) {
  7143. if (r.state >= Rejected) {
  7144. return;
  7145. }
  7146. if (r.state < Done) {
  7147. finish(r);
  7148. }
  7149. r.state = Rejected;
  7150. }
  7151. /** This function is bound and passed to the executor as the push argument. */
  7152. function push(r, value) {
  7153. swallow(value);
  7154. if (r.pushes.length >= MAX_QUEUE_LENGTH) {
  7155. throw new RepeaterOverflowError("No more than " + MAX_QUEUE_LENGTH + " pending calls to push are allowed on a single repeater.");
  7156. }
  7157. else if (r.state >= Stopped) {
  7158. return Promise.resolve(undefined);
  7159. }
  7160. var valueP = r.pending === undefined
  7161. ? Promise.resolve(value)
  7162. : r.pending.then(function () { return value; });
  7163. valueP = valueP.catch(function (err) {
  7164. if (r.state < Stopped) {
  7165. r.err = err;
  7166. }
  7167. reject(r);
  7168. return undefined; // void :(
  7169. });
  7170. var nextP;
  7171. if (r.nexts.length) {
  7172. var next_1 = r.nexts.shift();
  7173. next_1.resolve(createIteration(r, valueP));
  7174. if (r.nexts.length) {
  7175. nextP = Promise.resolve(r.nexts[0].value);
  7176. }
  7177. else {
  7178. nextP = new Promise(function (resolve) { return (r.onnext = resolve); });
  7179. }
  7180. }
  7181. else if (typeof r.buffer !== "undefined" && !r.buffer.full) {
  7182. r.buffer.add(valueP);
  7183. nextP = Promise.resolve(undefined);
  7184. }
  7185. else {
  7186. nextP = new Promise(function (resolve) { return r.pushes.push({ resolve: resolve, value: valueP }); });
  7187. }
  7188. // If an error is thrown into the repeater via the next or throw methods, we give the repeater a chance to handle this by rejecting the promise returned from push. If the push call is not immediately handled we throw the next iteration of the repeater.
  7189. // To check that the promise returned from push is floating, we modify the then and catch methods of the returned promise so that they flip the floating flag. The push function actually does not return a promise, because modern engines do not call the then and catch methods on native promises. By making next a plain old javascript object, we ensure that the then and catch methods will be called.
  7190. var floating = true;
  7191. var next = {};
  7192. var unhandled = nextP.catch(function (err) {
  7193. if (floating) {
  7194. throw err;
  7195. }
  7196. return undefined; // void :(
  7197. });
  7198. next.then = function (onfulfilled, onrejected) {
  7199. floating = false;
  7200. return Promise.prototype.then.call(nextP, onfulfilled, onrejected);
  7201. };
  7202. next.catch = function (onrejected) {
  7203. floating = false;
  7204. return Promise.prototype.catch.call(nextP, onrejected);
  7205. };
  7206. next.finally = nextP.finally.bind(nextP);
  7207. r.pending = valueP
  7208. .then(function () { return unhandled; })
  7209. .catch(function (err) {
  7210. r.err = err;
  7211. reject(r);
  7212. });
  7213. return next;
  7214. }
  7215. /**
  7216. * Creates the stop callable promise which is passed to the executor
  7217. */
  7218. function createStop(r) {
  7219. var stop1 = stop.bind(null, r);
  7220. var stopP = new Promise(function (resolve) { return (r.onstop = resolve); });
  7221. stop1.then = stopP.then.bind(stopP);
  7222. stop1.catch = stopP.catch.bind(stopP);
  7223. stop1.finally = stopP.finally.bind(stopP);
  7224. return stop1;
  7225. }
  7226. /**
  7227. * Calls the executor passed into the constructor. This function is called the first time the next method is called on the repeater.
  7228. *
  7229. * Advances state to Started.
  7230. */
  7231. function execute(r) {
  7232. if (r.state >= Started) {
  7233. return;
  7234. }
  7235. r.state = Started;
  7236. var push1 = push.bind(null, r);
  7237. var stop1 = createStop(r);
  7238. r.execution = new Promise(function (resolve) { return resolve(r.executor(push1, stop1)); });
  7239. // TODO: We should consider stopping all repeaters when the executor settles.
  7240. r.execution.catch(function () { return stop(r); });
  7241. }
  7242. var records = new WeakMap();
  7243. // NOTE: While repeaters implement and are assignable to the AsyncGenerator interface, and you can use the types interchangeably, we don’t use typescript’s implements syntax here because this would make supporting earlier versions of typescript trickier. This is because TypeScript version 3.6 changed the iterator types by adding the TReturn and TNext type parameters.
  7244. var Repeater = /** @class */ (function () {
  7245. function Repeater(executor, buffer) {
  7246. records.set(this, {
  7247. executor: executor,
  7248. buffer: buffer,
  7249. err: undefined,
  7250. state: Initial,
  7251. pushes: [],
  7252. nexts: [],
  7253. pending: undefined,
  7254. execution: undefined,
  7255. onnext: NOOP,
  7256. onstop: NOOP,
  7257. });
  7258. }
  7259. Repeater.prototype.next = function (value) {
  7260. swallow(value);
  7261. var r = records.get(this);
  7262. if (r === undefined) {
  7263. throw new Error("WeakMap error");
  7264. }
  7265. if (r.nexts.length >= MAX_QUEUE_LENGTH) {
  7266. throw new RepeaterOverflowError("No more than " + MAX_QUEUE_LENGTH + " pending calls to next are allowed on a single repeater.");
  7267. }
  7268. if (r.state <= Initial) {
  7269. execute(r);
  7270. }
  7271. r.onnext(value);
  7272. if (typeof r.buffer !== "undefined" && !r.buffer.empty) {
  7273. var result = createIteration(r, r.buffer.remove());
  7274. if (r.pushes.length) {
  7275. var push_2 = r.pushes.shift();
  7276. r.buffer.add(push_2.value);
  7277. r.onnext = push_2.resolve;
  7278. }
  7279. return result;
  7280. }
  7281. else if (r.pushes.length) {
  7282. var push_3 = r.pushes.shift();
  7283. r.onnext = push_3.resolve;
  7284. return createIteration(r, push_3.value);
  7285. }
  7286. else if (r.state >= Stopped) {
  7287. finish(r);
  7288. return createIteration(r, consumeExecution(r));
  7289. }
  7290. return new Promise(function (resolve) { return r.nexts.push({ resolve: resolve, value: value }); });
  7291. };
  7292. Repeater.prototype.return = function (value) {
  7293. swallow(value);
  7294. var r = records.get(this);
  7295. if (r === undefined) {
  7296. throw new Error("WeakMap error");
  7297. }
  7298. finish(r);
  7299. // We override the execution because return should always return the value passed in.
  7300. r.execution = Promise.resolve(r.execution).then(function () { return value; });
  7301. return createIteration(r, consumeExecution(r));
  7302. };
  7303. Repeater.prototype.throw = function (err) {
  7304. var r = records.get(this);
  7305. if (r === undefined) {
  7306. throw new Error("WeakMap error");
  7307. }
  7308. if (r.state <= Initial ||
  7309. r.state >= Stopped ||
  7310. (typeof r.buffer !== "undefined" && !r.buffer.empty)) {
  7311. finish(r);
  7312. // If r.err is already set, that mean the repeater has already produced an error, so we throw that error rather than the error passed in, because doing so might be more informative for the caller.
  7313. if (r.err == null) {
  7314. r.err = err;
  7315. }
  7316. return createIteration(r, consumeExecution(r));
  7317. }
  7318. return this.next(Promise.reject(err));
  7319. };
  7320. Repeater.prototype[Symbol.asyncIterator] = function () {
  7321. return this;
  7322. };
  7323. // TODO: Remove these static methods from the class.
  7324. Repeater.race = race;
  7325. Repeater.merge = merge;
  7326. Repeater.zip = zip;
  7327. Repeater.latest = latest;
  7328. return Repeater;
  7329. }());
  7330. /*** COMBINATOR FUNCTIONS ***/
  7331. // TODO: move these combinators to their own file.
  7332. function getIterators(values, options) {
  7333. var e_3, _a;
  7334. var iters = [];
  7335. var _loop_1 = function (value) {
  7336. if (value != null && typeof value[Symbol.asyncIterator] === "function") {
  7337. iters.push(value[Symbol.asyncIterator]());
  7338. }
  7339. else if (value != null && typeof value[Symbol.iterator] === "function") {
  7340. iters.push(value[Symbol.iterator]());
  7341. }
  7342. else {
  7343. iters.push((function valueToAsyncIterator() {
  7344. return __asyncGenerator(this, arguments, function valueToAsyncIterator_1() {
  7345. return __generator(this, function (_a) {
  7346. switch (_a.label) {
  7347. case 0:
  7348. if (!options.yieldValues) return [3 /*break*/, 3];
  7349. return [4 /*yield*/, __await(value)];
  7350. case 1: return [4 /*yield*/, _a.sent()];
  7351. case 2:
  7352. _a.sent();
  7353. _a.label = 3;
  7354. case 3:
  7355. if (!options.returnValues) return [3 /*break*/, 5];
  7356. return [4 /*yield*/, __await(value)];
  7357. case 4: return [2 /*return*/, _a.sent()];
  7358. case 5: return [2 /*return*/];
  7359. }
  7360. });
  7361. });
  7362. })());
  7363. }
  7364. };
  7365. try {
  7366. for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
  7367. var value = values_1_1.value;
  7368. _loop_1(value);
  7369. }
  7370. }
  7371. catch (e_3_1) { e_3 = { error: e_3_1 }; }
  7372. finally {
  7373. try {
  7374. if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
  7375. }
  7376. finally { if (e_3) throw e_3.error; }
  7377. }
  7378. return iters;
  7379. }
  7380. // NOTE: whenever you see any variables called `advance` or `advances`, know that it is a hack to get around the fact that `Promise.race` leaks memory. These variables are intended to be set to the resolve function of a promise which is constructed and awaited as an alternative to Promise.race. For more information, see this comment in the Node.js issue tracker: https://github.com/nodejs/node/issues/17469#issuecomment-685216777.
  7381. function race(contenders) {
  7382. var _this = this;
  7383. var iters = getIterators(contenders, { returnValues: true });
  7384. return new Repeater(function (push, stop) { return __awaiter(_this, void 0, void 0, function () {
  7385. var advance, stopped, finalIteration, iteration, i_1, _loop_2;
  7386. return __generator(this, function (_a) {
  7387. switch (_a.label) {
  7388. case 0:
  7389. if (!iters.length) {
  7390. stop();
  7391. return [2 /*return*/];
  7392. }
  7393. stopped = false;
  7394. stop.then(function () {
  7395. advance();
  7396. stopped = true;
  7397. });
  7398. _a.label = 1;
  7399. case 1:
  7400. _a.trys.push([1, , 5, 7]);
  7401. iteration = void 0;
  7402. i_1 = 0;
  7403. _loop_2 = function () {
  7404. var j, iters_1, iters_1_1, iter;
  7405. var e_4, _a;
  7406. return __generator(this, function (_b) {
  7407. switch (_b.label) {
  7408. case 0:
  7409. j = i_1;
  7410. try {
  7411. for (iters_1 = (e_4 = void 0, __values(iters)), iters_1_1 = iters_1.next(); !iters_1_1.done; iters_1_1 = iters_1.next()) {
  7412. iter = iters_1_1.value;
  7413. Promise.resolve(iter.next()).then(function (iteration) {
  7414. if (iteration.done) {
  7415. stop();
  7416. if (finalIteration === undefined) {
  7417. finalIteration = iteration;
  7418. }
  7419. }
  7420. else if (i_1 === j) {
  7421. // This iterator has won, advance i and resolve the promise.
  7422. i_1++;
  7423. advance(iteration);
  7424. }
  7425. }, function (err) { return stop(err); });
  7426. }
  7427. }
  7428. catch (e_4_1) { e_4 = { error: e_4_1 }; }
  7429. finally {
  7430. try {
  7431. if (iters_1_1 && !iters_1_1.done && (_a = iters_1.return)) _a.call(iters_1);
  7432. }
  7433. finally { if (e_4) throw e_4.error; }
  7434. }
  7435. return [4 /*yield*/, new Promise(function (resolve) { return (advance = resolve); })];
  7436. case 1:
  7437. iteration = _b.sent();
  7438. if (!(iteration !== undefined)) return [3 /*break*/, 3];
  7439. return [4 /*yield*/, push(iteration.value)];
  7440. case 2:
  7441. _b.sent();
  7442. _b.label = 3;
  7443. case 3: return [2 /*return*/];
  7444. }
  7445. });
  7446. };
  7447. _a.label = 2;
  7448. case 2:
  7449. if (!!stopped) return [3 /*break*/, 4];
  7450. return [5 /*yield**/, _loop_2()];
  7451. case 3:
  7452. _a.sent();
  7453. return [3 /*break*/, 2];
  7454. case 4: return [2 /*return*/, finalIteration && finalIteration.value];
  7455. case 5:
  7456. stop();
  7457. return [4 /*yield*/, Promise.race(iters.map(function (iter) { return iter.return && iter.return(); }))];
  7458. case 6:
  7459. _a.sent();
  7460. return [7 /*endfinally*/];
  7461. case 7: return [2 /*return*/];
  7462. }
  7463. });
  7464. }); });
  7465. }
  7466. function merge(contenders) {
  7467. var _this = this;
  7468. var iters = getIterators(contenders, { yieldValues: true });
  7469. return new Repeater(function (push, stop) { return __awaiter(_this, void 0, void 0, function () {
  7470. var advances, stopped, finalIteration;
  7471. var _this = this;
  7472. return __generator(this, function (_a) {
  7473. switch (_a.label) {
  7474. case 0:
  7475. if (!iters.length) {
  7476. stop();
  7477. return [2 /*return*/];
  7478. }
  7479. advances = [];
  7480. stopped = false;
  7481. stop.then(function () {
  7482. var e_5, _a;
  7483. stopped = true;
  7484. try {
  7485. for (var advances_1 = __values(advances), advances_1_1 = advances_1.next(); !advances_1_1.done; advances_1_1 = advances_1.next()) {
  7486. var advance = advances_1_1.value;
  7487. advance();
  7488. }
  7489. }
  7490. catch (e_5_1) { e_5 = { error: e_5_1 }; }
  7491. finally {
  7492. try {
  7493. if (advances_1_1 && !advances_1_1.done && (_a = advances_1.return)) _a.call(advances_1);
  7494. }
  7495. finally { if (e_5) throw e_5.error; }
  7496. }
  7497. });
  7498. _a.label = 1;
  7499. case 1:
  7500. _a.trys.push([1, , 3, 4]);
  7501. return [4 /*yield*/, Promise.all(iters.map(function (iter, i) { return __awaiter(_this, void 0, void 0, function () {
  7502. var iteration, _a;
  7503. return __generator(this, function (_b) {
  7504. switch (_b.label) {
  7505. case 0:
  7506. _b.trys.push([0, , 6, 9]);
  7507. _b.label = 1;
  7508. case 1:
  7509. if (!!stopped) return [3 /*break*/, 5];
  7510. Promise.resolve(iter.next()).then(function (iteration) { return advances[i](iteration); }, function (err) { return stop(err); });
  7511. return [4 /*yield*/, new Promise(function (resolve) {
  7512. advances[i] = resolve;
  7513. })];
  7514. case 2:
  7515. iteration = _b.sent();
  7516. if (!(iteration !== undefined)) return [3 /*break*/, 4];
  7517. if (iteration.done) {
  7518. finalIteration = iteration;
  7519. return [2 /*return*/];
  7520. }
  7521. return [4 /*yield*/, push(iteration.value)];
  7522. case 3:
  7523. _b.sent();
  7524. _b.label = 4;
  7525. case 4: return [3 /*break*/, 1];
  7526. case 5: return [3 /*break*/, 9];
  7527. case 6:
  7528. _a = iter.return;
  7529. if (!_a) return [3 /*break*/, 8];
  7530. return [4 /*yield*/, iter.return()];
  7531. case 7:
  7532. _a = (_b.sent());
  7533. _b.label = 8;
  7534. case 8:
  7535. return [7 /*endfinally*/];
  7536. case 9: return [2 /*return*/];
  7537. }
  7538. });
  7539. }); }))];
  7540. case 2:
  7541. _a.sent();
  7542. return [2 /*return*/, finalIteration && finalIteration.value];
  7543. case 3:
  7544. stop();
  7545. return [7 /*endfinally*/];
  7546. case 4: return [2 /*return*/];
  7547. }
  7548. });
  7549. }); });
  7550. }
  7551. function zip(contenders) {
  7552. var _this = this;
  7553. var iters = getIterators(contenders, { returnValues: true });
  7554. return new Repeater(function (push, stop) { return __awaiter(_this, void 0, void 0, function () {
  7555. var advance, stopped, iterations, values;
  7556. return __generator(this, function (_a) {
  7557. switch (_a.label) {
  7558. case 0:
  7559. if (!iters.length) {
  7560. stop();
  7561. return [2 /*return*/, []];
  7562. }
  7563. stopped = false;
  7564. stop.then(function () {
  7565. advance();
  7566. stopped = true;
  7567. });
  7568. _a.label = 1;
  7569. case 1:
  7570. _a.trys.push([1, , 6, 8]);
  7571. _a.label = 2;
  7572. case 2:
  7573. if (!!stopped) return [3 /*break*/, 5];
  7574. Promise.all(iters.map(function (iter) { return iter.next(); })).then(function (iterations) { return advance(iterations); }, function (err) { return stop(err); });
  7575. return [4 /*yield*/, new Promise(function (resolve) { return (advance = resolve); })];
  7576. case 3:
  7577. iterations = _a.sent();
  7578. if (iterations === undefined) {
  7579. return [2 /*return*/];
  7580. }
  7581. values = iterations.map(function (iteration) { return iteration.value; });
  7582. if (iterations.some(function (iteration) { return iteration.done; })) {
  7583. return [2 /*return*/, values];
  7584. }
  7585. return [4 /*yield*/, push(values)];
  7586. case 4:
  7587. _a.sent();
  7588. return [3 /*break*/, 2];
  7589. case 5: return [3 /*break*/, 8];
  7590. case 6:
  7591. stop();
  7592. return [4 /*yield*/, Promise.all(iters.map(function (iter) { return iter.return && iter.return(); }))];
  7593. case 7:
  7594. _a.sent();
  7595. return [7 /*endfinally*/];
  7596. case 8: return [2 /*return*/];
  7597. }
  7598. });
  7599. }); });
  7600. }
  7601. function latest(contenders) {
  7602. var _this = this;
  7603. var iters = getIterators(contenders, {
  7604. yieldValues: true,
  7605. returnValues: true,
  7606. });
  7607. return new Repeater(function (push, stop) { return __awaiter(_this, void 0, void 0, function () {
  7608. var advance, advances, stopped, iterations_1, values_2;
  7609. var _this = this;
  7610. return __generator(this, function (_a) {
  7611. switch (_a.label) {
  7612. case 0:
  7613. if (!iters.length) {
  7614. stop();
  7615. return [2 /*return*/, []];
  7616. }
  7617. advances = [];
  7618. stopped = false;
  7619. stop.then(function () {
  7620. var e_6, _a;
  7621. advance();
  7622. try {
  7623. for (var advances_2 = __values(advances), advances_2_1 = advances_2.next(); !advances_2_1.done; advances_2_1 = advances_2.next()) {
  7624. var advance1 = advances_2_1.value;
  7625. advance1();
  7626. }
  7627. }
  7628. catch (e_6_1) { e_6 = { error: e_6_1 }; }
  7629. finally {
  7630. try {
  7631. if (advances_2_1 && !advances_2_1.done && (_a = advances_2.return)) _a.call(advances_2);
  7632. }
  7633. finally { if (e_6) throw e_6.error; }
  7634. }
  7635. stopped = true;
  7636. });
  7637. _a.label = 1;
  7638. case 1:
  7639. _a.trys.push([1, , 5, 7]);
  7640. Promise.all(iters.map(function (iter) { return iter.next(); })).then(function (iterations) { return advance(iterations); }, function (err) { return stop(err); });
  7641. return [4 /*yield*/, new Promise(function (resolve) { return (advance = resolve); })];
  7642. case 2:
  7643. iterations_1 = _a.sent();
  7644. if (iterations_1 === undefined) {
  7645. return [2 /*return*/];
  7646. }
  7647. values_2 = iterations_1.map(function (iteration) { return iteration.value; });
  7648. if (iterations_1.every(function (iteration) { return iteration.done; })) {
  7649. return [2 /*return*/, values_2];
  7650. }
  7651. // We continuously yield and mutate the same values array so we shallow copy it each time it is pushed.
  7652. return [4 /*yield*/, push(values_2.slice())];
  7653. case 3:
  7654. // We continuously yield and mutate the same values array so we shallow copy it each time it is pushed.
  7655. _a.sent();
  7656. return [4 /*yield*/, Promise.all(iters.map(function (iter, i) { return __awaiter(_this, void 0, void 0, function () {
  7657. var iteration;
  7658. return __generator(this, function (_a) {
  7659. switch (_a.label) {
  7660. case 0:
  7661. if (iterations_1[i].done) {
  7662. return [2 /*return*/, iterations_1[i].value];
  7663. }
  7664. _a.label = 1;
  7665. case 1:
  7666. if (!!stopped) return [3 /*break*/, 4];
  7667. Promise.resolve(iter.next()).then(function (iteration) { return advances[i](iteration); }, function (err) { return stop(err); });
  7668. return [4 /*yield*/, new Promise(function (resolve) { return (advances[i] = resolve); })];
  7669. case 2:
  7670. iteration = _a.sent();
  7671. if (iteration === undefined) {
  7672. return [2 /*return*/, iterations_1[i].value];
  7673. }
  7674. else if (iteration.done) {
  7675. return [2 /*return*/, iteration.value];
  7676. }
  7677. values_2[i] = iteration.value;
  7678. return [4 /*yield*/, push(values_2.slice())];
  7679. case 3:
  7680. _a.sent();
  7681. return [3 /*break*/, 1];
  7682. case 4: return [2 /*return*/];
  7683. }
  7684. });
  7685. }); }))];
  7686. case 4: return [2 /*return*/, _a.sent()];
  7687. case 5:
  7688. stop();
  7689. return [4 /*yield*/, Promise.all(iters.map(function (iter) { return iter.return && iter.return(); }))];
  7690. case 6:
  7691. _a.sent();
  7692. return [7 /*endfinally*/];
  7693. case 7: return [2 /*return*/];
  7694. }
  7695. });
  7696. }); });
  7697. }
  7698. __webpack_unused_export__ = DroppingBuffer;
  7699. __webpack_unused_export__ = FixedBuffer;
  7700. __webpack_unused_export__ = MAX_QUEUE_LENGTH;
  7701. exports.ZN = Repeater;
  7702. __webpack_unused_export__ = RepeaterOverflowError;
  7703. __webpack_unused_export__ = SlidingBuffer;
  7704. //# sourceMappingURL=repeater.js.map
  7705. /***/ })
  7706. /******/ });
  7707. /************************************************************************/
  7708. /******/ // The module cache
  7709. /******/ var __webpack_module_cache__ = {};
  7710. /******/
  7711. /******/ // The require function
  7712. /******/ function __webpack_require__(moduleId) {
  7713. /******/ // Check if module is in cache
  7714. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  7715. /******/ if (cachedModule !== undefined) {
  7716. /******/ return cachedModule.exports;
  7717. /******/ }
  7718. /******/ // Create a new module (and put it into the cache)
  7719. /******/ var module = __webpack_module_cache__[moduleId] = {
  7720. /******/ id: moduleId,
  7721. /******/ loaded: false,
  7722. /******/ exports: {}
  7723. /******/ };
  7724. /******/
  7725. /******/ // Execute the module function
  7726. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7727. /******/
  7728. /******/ // Flag the module as loaded
  7729. /******/ module.loaded = true;
  7730. /******/
  7731. /******/ // Return the exports of the module
  7732. /******/ return module.exports;
  7733. /******/ }
  7734. /******/
  7735. /************************************************************************/
  7736. /******/ /* webpack/runtime/compat get default export */
  7737. /******/ (() => {
  7738. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7739. /******/ __webpack_require__.n = (module) => {
  7740. /******/ var getter = module && module.__esModule ?
  7741. /******/ () => (module['default']) :
  7742. /******/ () => (module);
  7743. /******/ __webpack_require__.d(getter, { a: getter });
  7744. /******/ return getter;
  7745. /******/ };
  7746. /******/ })();
  7747. /******/
  7748. /******/ /* webpack/runtime/define property getters */
  7749. /******/ (() => {
  7750. /******/ // define getter functions for harmony exports
  7751. /******/ __webpack_require__.d = (exports, definition) => {
  7752. /******/ for(var key in definition) {
  7753. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  7754. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  7755. /******/ }
  7756. /******/ }
  7757. /******/ };
  7758. /******/ })();
  7759. /******/
  7760. /******/ /* webpack/runtime/global */
  7761. /******/ (() => {
  7762. /******/ __webpack_require__.g = (function() {
  7763. /******/ if (typeof globalThis === 'object') return globalThis;
  7764. /******/ try {
  7765. /******/ return this || new Function('return this')();
  7766. /******/ } catch (e) {
  7767. /******/ if (typeof window === 'object') return window;
  7768. /******/ }
  7769. /******/ })();
  7770. /******/ })();
  7771. /******/
  7772. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  7773. /******/ (() => {
  7774. /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  7775. /******/ })();
  7776. /******/
  7777. /******/ /* webpack/runtime/node module decorator */
  7778. /******/ (() => {
  7779. /******/ __webpack_require__.nmd = (module) => {
  7780. /******/ module.paths = [];
  7781. /******/ if (!module.children) module.children = [];
  7782. /******/ return module;
  7783. /******/ };
  7784. /******/ })();
  7785. /******/
  7786. /************************************************************************/
  7787. var __webpack_exports__ = {};
  7788. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  7789. (() => {
  7790. "use strict";
  7791. // UNUSED EXPORTS: AddressMatchService, AggregationParameter, AggregationTypes, AlongLineDirection, AnalystAreaUnit, AnalystSizeUnit, AreaSolarRadiationParameters, ArrayStatistic, AttributesPopContainer, Bounds, Browser, BucketAggParameter, BucketAggType, BufferAnalystParameters, BufferDistance, BufferEndType, BufferRadiusUnit, BufferSetting, BuffersAnalystJobsParameter, BurstPipelineAnalystParameters, CartoCSS, ChartQueryFilterParameter, ChartQueryParameters, ChartService, ChartType, ChartView, ChartViewModel, CityTabsPage, ClientType, ClipAnalystMode, ClipParameter, ColorDictionary, ColorGradientType, ColorSpaceType, ColorsPickerUtil, CommonContainer, CommonServiceBase, CommonTheme, CommonUtil, ComponentsUtil, ComputeWeightMatrixParameters, CreateDatasetParameters, Credential, DataFlowService, DataFormat, DataItemOrderBy, DataItemType, DataReturnMode, DataReturnOption, DatasetBufferAnalystParameters, DatasetInfo, DatasetOverlayAnalystParameters, DatasetService, DatasetSurfaceAnalystParameters, DatasetThiessenAnalystParameters, DatasourceConnectionInfo, DatasourceService, DeckglLayer, DensityKernelAnalystParameters, DirectionType, DropDownBox, EditFeaturesParameters, EditType, ElasticSearch, EngineType, EntityType, Event, Events, Exponent, FGBLayer, FacilityAnalyst3DParameters, FacilityAnalystSinks3DParameters, FacilityAnalystSources3DParameters, FacilityAnalystStreamParameters, FacilityAnalystTracedown3DParameters, FacilityAnalystTraceup3DParameters, FacilityAnalystUpstream3DParameters, Feature, FeatureService, FeatureShapeFactory, FeatureTheme, FeatureThemeGraph, FeatureThemeRankSymbol, FeatureThemeVector, FeatureVector, FetchRequest, FieldParameters, FieldService, FieldStatisticsParameters, FieldsFilter, FileReaderUtil, FillGradientMode, FilterField, FilterParameter, FindClosestFacilitiesParameters, FindLocationParameters, FindMTSPPathsParameters, FindPathParameters, FindServiceAreasParameters, FindTSPPathsParameters, Format, GenerateSpatialDataParameters, GeoCodingParameter, GeoDecodingParameter, GeoFeature, GeoFeatureThemeLayer, GeoHashGridAggParameter, GeoJSONFormat, GeoRelationAnalystParameters, Geometry, GeometryBufferAnalystParameters, GeometryCollection, GeometryCurve, GeometryGeoText, GeometryLineString, GeometryLinearRing, GeometryMultiLineString, GeometryMultiPoint, GeometryMultiPolygon, GeometryOverlayAnalystParameters, GeometryPoint, GeometryPolygon, GeometryRectangle, GeometrySurfaceAnalystParameters, GeometryThiessenAnalystParameters, GeometryType, GeoprocessingService, GetFeatureMode, GetFeaturesByBoundsParameters, GetFeaturesByBufferParameters, GetFeaturesByGeometryParameters, GetFeaturesByIDsParameters, GetFeaturesBySQLParameters, GetFeaturesParametersBase, GetFeaturesServiceBase, GetGridCellInfosParameters, GraduatedMode, Graph, GraphAxesTextDisplayMode, GraphMap, GraphThemeLayer, Graphic, GraphicLayer, GraticuleLayer, Grid, GridCellInfosService, GridType, HeatMapLayer, HillshadeParameter, IManager, IManagerCreateNodeParam, IManagerServiceBase, IPortal, IPortalAddDataParam, IPortalAddResourceParam, IPortalDataConnectionInfoParam, IPortalDataMetaInfoParam, IPortalDataStoreInfoParam, IPortalQueryParam, IPortalQueryResult, IPortalRegisterServiceParam, IPortalResource, IPortalServiceBase, IPortalShareEntity, IPortalShareParam, IPortalUser, ImageCollectionService, ImageGFAspect, ImageGFHillShade, ImageGFOrtho, ImageGFSlope, ImageRenderingRule, ImageSearchParameter, ImageService, ImageStretchOption, IndexTabsPageContainer, InterpolationAlgorithmType, InterpolationAnalystParameters, InterpolationDensityAnalystParameters, InterpolationIDWAnalystParameters, InterpolationKrigingAnalystParameters, InterpolationRBFAnalystParameters, JSONFormat, JoinItem, JoinType, KernelDensityJobParameter, KeyServiceParameter, KnowledgeGraph, KnowledgeGraphService, Label, LabelBackShape, LabelImageCell, LabelMatrixCell, LabelMixedTextStyle, LabelOverLengthMode, LabelSymbolCell, LabelThemeCell, LabelThemeLayer, Lang, LayerInfoService, LayerStatus, LayerType, LinkItem, Logo, LonLat, MapExtend, MapService, MappingParameters, MapvDataSet, MapvLayer, MathExpressionAnalysisParameters, MeasureMode, MeasureParameters, MeasureService, MessageBox, MetricsAggParameter, MetricsAggType, NDVIParameter, NavTabsPage, NetworkAnalyst3DService, NetworkAnalystService, NetworkAnalystServiceBase, Online, OnlineData, OnlineQueryDatasParameter, OnlineServiceBase, OrderBy, OrderType, OutputSetting, OutputType, OverlapDisplayedOptions, OverlayAnalystParameters, OverlayGeoJobParameter, OverlayOperationType, PaginationContainer, PermissionType, Pixel, PixelFormat, PointWithMeasure, PopContainer, ProcessingService, ProcessingServiceBase, QueryByBoundsParameters, QueryByDistanceParameters, QueryByGeometryParameters, QueryBySQLParameters, QueryOption, QueryParameters, QueryService, Range, RangeMode, RangeTheme3DLayer, RangeThemeLayer, RankSymbol, RankSymbolThemeLayer, RasterFunctionParameter, RasterFunctionType, ResourceType, Route, RouteCalculateMeasureParameters, RouteLocatorParameters, SearchMode, SearchType, SecurityManager, Select, ServerColor, ServerFeature, ServerGeometry, ServerInfo, ServerStyle, ServerTextStyle, ServerTheme, ServerType, ServiceBase, ServiceStatus, SetDatasourceParameters, SetLayerInfoParameters, SetLayerStatusParameters, SetLayersInfoParameters, ShapeParameters, ShapeParametersCircle, ShapeParametersImage, ShapeParametersLabel, ShapeParametersLine, ShapeParametersPoint, ShapeParametersPolygon, ShapeParametersRectangle, ShapeParametersSector, SideType, SingleObjectQueryJobsParameter, Size, SmoothMethod, Sortby, SpatialAnalystBase, SpatialAnalystService, SpatialQueryMode, SpatialRelationType, StatisticAnalystMode, StatisticMode, StopQueryParameters, SummaryAttributesJobsParameter, SummaryMeshJobParameter, SummaryRegionJobParameter, SummaryType, SuperMap, SupplyCenter, SupplyCenterType, SurfaceAnalystMethod, SurfaceAnalystParameters, SurfaceAnalystParametersSetting, TemplateBase, TerrainCurvatureCalculationParameters, TextAlignment, Theme3DLayer, ThemeDotDensity, ThemeFeature, 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, ThemeStyle, ThemeType, ThemeUnique, ThemeUniqueItem, ThiessenAnalystParameters, ThreeLayer, TimeControlBase, TimeFlowControl, TokenServiceParameter, TopologyValidatorJobsParameter, TopologyValidatorRule, TrafficTransferAnalystService, TransferLine, TransferPathParameters, TransferPreference, TransferSolutionParameters, TransferTactic, Transform, TransportationAnalystParameter, TransportationAnalystResultSetting, TurnType, UGCLayer, UGCLayerType, UGCMapLayer, UGCSubLayer, Unique, UniqueTheme3DLayer, UniqueThemeLayer, Unit, UpdateDatasetParameters, UpdateEdgeWeightParameters, UpdateTurnNodeWeightParameters, Util, VariogramMode, Vector, VectorClipJobsParameter, WKTFormat, WebExportFormatType, WebMap, WebPrintingJobContent, WebPrintingJobCustomItems, WebPrintingJobExportOptions, WebPrintingJobImage, WebPrintingJobLayers, WebPrintingJobLayoutOptions, WebPrintingJobLegendOptions, WebPrintingJobLittleMapOptions, WebPrintingJobNorthArrowOptions, WebPrintingJobParameters, WebPrintingJobScaleBarOptions, WebPrintingJobService, WebScaleOrientationType, WebScaleType, WebScaleUnit, WebSymbol, conversionDegree, getDefaultVectorTileStyle, getMeterPerMapUnit, getWrapNum, isCORS, setBackground, setCORS, setPaintProperty
  7792. ;// CONCATENATED MODULE: external "mapboxgl"
  7793. const external_mapboxgl_namespaceObject = mapboxgl;
  7794. var external_mapboxgl_default = /*#__PURE__*/__webpack_require__.n(external_mapboxgl_namespaceObject);
  7795. ;// CONCATENATED MODULE: ./src/mapboxgl/core/MapExtend.js
  7796. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  7797. * This program are made available under the terms of the Apache License, Version 2.0
  7798. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7799. /**
  7800. * @function MapExtend
  7801. * @description 扩展了 mapboxgl.Map 对图层相关的操作。
  7802. * @private
  7803. */
  7804. var MapExtend = (function () {
  7805. (external_mapboxgl_default()).Map.prototype.overlayLayersManager = {};
  7806. if ((external_mapboxgl_default()).Map.prototype.addLayerBak === undefined) {
  7807. (external_mapboxgl_default()).Map.prototype.addLayerBak = (external_mapboxgl_default()).Map.prototype.addLayer;
  7808. (external_mapboxgl_default()).Map.prototype.addLayer = function (layer, before) {
  7809. if (layer.source || layer.type === 'custom' || layer.type === 'background') {
  7810. this.addLayerBak(layer, before);
  7811. if (layer.overlay && !this.overlayLayersManager[layer.id]) {
  7812. this.overlayLayersManager[layer.id] = layer;
  7813. }
  7814. return this;
  7815. }
  7816. if (this.overlayLayersManager[layer.id] || this.style._layers[layer.id]) {
  7817. this.fire('error', {
  7818. error: new Error('A layer with this id already exists.')
  7819. });
  7820. return;
  7821. }
  7822. addLayer(layer, this);
  7823. this.overlayLayersManager[layer.id] = layer;
  7824. return this;
  7825. };
  7826. }
  7827. (external_mapboxgl_default()).Map.prototype.getLayer = function (id) {
  7828. if (this.overlayLayersManager[id]) {
  7829. return this.overlayLayersManager[id];
  7830. }
  7831. return this.style.getLayer(id);
  7832. };
  7833. (external_mapboxgl_default()).Map.prototype.moveLayer = function (id, beforeId) {
  7834. if (this.overlayLayersManager[id]) {
  7835. this.overlayLayersManager[id].moveLayer
  7836. ? this.overlayLayersManager[id].moveLayer(id, beforeId)
  7837. : moveLayer(id, beforeId);
  7838. return this;
  7839. }
  7840. if (this.style._layers[id]) {
  7841. this.style.moveLayer(id, beforeId);
  7842. this._update(true);
  7843. return this;
  7844. }
  7845. };
  7846. (external_mapboxgl_default()).Map.prototype.removeLayer = function (id) {
  7847. if (this.overlayLayersManager[id]) {
  7848. delete this.overlayLayersManager[id];
  7849. }
  7850. this.style.removeLayer(id);
  7851. this._update(true);
  7852. return this;
  7853. };
  7854. //目前扩展的overlayer,只支持显示或隐藏图层操作
  7855. (external_mapboxgl_default()).Map.prototype.setLayoutProperty = function (layerID, name, value) {
  7856. if (this.overlayLayersManager[layerID]) {
  7857. if (name === 'visibility') {
  7858. if (value === 'visible') {
  7859. value = true;
  7860. } else {
  7861. value = false;
  7862. }
  7863. setVisibility(this.overlayLayersManager[layerID], value);
  7864. this.style.fire('data', { dataType: 'style' });
  7865. }
  7866. return this;
  7867. }
  7868. this.style.setLayoutProperty(layerID, name, value);
  7869. this._update(true);
  7870. return this;
  7871. };
  7872. (external_mapboxgl_default()).Map.prototype.updateTransform = function (units, originX, originY, centerX, centerY, width, height) {
  7873. this.transform.units = units;
  7874. var mercatorZfromAltitude = this.mercatorZfromAltitude;
  7875. (external_mapboxgl_default()).MercatorCoordinate.fromLngLat = function (lngLatLike, altitude) {
  7876. altitude = altitude || 0;
  7877. const lngLat = external_mapboxgl_default().LngLat.convert(lngLatLike);
  7878. return new (external_mapboxgl_default()).MercatorCoordinate(
  7879. (lngLat.lng - originX) / width,
  7880. (originY - lngLat.lat) / height,
  7881. mercatorZfromAltitude(altitude, lngLat.lat)
  7882. );
  7883. };
  7884. (external_mapboxgl_default()).MercatorCoordinate.prototype.toLngLat = function () {
  7885. return new (external_mapboxgl_default()).LngLat(this.x * width + originX, originY - this.y * height);
  7886. };
  7887. this.customConvertPoint = window.URL.createObjectURL(
  7888. new Blob(
  7889. [
  7890. 'customConvertPoint = {projectX:function(x){return (x - ' +
  7891. centerX +
  7892. ') / ' +
  7893. width +
  7894. ' + 0.5},projectY:function(y){y = 0.5 - ((y - ' +
  7895. centerY +
  7896. ') / ' +
  7897. height +
  7898. ');return y < 0 ? 0 : y > 1 ? 1 : y;},toY:function(y){return (0.5-y)*' +
  7899. height +
  7900. '+' +
  7901. centerY +
  7902. ';}}'
  7903. ],
  7904. { type: 'text/javascript' }
  7905. )
  7906. );
  7907. };
  7908. function addLayer(layer, map) {
  7909. layer.onAdd && layer.onAdd(map);
  7910. }
  7911. /**
  7912. * @function MapExtend.prototype.setVisibility
  7913. * @description 设置图层可见性,设置图层的隐藏,显示,重绘的相应的可见标记。
  7914. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  7915. */
  7916. function setVisibility(layer, visibility) {
  7917. layer.setVisibility && layer.setVisibility(visibility);
  7918. }
  7919. /**
  7920. * @function MapExtend.prototype.moveTo
  7921. * @description 将图层移动到某个图层之前。
  7922. * @param {string} layerID -待插入的图层 ID。
  7923. * @param {boolean} [beforeLayerID] - 是否将本图层插入到图层 id 为 layerID 的图层之前(如果为 false 则将本图层插入到图层 id 为 layerID 的图层之后)。
  7924. */
  7925. function moveLayer(layerID, beforeLayerID) {
  7926. var layer = document.getElementById(layerID);
  7927. // var beforeLayer;
  7928. if (beforeLayerID) {
  7929. var beforeLayer = document.getElementById(beforeLayerID);
  7930. if (!beforeLayer) {
  7931. external_mapboxgl_default().Evented.prototype.fire('error', {
  7932. error: new Error(`Layer with id "${beforeLayerID}" does not exist on this document.`)
  7933. });
  7934. }
  7935. }
  7936. if (layer && beforeLayer) {
  7937. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  7938. } else {
  7939. //当没有传入beforeLayerID ,则默认将图层移动到最上面
  7940. layer.parentNode.appendChild(layer);
  7941. }
  7942. }
  7943. })();
  7944. ;// CONCATENATED MODULE: ./src/mapboxgl/core/Base.js
  7945. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  7946. * This program are made available under the terms of the Apache License, Version 2.0
  7947. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7948. ;// CONCATENATED MODULE: ./src/common/control/img/Logo.js
  7949. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  7950. * This program are made available under the terms of the Apache License, Version 2.0
  7951. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7952. 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=";
  7953. ;// CONCATENATED MODULE: ./src/mapboxgl/control/Logo.js
  7954. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  7955. * This program are made available under the terms of the Apache License, Version 2.0
  7956. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7957. /**
  7958. * @class Logo
  7959. * @deprecatedclass mapboxgl.supermap.LogoControl
  7960. * @category Control
  7961. * @classdesc Logo 控件类。默认不显示。
  7962. * @modulecategory Control
  7963. *
  7964. * @example
  7965. * (start code)
  7966. * map.addControl(new Logo(),'bottom-right');
  7967. * (end)
  7968. * @param {Object} options - logo 控件配置项。
  7969. * @param {string} [options.imageUrl] - logo 图片地址。
  7970. * @param {string} [options.width] - logo 图片宽度。
  7971. * @param {string} [options.height] - logo 图片高度。
  7972. * @param {string} [options.link] - logo图片跳转链接。
  7973. * @param {string} [options.alt='SuperMap iClient'] - logo 图片失效时显示文本。
  7974. * @usage
  7975. */
  7976. class Logo {
  7977. constructor(options) {
  7978. //logo图片地址
  7979. this.imageUrl = null;
  7980. //跳转链接
  7981. this.link = null;
  7982. //logo图片宽
  7983. this.width = null;
  7984. //logo图片高
  7985. this.height = null;
  7986. //logo图片失效时显示文本
  7987. this.alt = "SuperMap iClient";
  7988. this._extend(this, options)
  7989. }
  7990. /**
  7991. * @function Logo.prototype.onAdd
  7992. * @description 添加Logo。
  7993. * @returns {HTMLElement} 返回创建的 Logo 元素。
  7994. */
  7995. onAdd(map) {
  7996. this._map = map;
  7997. this._container = document.createElement('div');
  7998. this._container.className = 'mapboxgl-ctrl iclient-logo';
  7999. this._container.style.marginTop = 0;
  8000. this._container.style.marginBottom = 0;
  8001. this._container.style.marginLeft = 0;
  8002. this._container.style.marginRight = 0;
  8003. var imgSrc = LogoBase64;
  8004. if (this.imageUrl) {
  8005. imgSrc = this.imageUrl;
  8006. }
  8007. var alt = this.alt;
  8008. var imageWidth = "94px";
  8009. var imageHeight = "29px";
  8010. var styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  8011. if (this.imageUrl) {
  8012. imageWidth = this.width;
  8013. imageHeight = this.height;
  8014. styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  8015. if (!imageWidth || !imageHeight) {
  8016. styleSize = "";
  8017. }
  8018. }
  8019. var link = this.link;
  8020. this._container.innerHTML = "<a href='" + link + "' target='_blank'>" +
  8021. "<img src=" + imgSrc + " alt='" + alt + "' style='" + styleSize + "margin-bottom: 2px'></a>";
  8022. this._createStyleSheet();
  8023. return this._container;
  8024. }
  8025. _createStyleSheet() {
  8026. var style = document.createElement('style');
  8027. style.type = 'text/css';
  8028. style.innerHTML = ".iclient-logo{" +
  8029. "margin:0 !important;" +
  8030. "}" +
  8031. ".iclient-logo a{" +
  8032. "border: none;" +
  8033. "display: block;" +
  8034. "height:31px;" +
  8035. "}" +
  8036. ".iclient-logo img{" +
  8037. "border: none;" +
  8038. "white-space: nowrap" +
  8039. "}";
  8040. document.getElementsByTagName('head')[0].appendChild(style);
  8041. }
  8042. _extend(dest) {
  8043. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  8044. var arg = Object.getOwnPropertyNames(arguments)[index];
  8045. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  8046. continue;
  8047. }
  8048. var obj = arguments[arg];
  8049. if (obj) {
  8050. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  8051. var key = Object.getOwnPropertyNames(obj)[j];
  8052. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  8053. continue;
  8054. }
  8055. dest[key] = obj[key];
  8056. }
  8057. }
  8058. }
  8059. return dest;
  8060. }
  8061. }
  8062. ;// CONCATENATED MODULE: ./src/mapboxgl/control/index.js
  8063. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  8064. * This program are made available under the terms of the Apache License, Version 2.0
  8065. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8066. ;// CONCATENATED MODULE: ./src/common/commontypes/Size.js
  8067. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  8068. * This program are made available under the terms of the Apache License, Version 2.0
  8069. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8070. /**
  8071. * @class Size
  8072. * @deprecatedclass SuperMap.Size
  8073. * @category BaseTypes Style
  8074. * @classdesc 此类描绘一对高宽值的实例。
  8075. * @param {number} [w=0.0] - 宽度。
  8076. * @param {number} [h=0.0] - 高度。
  8077. *
  8078. * @example
  8079. * var size = new Size(31,46);
  8080. * @usage
  8081. */
  8082. class Size {
  8083. constructor(w, h) {
  8084. /**
  8085. * @member {number} [Size.prototype.w=0.0]
  8086. * @description 宽度。
  8087. */
  8088. this.w = w ? parseFloat(w) : 0.0;
  8089. /**
  8090. * @member {number} [Size.prototype.h=0.0]
  8091. * @description 高度。
  8092. */
  8093. this.h = w ? parseFloat(h) : 0.0;
  8094. this.CLASS_NAME = "SuperMap.Size";
  8095. }
  8096. /**
  8097. * @function Size.prototype.toString
  8098. * @description 返回字符串形式。
  8099. * @example
  8100. * var size = new Size(10,5);
  8101. * var str = size.toString();
  8102. * @returns {string} 例如:"w=10,h=5"。
  8103. */
  8104. toString() {
  8105. return ("w=" + this.w + ",h=" + this.h);
  8106. }
  8107. /**
  8108. * @function Size.prototype.clone
  8109. * @description 克隆当前size对象。
  8110. * @example
  8111. * var size = new Size(31,46);
  8112. * var size2 = size.clone();
  8113. * @returns {Size} 新的与当前 size 对象有相同宽、高的 Size 对象。
  8114. */
  8115. clone() {
  8116. return new Size(this.w, this.h);
  8117. }
  8118. /**
  8119. *
  8120. * @function Size.prototype.equals
  8121. * @description 比较两个 size 对象是否相等。
  8122. * @example
  8123. * var size = new Size(31,46);
  8124. * var size2 = new Size(31,46);
  8125. * var isEquals = size.equals(size2);
  8126. *
  8127. * @param {Size} sz - 用于比较相等的 Size 对象。
  8128. * @returns {boolean} 传入的 size 和当前 size 高宽相等,注意:如果传入的 size 为空则返回 false。
  8129. *
  8130. */
  8131. equals(sz) {
  8132. var equals = false;
  8133. if (sz != null) {
  8134. equals = ((this.w === sz.w && this.h === sz.h) ||
  8135. (isNaN(this.w) && isNaN(this.h) && isNaN(sz.w) && isNaN(sz.h)));
  8136. }
  8137. return equals;
  8138. }
  8139. /**
  8140. *
  8141. * @function Size.prototype.destroy
  8142. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  8143. * @example
  8144. * var size = new Size(31,46);
  8145. * size.destroy();
  8146. */
  8147. destroy() {
  8148. this.w = null;
  8149. this.h = null;
  8150. }
  8151. }
  8152. ;// CONCATENATED MODULE: ./src/common/commontypes/Pixel.js
  8153. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  8154. * This program are made available under the terms of the Apache License, Version 2.0
  8155. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8156. /**
  8157. * @class Pixel
  8158. * @deprecatedclass SuperMap.Pixel
  8159. * @category BaseTypes Geometry
  8160. * @classdesc 用 x,y 坐标描绘屏幕坐标(像素点)。
  8161. * @param {number} [x=0.0] - x 坐标。
  8162. * @param {number} [y=0.0] - y 坐标。
  8163. * @param {Pixel.Mode} [mode=Pixel.Mode.LeftTop] - 坐标模式。
  8164. *
  8165. * @example
  8166. * //单独创建一个对象
  8167. * var pixcel = new Pixel(100,50);
  8168. *
  8169. * //依据 size 创建
  8170. * var size = new Size(21,25);
  8171. * var offset = new Pixel(-(size.w/2), -size.h);
  8172. * @usage
  8173. */
  8174. class Pixel {
  8175. constructor(x, y, mode) {
  8176. /**
  8177. * @member {number} [Pixel.prototype.x=0.0]
  8178. * @description x 坐标。
  8179. */
  8180. this.x = x ? parseFloat(x) : 0.0;
  8181. /**
  8182. * @member {number} [Pixel.prototype.y=0.0]
  8183. * @description y 坐标。
  8184. */
  8185. this.y = y ? parseFloat(y) : 0.0;
  8186. /**
  8187. * @member {Pixel.Mode} [Pixel.prototype.mode=Pixel.Mode.LeftTop]
  8188. * @description 坐标模式,有左上、右上、右下、左下这几种模式,分别表示相对于左上角、右上角、右下角、左下角的坐标。
  8189. */
  8190. this.mode = mode;
  8191. this.CLASS_NAME = 'SuperMap.Pixel';
  8192. }
  8193. /**
  8194. * @function Pixel.prototype.toString
  8195. * @description 返回此对象的字符串形式。
  8196. * @example
  8197. *
  8198. * var pixcel = new Pixel(100,50);
  8199. * var str = pixcel.toString();
  8200. *
  8201. * @returns {string} 例如: "x=200.4,y=242.2"
  8202. */
  8203. toString() {
  8204. return 'x=' + this.x + ',y=' + this.y;
  8205. }
  8206. /**
  8207. * @function Pixel.prototype.clone
  8208. * @description 克隆当前的 pixel 对象。
  8209. * @example
  8210. * var pixcel = new Pixel(100,50);
  8211. * var pixcel2 = pixcel.clone();
  8212. * @returns {Pixel} 新的与当前 pixel 对象有相同 x、y 坐标的 pixel 对象。
  8213. */
  8214. clone() {
  8215. return new Pixel(this.x, this.y, this.mode);
  8216. }
  8217. /**
  8218. * @function Pixel.prototype.equals
  8219. * @description 比较两 pixel 是否相等。
  8220. * @example
  8221. * var pixcel = new Pixel(100,50);
  8222. * var pixcel2 = new Pixel(100,50);
  8223. * var isEquals = pixcel.equals(pixcel2);
  8224. *
  8225. * @param {Pixel} px - 用于比较相等的 pixel 对象。
  8226. * @returns {boolean} 如果传入的像素点和当前像素点相同返回 true,如果不同或传入参数为 NULL 则返回 false。
  8227. */
  8228. equals(px) {
  8229. var equals = false;
  8230. if (px != null) {
  8231. equals = (this.x == px.x && this.y == px.y) || (isNaN(this.x) && isNaN(this.y) && isNaN(px.x) && isNaN(px.y));
  8232. }
  8233. return equals;
  8234. }
  8235. /**
  8236. * @function Pixel.prototype.distanceTo
  8237. * @description 返回两个 pixel 的距离。
  8238. * @example
  8239. * var pixcel = new Pixel(100,50);
  8240. * var pixcel2 = new Pixel(110,30);
  8241. * var distance = pixcel.distanceTo(pixcel2);
  8242. *
  8243. * @param {Pixel} px - 需要计算的 pixel。
  8244. * @returns {number} 作为参数传入的像素与当前像素点的距离。
  8245. */
  8246. distanceTo(px) {
  8247. return Math.sqrt(Math.pow(this.x - px.x, 2) + Math.pow(this.y - px.y, 2));
  8248. }
  8249. /**
  8250. * @function Pixel.prototype.add
  8251. * @description 在原来像素坐标基础上,x 值加上传入的 x 参数,y 值加上传入的 y 参数。
  8252. * @example
  8253. * var pixcel = new Pixel(100,50);
  8254. * //pixcel2是新的对象
  8255. * var pixcel2 = pixcel.add(20,30);
  8256. *
  8257. * @param {number} x - 传入的 x 值。
  8258. * @param {number} y - 传入的 y 值。
  8259. * @returns {Pixel} 新的 pixel 对象,该 pixel 是由当前的 pixel 与传入的 x,y 相加得到。
  8260. */
  8261. add(x, y) {
  8262. if (x == null || y == null) {
  8263. throw new TypeError('Pixel.add cannot receive null values');
  8264. }
  8265. return new Pixel(this.x + x, this.y + y);
  8266. }
  8267. /**
  8268. * @function Pixel.prototype.offset
  8269. * @description 通过传入的 {@link Pixel} 参数对原屏幕坐标进行偏移。
  8270. * @example
  8271. * var pixcel = new Pixel(100,50);
  8272. * var pixcel2 = new Pixel(130,20);
  8273. * //pixcel3 是新的对象
  8274. * var pixcel3 = pixcel.offset(pixcel2);
  8275. *
  8276. * @param {Pixel} px - 传入的 {@link Pixel} 对象。
  8277. * @returns {Pixel} 新的 pixel,该 pixel 是由当前的 pixel 对象的 x,y 值与传入的 Pixel 对象的 x,y 值相加得到。
  8278. */
  8279. offset(px) {
  8280. var newPx = this.clone();
  8281. if (px) {
  8282. newPx = this.add(px.x, px.y);
  8283. }
  8284. return newPx;
  8285. }
  8286. /**
  8287. *
  8288. * @function Pixel.prototype.destroy
  8289. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  8290. * @example
  8291. * var pixcel = new Pixel(100,50);
  8292. * pixcel.destroy();
  8293. */
  8294. destroy() {
  8295. this.x = null;
  8296. this.y = null;
  8297. this.mode = null;
  8298. }
  8299. }
  8300. /**
  8301. * @enum Mode
  8302. * @memberOf Pixel
  8303. * @readonly
  8304. * @description 模式。
  8305. * @type {string}
  8306. */
  8307. Pixel.Mode = {
  8308. /** 左上模式。*/
  8309. LeftTop: 'lefttop',
  8310. /** 右上模式。 */
  8311. RightTop: 'righttop',
  8312. /** 右下模式。 */
  8313. RightBottom: 'rightbottom',
  8314. /** 左下模式。 */
  8315. LeftBottom: 'leftbottom'
  8316. };
  8317. ;// CONCATENATED MODULE: ./src/common/commontypes/BaseTypes.js
  8318. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  8319. * This program are made available under the terms of the Apache License, Version 2.0
  8320. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8321. /**
  8322. * @function inherit
  8323. * @description 除了 C 和 P 两个必要参数外,可以传递任意数量的对象,这些对象都将继承C。
  8324. * @param {Object} C - 继承的类。
  8325. * @param {Object} P - 被继承的父类。
  8326. * @private
  8327. */
  8328. var inheritExt = function (C, P) {
  8329. var F = function () {
  8330. };
  8331. F.prototype = P.prototype;
  8332. C.prototype = new F;
  8333. var i, l, o;
  8334. for (i = 2, l = arguments.length; i < l; i++) {
  8335. o = arguments[i];
  8336. if (typeof o === "function") {
  8337. o = o.prototype;
  8338. }
  8339. Util_Util.extend(C.prototype, o);
  8340. }
  8341. };
  8342. /**
  8343. * @function mixinExt
  8344. * @description 实现多重继承。
  8345. * @param {Class|Object} ...mixins - 继承的类。
  8346. * @private
  8347. */
  8348. var mixinExt = function (...mixins) {
  8349. class Mix {
  8350. constructor(options) {
  8351. for (var index = 0; index < mixins.length; index++) {
  8352. copyProperties(this, new mixins[index](options));
  8353. }
  8354. }
  8355. }
  8356. for (var index = 0; index < mixins.length; index++) {
  8357. var mixin = mixins[index];
  8358. copyProperties(Mix, mixin);
  8359. copyProperties(Mix.prototype, mixin.prototype);
  8360. copyProperties(Mix.prototype, new mixin());
  8361. }
  8362. return Mix;
  8363. function copyProperties(target, source) {
  8364. var ownKeys = Object.getOwnPropertyNames(source);
  8365. if (Object.getOwnPropertySymbols) {
  8366. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source));
  8367. }
  8368. for (var index = 0; index < ownKeys.length; index++) {
  8369. var key = ownKeys[index];
  8370. if (key !== "constructor"
  8371. && key !== "prototype"
  8372. && key !== "name" && key !== "length") {
  8373. let desc = Object.getOwnPropertyDescriptor(source, key);
  8374. if (window["ActiveXObject"]) {
  8375. Object.defineProperty(target, key, desc || {});
  8376. } else {
  8377. Object.defineProperty(target, key, desc);
  8378. }
  8379. }
  8380. }
  8381. }
  8382. };
  8383. /**
  8384. * @name String
  8385. * @namespace
  8386. * @category BaseTypes Util
  8387. * @description 字符串操作的一系列常用扩展函数。
  8388. * @private
  8389. */
  8390. var StringExt = {
  8391. /**
  8392. * @function StringExt.startsWith
  8393. * @description 判断目标字符串是否以指定的子字符串开头。
  8394. * @param {string} str - 目标字符串。
  8395. * @param {string} sub - 查找的子字符串。
  8396. * @returns {boolean} 目标字符串以指定的子字符串开头,则返回 true;否则返回 false。
  8397. */
  8398. startsWith: function (str, sub) {
  8399. return (str.indexOf(sub) == 0);
  8400. },
  8401. /**
  8402. * @function StringExt.contains
  8403. * @description 判断目标字符串是否包含指定的子字符串。
  8404. * @param {string} str - 目标字符串。
  8405. * @param {string} sub - 查找的子字符串。
  8406. * @returns {boolean} 目标字符串中包含指定的子字符串,则返回 true;否则返回 false。
  8407. */
  8408. contains: function (str, sub) {
  8409. return (str.indexOf(sub) != -1);
  8410. },
  8411. /**
  8412. * @function StringExt.trim
  8413. * @description 删除一个字符串的开头和结尾处的所有空白字符。
  8414. * @param {string} str - (可能)存在空白字符填塞的字符串。
  8415. * @returns {string} 删除开头和结尾处空白字符后的字符串。
  8416. */
  8417. trim: function (str) {
  8418. return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  8419. },
  8420. /**
  8421. * @function StringExt.camelize
  8422. * @description 骆驼式("-")连字符的字符串处理。
  8423. * 例如:"chicken-head" becomes "chickenHead",
  8424. * "-chicken-head" becomes "ChickenHead"。
  8425. * @param {string} str - 要处理的字符串,原始内容不应被修改。
  8426. * @returns {string}
  8427. */
  8428. camelize: function (str) {
  8429. var oStringList = str.split('-');
  8430. var camelizedString = oStringList[0];
  8431. for (var i = 1, len = oStringList.length; i < len; i++) {
  8432. var s = oStringList[i];
  8433. camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
  8434. }
  8435. return camelizedString;
  8436. },
  8437. /**
  8438. * @function StringExt.format
  8439. * @description 提供带 ${token} 标记的字符串, 返回 context 对象属性中指定标记的属性值。
  8440. * @example
  8441. * 示例:
  8442. * (code)
  8443. * 1、template = "${value,getValue}";
  8444. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  8445. * args = [2,23,12,36,21];
  8446. * 返回值:36
  8447. * (end)
  8448. * 示例:
  8449. * (code)
  8450. * 2、template = "$${{value,getValue}}";
  8451. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  8452. * args = [2,23,12,36,21];
  8453. * 返回值:"${36}"
  8454. * (end)
  8455. * 示例:
  8456. * (code)
  8457. * 3、template = "${a,b}";
  8458. * context = {a: {b:"format"}};
  8459. * args = null;
  8460. * 返回值:"format"
  8461. * (end)
  8462. * 示例:
  8463. * (code)
  8464. * 3、template = "${a,b}";
  8465. * context = null;
  8466. * args = null;
  8467. * 返回值:"${a.b}"
  8468. * (end)
  8469. * @param {string} template - 带标记的字符串将要被替换。参数 template 格式为"${token}",此处的 token 标记会替换为 context["token"] 属性的值。
  8470. * @param {Object} [context=window] - 带有属性的可选对象的属性用于匹配格式化字符串中的标记。如果该参数为空,将使用 window 对象。
  8471. * @param {Array.<number>} [args] - 可选参数传递给在 context 对象上找到的函数。
  8472. * @returns {string} 从 context 对象属性中替换字符串标记位的字符串。
  8473. */
  8474. format: function (template, context, args) {
  8475. if (!context) {
  8476. context = window;
  8477. }
  8478. // Example matching:
  8479. // str = ${foo.bar}
  8480. // match = foo.bar
  8481. var replacer = function (str, match) {
  8482. var replacement;
  8483. // Loop through all subs. Example: ${a.b.c}
  8484. // 0 -> replacement = context[a];
  8485. // 1 -> replacement = context[a][b];
  8486. // 2 -> replacement = context[a][b][c];
  8487. var subs = match.split(/\.+/);
  8488. for (var i = 0; i < subs.length; i++) {
  8489. if (i == 0) {
  8490. replacement = context;
  8491. }
  8492. replacement = replacement[subs[i]];
  8493. }
  8494. if (typeof replacement === "function") {
  8495. replacement = args ?
  8496. replacement.apply(null, args) :
  8497. replacement();
  8498. }
  8499. // If replacement is undefined, return the string 'undefined'.
  8500. // This is a workaround for a bugs in browsers not properly
  8501. // dealing with non-participating groups in regular expressions:
  8502. // http://blog.stevenlevithan.com/archives/npcg-javascript
  8503. if (typeof replacement == 'undefined') {
  8504. return 'undefined';
  8505. } else {
  8506. return replacement;
  8507. }
  8508. };
  8509. return template.replace(StringExt.tokenRegEx, replacer);
  8510. },
  8511. /**
  8512. * @member {RegExp} [StringExt.tokenRegEx]
  8513. * @description 寻找带 token 的字符串,默认为 tokenRegEx=/\$\{([\w.]+?)\}/g。
  8514. * @example
  8515. * Examples: ${a}, ${a.b.c}, ${a-b}, ${5}
  8516. */
  8517. tokenRegEx: /\$\{([\w.]+?)\}/g,
  8518. /**
  8519. * @member {RegExp} [StringExt.numberRegEx]
  8520. * @description 判断一个字符串是否只包含一个数值,默认为 numberRegEx=/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/。
  8521. */
  8522. numberRegEx: /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,
  8523. /**
  8524. * @function StringExt.isNumeric
  8525. * @description 判断一个字符串是否只包含一个数值。
  8526. * @example
  8527. * (code)
  8528. * StringExt.isNumeric("6.02e23") // true
  8529. * StringExt.isNumeric("12 dozen") // false
  8530. * StringExt.isNumeric("4") // true
  8531. * StringExt.isNumeric(" 4 ") // false
  8532. * (end)
  8533. * @returns {boolean} 字符串包含唯一的数值,返回 true;否则返回 false。
  8534. */
  8535. isNumeric: function (value) {
  8536. return StringExt.numberRegEx.test(value);
  8537. },
  8538. /**
  8539. * @function StringExt.numericIf
  8540. * @description 把一个看似数值型的字符串转化为一个数值。
  8541. * @returns {(number|string)} 如果能转换为数值则返回数值,否则返回字符串本身。
  8542. */
  8543. numericIf: function (value) {
  8544. return StringExt.isNumeric(value) ? parseFloat(value) : value;
  8545. }
  8546. };
  8547. /**
  8548. * @name Number
  8549. * @namespace
  8550. * @category BaseTypes Util
  8551. * @description 数值操作的一系列常用扩展函数。
  8552. * @private
  8553. */
  8554. var NumberExt = {
  8555. /**
  8556. * @member {string} [NumberExt.decimalSeparator='.']
  8557. * @description 格式化数字时默认的小数点分隔符。
  8558. * @constant
  8559. */
  8560. decimalSeparator: ".",
  8561. /**
  8562. * @member {string} [NumberExt.thousandsSeparator=',']
  8563. * @description 格式化数字时默认的千位分隔符。
  8564. * @constant
  8565. */
  8566. thousandsSeparator: ",",
  8567. /**
  8568. * @function NumberExt.limitSigDigs
  8569. * @description 限制浮点数的有效数字位数。
  8570. * @param {number} num - 浮点数。
  8571. * @param {number} sig - 有效位数。
  8572. * @returns {number} 将数字四舍五入到指定数量的有效位数。
  8573. */
  8574. limitSigDigs: function (num, sig) {
  8575. var fig = 0;
  8576. if (sig > 0) {
  8577. fig = parseFloat(num.toPrecision(sig));
  8578. }
  8579. return fig;
  8580. },
  8581. /**
  8582. * @function NumberExt.format
  8583. * @description 数字格式化输出。
  8584. * @param {number} num - 数字。
  8585. * @param {number} [dec=0] - 数字的小数部分四舍五入到指定的位数。设置为 null 值时小数部分不变。
  8586. * @param {string} [tsep=','] - 千位分隔符。
  8587. * @param {string} [dsep='.'] - 小数点分隔符。
  8588. * @returns {string} 数字格式化后的字符串。
  8589. */
  8590. format: function (num, dec, tsep, dsep) {
  8591. dec = (typeof dec != "undefined") ? dec : 0;
  8592. tsep = (typeof tsep != "undefined") ? tsep :
  8593. NumberExt.thousandsSeparator;
  8594. dsep = (typeof dsep != "undefined") ? dsep :
  8595. NumberExt.decimalSeparator;
  8596. if (dec != null) {
  8597. num = parseFloat(num.toFixed(dec));
  8598. }
  8599. var parts = num.toString().split(".");
  8600. if (parts.length === 1 && dec == null) {
  8601. // integer where we do not want to touch the decimals
  8602. dec = 0;
  8603. }
  8604. var integer = parts[0];
  8605. if (tsep) {
  8606. var thousands = /(-?[0-9]+)([0-9]{3})/;
  8607. while (thousands.test(integer)) {
  8608. integer = integer.replace(thousands, "$1" + tsep + "$2");
  8609. }
  8610. }
  8611. var str;
  8612. if (dec == 0) {
  8613. str = integer;
  8614. } else {
  8615. var rem = parts.length > 1 ? parts[1] : "0";
  8616. if (dec != null) {
  8617. rem = rem + new Array(dec - rem.length + 1).join("0");
  8618. }
  8619. str = integer + dsep + rem;
  8620. }
  8621. return str;
  8622. }
  8623. };
  8624. if (!Number.prototype.limitSigDigs) {
  8625. /**
  8626. * APIMethod: Number.limitSigDigs
  8627. * 限制浮点数的有效数字位数.
  8628. * @param {number} sig -有效位数。
  8629. * @returns {number} 将数字四舍五入到指定数量的有效位数。
  8630. * 如果传入值 为 null、0、或者是负数, 返回值 0。
  8631. */
  8632. Number.prototype.limitSigDigs = function (sig) {
  8633. return NumberExt.limitSigDigs(this, sig);
  8634. };
  8635. }
  8636. /**
  8637. * @name Function
  8638. * @namespace
  8639. * @category BaseTypes Util
  8640. * @description 函数操作的一系列常用扩展函数。
  8641. * @private
  8642. */
  8643. var FunctionExt = {
  8644. /**
  8645. * @function FunctionExt.bind
  8646. * @description 绑定函数到对象。方便创建 this 的作用域。
  8647. * @param {function} func - 输入函数。
  8648. * @param {Object} object - 对象绑定到输入函数(作为输入函数的 this 对象)。
  8649. * @returns {function} object 参数作为 func 函数的 this 对象。
  8650. */
  8651. bind: function (func, object) {
  8652. // create a reference to all arguments past the second one
  8653. var args = Array.prototype.slice.apply(arguments, [2]);
  8654. return function () {
  8655. // Push on any additional arguments from the actual function call.
  8656. // These will come after those sent to the bind call.
  8657. var newArgs = args.concat(
  8658. Array.prototype.slice.apply(arguments, [0])
  8659. );
  8660. return func.apply(object, newArgs);
  8661. };
  8662. },
  8663. /**
  8664. * @function FunctionExt.bindAsEventListener
  8665. * @description 绑定函数到对象,在调用该函数时配置并使用事件对象作为第一个参数。
  8666. * @param {function} func - 用于监听事件的函数。
  8667. * @param {Object} object - this 对象的引用。
  8668. * @returns {function}
  8669. */
  8670. bindAsEventListener: function (func, object) {
  8671. return function (event) {
  8672. return func.call(object, event || window.event);
  8673. };
  8674. },
  8675. /**
  8676. * @function FunctionExt.False
  8677. * @description 该函数仅仅返回 false。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  8678. * @example
  8679. * document.onclick = FunctionExt.False;
  8680. * @returns {boolean}
  8681. */
  8682. False: function () {
  8683. return false;
  8684. },
  8685. /**
  8686. * @function FunctionExt.True
  8687. * @description 该函数仅仅返回 true。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  8688. * @example
  8689. * document.onclick = FunctionExt.True;
  8690. * @returns {boolean}
  8691. */
  8692. True: function () {
  8693. return true;
  8694. },
  8695. /**
  8696. * @function FunctionExt.Void
  8697. * @description 可重用函数,仅仅返回 "undefined"。
  8698. * @returns {undefined}
  8699. */
  8700. Void: function () {
  8701. }
  8702. };
  8703. /**
  8704. * @name Array
  8705. * @namespace
  8706. * @category BaseTypes Util
  8707. * @description 数组操作的一系列常用扩展函数。
  8708. * @private
  8709. */
  8710. var ArrayExt = {
  8711. /**
  8712. * @function ArrayExt.filter
  8713. * @description 过滤数组,提供了 ECMA-262 标准中 Array.prototype.filter 函数的扩展。详见:{@link http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/filter}
  8714. * @param {Array} array - 要过滤的数组。
  8715. * @param {function} callback - 数组中的每一个元素调用该函数。</br>
  8716. * 如果函数的返回值为 true,该元素将包含在返回的数组中。该函数有三个参数: 数组中的元素,元素的索引,数组自身。</br>
  8717. * 如果设置了可选参数 caller,在调用 callback 时,使用可选参数 caller 设置为 callback 的参数。</br>
  8718. * @param {Object} [caller] - 在调用 callback 时,使用参数 caller 设置为 callback 的参数。
  8719. * @returns {Array} callback 函数返回 true 时的元素将作为返回数组中的元素。
  8720. */
  8721. filter: function (array, callback, caller) {
  8722. var selected = [];
  8723. if (Array.prototype.filter) {
  8724. selected = array.filter(callback, caller);
  8725. } else {
  8726. var len = array.length;
  8727. if (typeof callback != "function") {
  8728. throw new TypeError();
  8729. }
  8730. for (var i = 0; i < len; i++) {
  8731. if (i in array) {
  8732. var val = array[i];
  8733. if (callback.call(caller, val, i, array)) {
  8734. selected.push(val);
  8735. }
  8736. }
  8737. }
  8738. }
  8739. return selected;
  8740. }
  8741. };
  8742. ;// CONCATENATED MODULE: ./src/common/commontypes/Geometry.js
  8743. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  8744. * This program are made available under the terms of the Apache License, Version 2.0
  8745. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8746. // import {WKT} from '../format/WKT';
  8747. // import {Vector} from './Vector';
  8748. /**
  8749. * @class Geometry
  8750. * @deprecatedclass SuperMap.Geometry
  8751. * @category BaseTypes Geometry
  8752. * @classdesc 几何对象类,描述地理对象的几何图形。
  8753. * @usage
  8754. */
  8755. class Geometry_Geometry {
  8756. constructor() {
  8757. this.CLASS_NAME = "SuperMap.Geometry";
  8758. /**
  8759. * @member {string} Geometry.prototype.id
  8760. * @description 几何对象的唯一标识符。
  8761. *
  8762. */
  8763. this.id = Util_Util.createUniqueID(this.CLASS_NAME + "_");
  8764. /**
  8765. * @member {Geometry} Geometry.prototype.parent
  8766. * @description 父类几何对象。
  8767. */
  8768. this.parent = null;
  8769. /**
  8770. * @member {Bounds} Geometry.prototype.bounds
  8771. * @description 几何对象的范围。
  8772. *
  8773. */
  8774. this.bounds = null;
  8775. /**
  8776. * @member {number} Geometry.prototype.SRID
  8777. * @description 投影坐标参数。通过该参数,服务器判断 Geometry 对象的坐标参考系是否与数据集相同,如果不同,则在数据入库前进行投影变换。
  8778. * @example
  8779. * var geometry= new Geometry();
  8780. * geometry. SRID=4326;
  8781. *
  8782. */
  8783. this.SRID = null;
  8784. }
  8785. /**
  8786. * @function Geometry.prototype.destroy
  8787. * @description 解构 Geometry 类,释放资源。
  8788. */
  8789. destroy() {
  8790. this.id = null;
  8791. this.bounds = null;
  8792. this.SRID = null;
  8793. }
  8794. /**
  8795. * @function Geometry.prototype.clone
  8796. * @description 克隆几何图形。克隆的几何图形不设置非标准的属性。
  8797. * @returns {Geometry} 克隆的几何图形。
  8798. */
  8799. clone() {
  8800. return new Geometry_Geometry();
  8801. }
  8802. /**
  8803. * @function Geometry.prototype.setBounds
  8804. * @description 设置几何对象的 bounds。
  8805. * @param {Bounds} bounds - 范围。
  8806. */
  8807. setBounds(bounds) {
  8808. if (bounds) {
  8809. this.bounds = bounds.clone();
  8810. }
  8811. }
  8812. /**
  8813. * @function Geometry.prototype.clearBounds
  8814. * @description 清除几何对象的 bounds。
  8815. * 如果该对象有父类,也会清除父类几何对象的 bounds。
  8816. */
  8817. clearBounds() {
  8818. this.bounds = null;
  8819. if (this.parent) {
  8820. this.parent.clearBounds();
  8821. }
  8822. }
  8823. /**
  8824. * @function Geometry.prototype.extendBounds
  8825. * @description 扩展现有边界以包含新边界。如果尚未设置几何边界,则设置新边界。
  8826. * @param {Bounds} newBounds - 几何对象的 bounds。
  8827. */
  8828. extendBounds(newBounds) {
  8829. var bounds = this.getBounds();
  8830. if (!bounds) {
  8831. this.setBounds(newBounds);
  8832. } else {
  8833. this.bounds.extend(newBounds);
  8834. }
  8835. }
  8836. /**
  8837. * @function Geometry.prototype.getBounds
  8838. * @description 获得几何图形的边界。如果没有设置边界,可通过计算获得。
  8839. * @returns {Bounds} 几何对象的边界。
  8840. */
  8841. getBounds() {
  8842. if (this.bounds == null) {
  8843. this.calculateBounds();
  8844. }
  8845. return this.bounds;
  8846. }
  8847. /**
  8848. * @function Geometry.prototype.calculateBounds
  8849. * @description 重新计算几何图形的边界(需要在子类中实现此方法)。
  8850. */
  8851. calculateBounds() {
  8852. //
  8853. // This should be overridden by subclasses.
  8854. //
  8855. }
  8856. /**
  8857. * @function Geometry.prototype.getVertices
  8858. * @description 返回几何图形的所有顶点的列表(需要在子类中实现此方法)。
  8859. * @param {boolean} [nodes] - 如果是 true,线则只返回线的末端点,如果 false,仅仅返回顶点,如果没有设置,则返回顶点。
  8860. * @returns {Array} 几何图形的顶点列表。
  8861. */
  8862. getVertices(nodes) { // eslint-disable-line no-unused-vars
  8863. }
  8864. /**
  8865. * @function Geometry.prototype.getArea
  8866. * @description 计算几何对象的面积 ,此方法需要在子类中定义。
  8867. * @returns {number} 计算后的对象面积。
  8868. */
  8869. getArea() {
  8870. //to be overridden by geometries that actually have an area
  8871. //
  8872. return 0.0;
  8873. }
  8874. // /**
  8875. // * @function Geometry.prototype.toString
  8876. // * @description 返回geometry对象的字符串表述,需要引入{@link WKTFormat}。此方法只能在子类实现,在父类使用会报错。
  8877. // * @returns {string} geometry对象的字符串表述(Well-Known Text)
  8878. // */
  8879. // toString() {
  8880. // var string;
  8881. // if (WKT) {
  8882. // var wkt = new WKT();
  8883. // string = wkt.write(new Vector(this));
  8884. // } else {
  8885. // string = Object.prototype.toString.call(this);
  8886. // }
  8887. // return string;
  8888. // }
  8889. }
  8890. ;// CONCATENATED MODULE: ./src/common/commontypes/Util.js
  8891. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  8892. * This program are made available under the terms of the Apache License, Version 2.0
  8893. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8894. /**
  8895. * @description 浏览器名称,依赖于 userAgent 属性,BROWSER_NAME 可以是空,或者以下浏览器:
  8896. * * "opera" -- Opera
  8897. * * "msie" -- Internet Explorer
  8898. * * "safari" -- Safari
  8899. * * "firefox" -- Firefox
  8900. * * "mozilla" -- Mozilla
  8901. * @category BaseTypes Constant
  8902. * @constant {Object}
  8903. * @usage
  8904. * ```
  8905. * // 浏览器
  8906. * <script type="text/javascript" src="{cdn}"></script>
  8907. * <script>
  8908. * const result = {namespace}.Browser.name;
  8909. *
  8910. * </script>
  8911. * // ES6 Import
  8912. * import { Browser } from '{npm}';
  8913. *
  8914. * const result = Browser.name;
  8915. * ```
  8916. */
  8917. const Browser = (function () {
  8918. var name = '',
  8919. version = '',
  8920. device = 'pc',
  8921. uaMatch;
  8922. //以下进行测试
  8923. var ua = navigator.userAgent.toLowerCase();
  8924. if (ua.indexOf('msie') > -1 || (ua.indexOf('trident') > -1 && ua.indexOf('rv') > -1)) {
  8925. name = 'msie';
  8926. uaMatch = ua.match(/msie ([\d.]+)/) || ua.match(/rv:([\d.]+)/);
  8927. } else if (ua.indexOf('chrome') > -1) {
  8928. name = 'chrome';
  8929. uaMatch = ua.match(/chrome\/([\d.]+)/);
  8930. } else if (ua.indexOf('firefox') > -1) {
  8931. name = 'firefox';
  8932. uaMatch = ua.match(/firefox\/([\d.]+)/);
  8933. } else if (ua.indexOf('opera') > -1) {
  8934. name = 'opera';
  8935. uaMatch = ua.match(/version\/([\d.]+)/);
  8936. } else if (ua.indexOf('safari') > -1) {
  8937. name = 'safari';
  8938. uaMatch = ua.match(/version\/([\d.]+)/);
  8939. }
  8940. version = uaMatch ? uaMatch[1] : '';
  8941. if (ua.indexOf('ipad') > -1 || ua.indexOf('ipod') > -1 || ua.indexOf('iphone') > -1) {
  8942. device = 'apple';
  8943. } else if (ua.indexOf('android') > -1) {
  8944. uaMatch = ua.match(/version\/([\d.]+)/);
  8945. version = uaMatch ? uaMatch[1] : '';
  8946. device = 'android';
  8947. }
  8948. return { name: name, version: version, device: device };
  8949. })();
  8950. const isSupportCanvas = (function () {
  8951. var checkRes = true,
  8952. broz = Browser;
  8953. if (document.createElement('canvas').getContext) {
  8954. if (broz.name === 'firefox' && parseFloat(broz.version) < 5) {
  8955. checkRes = false;
  8956. }
  8957. if (broz.name === 'safari' && parseFloat(broz.version) < 4) {
  8958. checkRes = false;
  8959. }
  8960. if (broz.name === 'opera' && parseFloat(broz.version) < 10) {
  8961. checkRes = false;
  8962. }
  8963. if (broz.name === 'msie' && parseFloat(broz.version) < 9) {
  8964. checkRes = false;
  8965. }
  8966. } else {
  8967. checkRes = false;
  8968. }
  8969. return checkRes;
  8970. })();
  8971. /**
  8972. * @description 如果 userAgent 捕获到浏览器使用的是 Gecko 引擎则返回 true。
  8973. * @constant {number}
  8974. * @private
  8975. */
  8976. const IS_GECKO = (function () {
  8977. var ua = navigator.userAgent.toLowerCase();
  8978. return ua.indexOf('webkit') === -1 && ua.indexOf('gecko') !== -1;
  8979. })();
  8980. /**
  8981. * @constant {number}
  8982. * @default
  8983. * @description 分辨率与比例尺之间转换的常量。
  8984. * @private
  8985. */
  8986. const DOTS_PER_INCH = 96;
  8987. /**
  8988. * @name CommonUtil
  8989. * @namespace
  8990. * @category BaseTypes Util
  8991. * @description common 工具类。
  8992. * @usage
  8993. * ```
  8994. * // 浏览器
  8995. * <script type="text/javascript" src="{cdn}"></script>
  8996. * <script>
  8997. * const result = {namespace}.CommonUtil.getElement();
  8998. *
  8999. * // 弃用的写法
  9000. * const result = SuperMap.Util.getElement();
  9001. *
  9002. * </script>
  9003. *
  9004. * // ES6 Import
  9005. * import { CommonUtil } from '{npm}';
  9006. *
  9007. * const result = CommonUtil.getElement();
  9008. * ```
  9009. */
  9010. const Util_Util = {
  9011. /**
  9012. * @function Util.extend
  9013. * @description 对象拷贝赋值。
  9014. * @param {Object} dest - 目标对象。
  9015. * @param {Object} arguments - 待拷贝的对象。
  9016. * @returns {Object} 赋值后的目标对象。
  9017. */
  9018. assign(dest) {
  9019. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  9020. var arg = Object.getOwnPropertyNames(arguments)[index];
  9021. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  9022. continue;
  9023. }
  9024. var obj = arguments[arg];
  9025. if (obj) {
  9026. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  9027. var key = Object.getOwnPropertyNames(obj)[j];
  9028. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  9029. continue;
  9030. }
  9031. dest[key] = obj[key];
  9032. }
  9033. }
  9034. }
  9035. return dest;
  9036. },
  9037. /**
  9038. * @memberOf CommonUtil
  9039. * @description 复制源对象的所有属性到目标对象上,源对象上的没有定义的属性在目标对象上也不会被设置。
  9040. * @example
  9041. * 要复制 Size 对象的所有属性到自定义对象上,使用方法如下:
  9042. * var size = new Size(100, 100);
  9043. * var obj = {};
  9044. * CommonUtil.extend(obj, size);
  9045. * @param {Object} [destination] - 目标对象。
  9046. * @param {Object} source - 源对象,其属性将被设置到目标对象上。
  9047. * @returns {Object} 目标对象。
  9048. */
  9049. extend: function (destination, source) {
  9050. destination = destination || {};
  9051. if (source) {
  9052. for (var property in source) {
  9053. var value = source[property];
  9054. if (value !== undefined) {
  9055. destination[property] = value;
  9056. }
  9057. }
  9058. /**
  9059. * IE doesn't include the toString property when iterating over an object's
  9060. * properties with the for(property in object) syntax. Explicitly check if
  9061. * the source has its own toString property.
  9062. */
  9063. /*
  9064. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  9065. * prototype object" when calling hawOwnProperty if the source object
  9066. * is an instance of window.Event.
  9067. */
  9068. var sourceIsEvt = typeof window.Event === 'function' && source instanceof window.Event;
  9069. if (!sourceIsEvt && source.hasOwnProperty && source.hasOwnProperty('toString')) {
  9070. destination.toString = source.toString;
  9071. }
  9072. }
  9073. return destination;
  9074. },
  9075. /**
  9076. * @memberOf CommonUtil
  9077. * @description 对象拷贝。
  9078. * @param {Object} [des] - 目标对象。
  9079. * @param {Object} soc - 源对象。
  9080. */
  9081. copy: function (des, soc) {
  9082. des = des || {};
  9083. var v;
  9084. if (soc) {
  9085. for (var p in des) {
  9086. v = soc[p];
  9087. if (typeof v !== 'undefined') {
  9088. des[p] = v;
  9089. }
  9090. }
  9091. }
  9092. },
  9093. /**
  9094. * @memberOf CommonUtil
  9095. * @description 销毁对象,将其属性置空。
  9096. * @param {Object} [obj] - 目标对象。
  9097. */
  9098. reset: function (obj) {
  9099. obj = obj || {};
  9100. for (var p in obj) {
  9101. if (obj.hasOwnProperty(p)) {
  9102. if (typeof obj[p] === 'object' && obj[p] instanceof Array) {
  9103. for (var i in obj[p]) {
  9104. if (obj[p][i].destroy) {
  9105. obj[p][i].destroy();
  9106. }
  9107. }
  9108. obj[p].length = 0;
  9109. } else if (typeof obj[p] === 'object' && obj[p] instanceof Object) {
  9110. if (obj[p].destroy) {
  9111. obj[p].destroy();
  9112. }
  9113. }
  9114. obj[p] = null;
  9115. }
  9116. }
  9117. },
  9118. /**
  9119. * @memberOf CommonUtil
  9120. * @description 获取 HTML 元素数组。
  9121. * @returns {Array.<HTMLElement>} HTML 元素数组。
  9122. */
  9123. getElement: function () {
  9124. var elements = [];
  9125. for (var i = 0, len = arguments.length; i < len; i++) {
  9126. var element = arguments[i];
  9127. if (typeof element === 'string') {
  9128. element = document.getElementById(element);
  9129. }
  9130. if (arguments.length === 1) {
  9131. return element;
  9132. }
  9133. elements.push(element);
  9134. }
  9135. return elements;
  9136. },
  9137. /**
  9138. * @memberOf CommonUtil
  9139. * @description instance of 的跨浏览器实现。
  9140. * @param {Object} o - 对象。
  9141. * @returns {boolean} 是否是页面元素。
  9142. */
  9143. isElement: function (o) {
  9144. return !!(o && o.nodeType === 1);
  9145. },
  9146. /**
  9147. * @memberOf CommonUtil
  9148. * @description 判断一个对象是否是数组。
  9149. * @param {Object} a - 对象。
  9150. * @returns {boolean} 是否是数组。
  9151. */
  9152. isArray: function (a) {
  9153. return Object.prototype.toString.call(a) === '[object Array]';
  9154. },
  9155. /**
  9156. * @memberOf CommonUtil
  9157. * @description 从数组中删除某一项。
  9158. * @param {Array} array - 数组。
  9159. * @param {Object} item - 数组中要删除的一项。
  9160. * @returns {Array} 执行删除操作后的数组。
  9161. */
  9162. removeItem: function (array, item) {
  9163. for (var i = array.length - 1; i >= 0; i--) {
  9164. if (array[i] === item) {
  9165. array.splice(i, 1);
  9166. //break;more than once??
  9167. }
  9168. }
  9169. return array;
  9170. },
  9171. /**
  9172. * @memberOf CommonUtil
  9173. * @description 获取某对象在数组中的索引值。
  9174. * @param {Array.<Object>} array - 数组。
  9175. * @param {Object} obj - 对象。
  9176. * @returns {number} 某对象在数组中的索引值。
  9177. */
  9178. indexOf: function (array, obj) {
  9179. if (array == null) {
  9180. return -1;
  9181. } else {
  9182. // use the build-in function if available.
  9183. if (typeof array.indexOf === 'function') {
  9184. return array.indexOf(obj);
  9185. } else {
  9186. for (var i = 0, len = array.length; i < len; i++) {
  9187. if (array[i] === obj) {
  9188. return i;
  9189. }
  9190. }
  9191. return -1;
  9192. }
  9193. }
  9194. },
  9195. /**
  9196. * @memberOf CommonUtil
  9197. * @description 修改某 DOM 元素的许多属性。
  9198. * @param {HTMLElement} element - 待修改的 DOM 元素。
  9199. * @param {string} [id] - DOM 元素的 ID。
  9200. * @param {Pixel} [px] - DOM 元素的 style 属性的 left 和 top 属性。
  9201. * @param {Size} [sz] - DOM 元素的 width 和 height 属性。
  9202. * @param {string} [position] - DOM 元素的 position 属性。
  9203. * @param {string} [border] - DOM 元素的 style 属性的 border 属性。
  9204. * @param {string} [overflow] - DOM 元素的 style 属性的 overflow 属性。
  9205. * @param {number} [opacity] - 不透明度值。取值范围为(0.0 - 1.0)。
  9206. */
  9207. modifyDOMElement: function (element, id, px, sz, position, border, overflow, opacity) {
  9208. if (id) {
  9209. element.id = id;
  9210. }
  9211. if (px) {
  9212. element.style.left = px.x + 'px';
  9213. element.style.top = px.y + 'px';
  9214. }
  9215. if (sz) {
  9216. element.style.width = sz.w + 'px';
  9217. element.style.height = sz.h + 'px';
  9218. }
  9219. if (position) {
  9220. element.style.position = position;
  9221. }
  9222. if (border) {
  9223. element.style.border = border;
  9224. }
  9225. if (overflow) {
  9226. element.style.overflow = overflow;
  9227. }
  9228. if (parseFloat(opacity) >= 0.0 && parseFloat(opacity) < 1.0) {
  9229. element.style.filter = 'alpha(opacity=' + opacity * 100 + ')';
  9230. element.style.opacity = opacity;
  9231. } else if (parseFloat(opacity) === 1.0) {
  9232. element.style.filter = '';
  9233. element.style.opacity = '';
  9234. }
  9235. },
  9236. /**
  9237. * @memberOf CommonUtil
  9238. * @description 比较两个对象并合并。
  9239. * @param {Object} [to] - 目标对象。
  9240. * @param {Object} from - 源对象。
  9241. * @returns {Object} 返回合并后的对象。
  9242. */
  9243. applyDefaults: function (to, from) {
  9244. to = to || {};
  9245. /*
  9246. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  9247. * prototype object" when calling hawOwnProperty if the source object is an
  9248. * instance of window.Event.
  9249. */
  9250. var fromIsEvt = typeof window.Event === 'function' && from instanceof window.Event;
  9251. for (var key in from) {
  9252. if (
  9253. to[key] === undefined ||
  9254. (!fromIsEvt && from.hasOwnProperty && from.hasOwnProperty(key) && !to.hasOwnProperty(key))
  9255. ) {
  9256. to[key] = from[key];
  9257. }
  9258. }
  9259. /**
  9260. * IE doesn't include the toString property when iterating over an object's
  9261. * properties with the for(property in object) syntax. Explicitly check if
  9262. * the source has its own toString property.
  9263. */
  9264. if (
  9265. !fromIsEvt &&
  9266. from &&
  9267. from.hasOwnProperty &&
  9268. from.hasOwnProperty('toString') &&
  9269. !to.hasOwnProperty('toString')
  9270. ) {
  9271. to.toString = from.toString;
  9272. }
  9273. return to;
  9274. },
  9275. /**
  9276. * @memberOf CommonUtil
  9277. * @description 将参数对象转换为 HTTP 的 GET 请求中的参数字符串。例如:"key1=value1&key2=value2&key3=value3"。
  9278. * @param {Object} params - 参数对象。
  9279. * @returns {string} HTTP 的 GET 请求中的参数字符串。
  9280. */
  9281. getParameterString: function (params) {
  9282. var paramsArray = [];
  9283. for (var key in params) {
  9284. var value = params[key];
  9285. if (value != null && typeof value !== 'function') {
  9286. var encodedValue;
  9287. if (Array.isArray(value) || value.toString() === '[object Object]') {
  9288. encodedValue = encodeURIComponent(JSON.stringify(value));
  9289. } else {
  9290. /* value is a string; simply encode */
  9291. encodedValue = encodeURIComponent(value);
  9292. }
  9293. paramsArray.push(encodeURIComponent(key) + '=' + encodedValue);
  9294. }
  9295. }
  9296. return paramsArray.join('&');
  9297. },
  9298. /**
  9299. * @memberOf CommonUtil
  9300. * @description 给 URL 追加查询参数。
  9301. * @param {string} url - 待追加参数的 URL 字符串。
  9302. * @param {string} paramStr - 待追加的查询参数。
  9303. * @returns {string} 新的 URL。
  9304. */
  9305. urlAppend: function (url, paramStr) {
  9306. var newUrl = url;
  9307. if (paramStr) {
  9308. if (paramStr.indexOf('?') === 0) {
  9309. paramStr = paramStr.substring(1);
  9310. }
  9311. var parts = (url + ' ').split(/[?&]/);
  9312. newUrl += parts.pop() === ' ' ? paramStr : parts.length ? '&' + paramStr : '?' + paramStr;
  9313. }
  9314. return newUrl;
  9315. },
  9316. /**
  9317. * @memberOf CommonUtil
  9318. * @description 给 URL 追加 path 参数。
  9319. * @param {string} url - 待追加参数的 URL 字符串。
  9320. * @param {string} paramStr - 待追加的path参数。
  9321. * @returns {string} 新的 URL。
  9322. */
  9323. urlPathAppend: function (url, pathStr) {
  9324. let newUrl = url;
  9325. if (!pathStr) {
  9326. return newUrl;
  9327. }
  9328. if (pathStr.indexOf('/') === 0) {
  9329. pathStr = pathStr.substring(1);
  9330. }
  9331. const parts = url.split('?');
  9332. if (parts[0].indexOf('/', parts[0].length - 1) < 0) {
  9333. parts[0] += '/';
  9334. }
  9335. newUrl = `${parts[0]}${pathStr}${parts.length > 1 ? `?${parts[1]}` : ''}`;
  9336. return newUrl;
  9337. },
  9338. /**
  9339. * @memberOf CommonUtil
  9340. * @description 为了避免浮点精度错误而保留的有效位数。
  9341. * @type {number}
  9342. * @default 14
  9343. */
  9344. DEFAULT_PRECISION: 14,
  9345. /**
  9346. * @memberOf CommonUtil
  9347. * @description 将字符串以接近的精度转换为数字。
  9348. * @param {string} number - 字符串。
  9349. * @param {number} [precision=14] - 精度。
  9350. * @returns {number} 转化后的数字。
  9351. */
  9352. toFloat: function (number, precision) {
  9353. if (precision == null) {
  9354. precision = Util_Util.DEFAULT_PRECISION;
  9355. }
  9356. if (typeof number !== 'number') {
  9357. number = parseFloat(number);
  9358. }
  9359. return precision === 0 ? number : parseFloat(number.toPrecision(precision));
  9360. },
  9361. /**
  9362. * @memberOf CommonUtil
  9363. * @description 角度转弧度。
  9364. * @param {number} x - 角度。
  9365. * @returns {number} 转化后的弧度。
  9366. */
  9367. rad: function (x) {
  9368. return (x * Math.PI) / 180;
  9369. },
  9370. /**
  9371. * @memberOf CommonUtil
  9372. * @description 从 URL 字符串中解析出参数对象。
  9373. * @param {string} url - URL。
  9374. * @returns {Object} 解析出的参数对象。
  9375. */
  9376. getParameters: function (url) {
  9377. // if no url specified, take it from the location bar
  9378. url = url === null || url === undefined ? window.location.href : url;
  9379. //parse out parameters portion of url string
  9380. var paramsString = '';
  9381. if (StringExt.contains(url, '?')) {
  9382. var start = url.indexOf('?') + 1;
  9383. var end = StringExt.contains(url, '#') ? url.indexOf('#') : url.length;
  9384. paramsString = url.substring(start, end);
  9385. }
  9386. var parameters = {};
  9387. var pairs = paramsString.split(/[&;]/);
  9388. for (var i = 0, len = pairs.length; i < len; ++i) {
  9389. var keyValue = pairs[i].split('=');
  9390. if (keyValue[0]) {
  9391. var key = keyValue[0];
  9392. try {
  9393. key = decodeURIComponent(key);
  9394. } catch (err) {
  9395. key = unescape(key);
  9396. }
  9397. // being liberal by replacing "+" with " "
  9398. var value = (keyValue[1] || '').replace(/\+/g, ' ');
  9399. try {
  9400. value = decodeURIComponent(value);
  9401. } catch (err) {
  9402. value = unescape(value);
  9403. }
  9404. // follow OGC convention of comma delimited values
  9405. value = value.split(',');
  9406. //if there's only one value, do not return as array
  9407. if (value.length == 1) {
  9408. value = value[0];
  9409. }
  9410. parameters[key] = value;
  9411. }
  9412. }
  9413. return parameters;
  9414. },
  9415. /**
  9416. * @memberOf CommonUtil
  9417. * @description 不断递增计数变量,用于生成唯一 ID。
  9418. * @type {number}
  9419. * @default 0
  9420. */
  9421. lastSeqID: 0,
  9422. /**
  9423. * @memberOf CommonUtil
  9424. * @description 创建唯一 ID 值。
  9425. * @param {string} [prefix] - 前缀。
  9426. * @returns {string} 唯一的 ID 值。
  9427. */
  9428. createUniqueID: function (prefix) {
  9429. if (prefix == null) {
  9430. prefix = 'id_';
  9431. }
  9432. Util_Util.lastSeqID += 1;
  9433. return prefix + Util_Util.lastSeqID;
  9434. },
  9435. /**
  9436. * @memberOf CommonUtil
  9437. * @description 判断并转化比例尺。
  9438. * @param {number} scale - 比例尺。
  9439. * @returns {number} 正常的 scale 值。
  9440. */
  9441. normalizeScale: function (scale) {
  9442. var normScale = scale > 1.0 ? 1.0 / scale : scale;
  9443. return normScale;
  9444. },
  9445. /**
  9446. * @memberOf CommonUtil
  9447. * @description 比例尺转分辨率。
  9448. * @param {number} scale - 比例尺。
  9449. * @param {string} [units='degrees'] - 比例尺单位。
  9450. * @returns {number} 转化后的分辨率。
  9451. */
  9452. getResolutionFromScale: function (scale, units) {
  9453. var resolution;
  9454. if (scale) {
  9455. if (units == null) {
  9456. units = 'degrees';
  9457. }
  9458. var normScale = Util_Util.normalizeScale(scale);
  9459. resolution = 1 / (normScale * INCHES_PER_UNIT[units] * DOTS_PER_INCH);
  9460. }
  9461. return resolution;
  9462. },
  9463. /**
  9464. * @memberOf CommonUtil
  9465. * @description 分辨率转比例尺。
  9466. * @param {number} resolution - 分辨率。
  9467. * @param {string} [units='degrees'] - 分辨率单位。
  9468. * @returns {number} 转化后的比例尺。
  9469. */
  9470. getScaleFromResolution: function (resolution, units) {
  9471. if (units == null) {
  9472. units = 'degrees';
  9473. }
  9474. var scale = resolution * INCHES_PER_UNIT[units] * DOTS_PER_INCH;
  9475. return scale;
  9476. },
  9477. /**
  9478. * @memberOf CommonUtil
  9479. * @description 获取浏览器相关信息。支持的浏览器包括:Opera,Internet Explorer,Safari,Firefox。
  9480. * @returns {Object} 浏览器名称、版本、设备名称。对应的属性分别为 name, version, device。
  9481. */
  9482. getBrowser: function () {
  9483. return Browser;
  9484. },
  9485. /**
  9486. * @memberOf CommonUtil
  9487. * @description 浏览器是否支持 Canvas。
  9488. * @returns {boolean} 当前浏览器是否支持 HTML5 Canvas。
  9489. */
  9490. isSupportCanvas,
  9491. /**
  9492. * @memberOf CommonUtil
  9493. * @description 判断浏览器是否支持 Canvas。
  9494. * @returns {boolean} 当前浏览器是否支持 HTML5 Canvas 。
  9495. */
  9496. supportCanvas: function () {
  9497. return Util_Util.isSupportCanvas;
  9498. },
  9499. /**
  9500. * @memberOf CommonUtil
  9501. * @description 判断一个 URL 请求是否在当前域中。
  9502. * @param {string} url - URL 请求字符串。
  9503. * @returns {boolean} URL 请求是否在当前域中。
  9504. */
  9505. isInTheSameDomain: function (url) {
  9506. if (!url) {
  9507. return true;
  9508. }
  9509. var index = url.indexOf('//');
  9510. var documentUrl = document.location.toString();
  9511. var documentIndex = documentUrl.indexOf('//');
  9512. if (index === -1) {
  9513. return true;
  9514. } else {
  9515. var protocol;
  9516. var substring = (protocol = url.substring(0, index));
  9517. var documentSubString = documentUrl.substring(documentIndex + 2);
  9518. documentIndex = documentSubString.indexOf('/');
  9519. var documentPortIndex = documentSubString.indexOf(':');
  9520. var documentDomainWithPort = documentSubString.substring(0, documentIndex);
  9521. //var documentPort;
  9522. var documentprotocol = document.location.protocol;
  9523. if (documentPortIndex !== -1) {
  9524. // documentPort = +documentSubString.substring(documentPortIndex, documentIndex);
  9525. } else {
  9526. documentDomainWithPort += ':' + (documentprotocol.toLowerCase() === 'http:' ? 80 : 443);
  9527. }
  9528. if (documentprotocol.toLowerCase() !== substring.toLowerCase()) {
  9529. return false;
  9530. }
  9531. substring = url.substring(index + 2);
  9532. var portIndex = substring.indexOf(':');
  9533. index = substring.indexOf('/');
  9534. var domainWithPort = substring.substring(0, index);
  9535. var domain;
  9536. if (portIndex !== -1) {
  9537. domain = substring.substring(0, portIndex);
  9538. } else {
  9539. domain = substring.substring(0, index);
  9540. domainWithPort += ':' + (protocol.toLowerCase() === 'http:' ? 80 : 443);
  9541. }
  9542. var documentDomain = document.domain;
  9543. if (domain === documentDomain && domainWithPort === documentDomainWithPort) {
  9544. return true;
  9545. }
  9546. }
  9547. return false;
  9548. },
  9549. /**
  9550. * @memberOf CommonUtil
  9551. * @description 计算 iServer 服务的 REST 图层的显示分辨率,需要从 iServer 的 REST 图层表述中获取 viewBounds、viewer、scale、coordUnit、datumAxis 五个参数,来进行计算。
  9552. * @param {Bounds} viewBounds - 地图的参照可视范围,即地图初始化时默认的地图显示范围。
  9553. * @param {Size} viewer - 地图初始化时默认的地图图片的尺寸。
  9554. * @param {number} scale - 地图初始化时默认的显示比例尺。
  9555. * @param {string} [coordUnit='degrees'] - 投影坐标系统的地图单位。
  9556. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则系统默认为 WGS84 参考系的椭球体长半轴 6378137。
  9557. * @returns {number} 图层显示分辨率。
  9558. */
  9559. calculateDpi: function (viewBounds, viewer, scale, coordUnit, datumAxis) {
  9560. //10000 是 0.1毫米与米的转换。DPI的计算公式:Viewer / DPI * 0.0254 * 10000 = ViewBounds * scale ,公式中的10000是为了提高计算结果的精度,以下出现的ratio皆为如此。
  9561. if (!viewBounds || !viewer || !scale) {
  9562. return;
  9563. }
  9564. var ratio = 10000,
  9565. rvbWidth = viewBounds.getWidth(),
  9566. rvbHeight = viewBounds.getHeight(),
  9567. rvWidth = viewer.w,
  9568. rvHeight = viewer.h;
  9569. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  9570. datumAxis = datumAxis || 6378137;
  9571. coordUnit = coordUnit || 'degrees';
  9572. var dpi;
  9573. if (
  9574. coordUnit.toLowerCase() === 'degree' ||
  9575. coordUnit.toLowerCase() === 'degrees' ||
  9576. coordUnit.toLowerCase() === 'dd'
  9577. ) {
  9578. let num1 = rvbWidth / rvWidth,
  9579. num2 = rvbHeight / rvHeight,
  9580. resolution = num1 > num2 ? num1 : num2;
  9581. dpi = (0.0254 * ratio) / resolution / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  9582. } else {
  9583. let resolution = rvbWidth / rvWidth;
  9584. dpi = (0.0254 * ratio) / resolution / scale / ratio;
  9585. }
  9586. return dpi;
  9587. },
  9588. /**
  9589. * @memberOf CommonUtil
  9590. * @description 将对象转换成 JSON 字符串。
  9591. * @param {Object} obj - 要转换成 JSON 的 Object 对象。
  9592. * @returns {string} 转换后的 JSON 对象。
  9593. */
  9594. toJSON: function (obj) {
  9595. var objInn = obj;
  9596. if (objInn == null) {
  9597. return null;
  9598. }
  9599. switch (objInn.constructor) {
  9600. case String:
  9601. //s = "'" + str.replace(/(["\\])/g, "\\$1") + "'"; string含有单引号出错
  9602. objInn = '"' + objInn.replace(/(["\\])/g, '\\$1') + '"';
  9603. objInn = objInn.replace(/\n/g, '\\n');
  9604. objInn = objInn.replace(/\r/g, '\\r');
  9605. objInn = objInn.replace('<', '&lt;');
  9606. objInn = objInn.replace('>', '&gt;');
  9607. objInn = objInn.replace(/%/g, '%25');
  9608. objInn = objInn.replace(/&/g, '%26');
  9609. return objInn;
  9610. case Array:
  9611. var arr = '';
  9612. for (var i = 0, len = objInn.length; i < len; i++) {
  9613. arr += Util_Util.toJSON(objInn[i]);
  9614. if (i !== objInn.length - 1) {
  9615. arr += ',';
  9616. }
  9617. }
  9618. return "[" + arr + "]";
  9619. case Number:
  9620. return isFinite(objInn) ? String(objInn) : null;
  9621. case Boolean:
  9622. return String(objInn);
  9623. case Date:
  9624. var dateStr =
  9625. '{' +
  9626. '\'__type\':"System.DateTime",' +
  9627. "'Year':" +
  9628. objInn.getFullYear() +
  9629. ',' +
  9630. "'Month':" +
  9631. (objInn.getMonth() + 1) +
  9632. ',' +
  9633. "'Day':" +
  9634. objInn.getDate() +
  9635. ',' +
  9636. "'Hour':" +
  9637. objInn.getHours() +
  9638. ',' +
  9639. "'Minute':" +
  9640. objInn.getMinutes() +
  9641. ',' +
  9642. "'Second':" +
  9643. objInn.getSeconds() +
  9644. ',' +
  9645. "'Millisecond':" +
  9646. objInn.getMilliseconds() +
  9647. ',' +
  9648. "'TimezoneOffset':" +
  9649. objInn.getTimezoneOffset() +
  9650. '}';
  9651. return dateStr;
  9652. default:
  9653. if (objInn['toJSON'] != null && typeof objInn['toJSON'] === 'function') {
  9654. return objInn.toJSON();
  9655. }
  9656. if (typeof objInn === 'object') {
  9657. if (objInn.length) {
  9658. let arr = [];
  9659. for (let i = 0, len = objInn.length; i < len; i++) {
  9660. arr.push(Util_Util.toJSON(objInn[i]));
  9661. }
  9662. return '[' + arr.join(',') + ']';
  9663. }
  9664. let arr = [];
  9665. for (let attr in objInn) {
  9666. //为解决Geometry类型头json时堆栈溢出的问题,attr == "parent"时不进行json转换
  9667. if (typeof objInn[attr] !== 'function' && attr !== 'CLASS_NAME' && attr !== 'parent') {
  9668. arr.push("'" + attr + "':" + Util_Util.toJSON(objInn[attr]));
  9669. }
  9670. }
  9671. if (arr.length > 0) {
  9672. return '{' + arr.join(',') + '}';
  9673. } else {
  9674. return '{}';
  9675. }
  9676. }
  9677. return objInn.toString();
  9678. }
  9679. },
  9680. /**
  9681. * @memberOf CommonUtil
  9682. * @description 根据比例尺和 DPI 计算屏幕分辨率。
  9683. * @category BaseTypes Util
  9684. * @param {number} scale - 比例尺。
  9685. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  9686. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  9687. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  9688. * @returns {number} 当前比例尺下的屏幕分辨率。
  9689. */
  9690. getResolutionFromScaleDpi: function (scale, dpi, coordUnit, datumAxis) {
  9691. var resolution = null,
  9692. ratio = 10000;
  9693. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  9694. datumAxis = datumAxis || 6378137;
  9695. coordUnit = coordUnit || '';
  9696. if (scale > 0 && dpi > 0) {
  9697. scale = Util_Util.normalizeScale(scale);
  9698. if (
  9699. coordUnit.toLowerCase() === 'degree' ||
  9700. coordUnit.toLowerCase() === 'degrees' ||
  9701. coordUnit.toLowerCase() === 'dd'
  9702. ) {
  9703. //scale = Util.normalizeScale(scale);
  9704. resolution = (0.0254 * ratio) / dpi / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  9705. return resolution;
  9706. } else {
  9707. resolution = (0.0254 * ratio) / dpi / scale / ratio;
  9708. return resolution;
  9709. }
  9710. }
  9711. return -1;
  9712. },
  9713. /**
  9714. * @memberOf CommonUtil
  9715. * @description 根据 resolution、dpi、coordUnit 和 datumAxis 计算比例尺。
  9716. * @param {number} resolution - 用于计算比例尺的地图分辨率。
  9717. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  9718. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  9719. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  9720. * @returns {number} 当前屏幕分辨率下的比例尺。
  9721. */
  9722. getScaleFromResolutionDpi: function (resolution, dpi, coordUnit, datumAxis) {
  9723. var scale = null,
  9724. ratio = 10000;
  9725. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  9726. datumAxis = datumAxis || 6378137;
  9727. coordUnit = coordUnit || '';
  9728. if (resolution > 0 && dpi > 0) {
  9729. if (
  9730. coordUnit.toLowerCase() === 'degree' ||
  9731. coordUnit.toLowerCase() === 'degrees' ||
  9732. coordUnit.toLowerCase() === 'dd'
  9733. ) {
  9734. scale = (0.0254 * ratio) / dpi / resolution / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  9735. return scale;
  9736. } else {
  9737. scale = (0.0254 * ratio) / dpi / resolution / ratio;
  9738. return scale;
  9739. }
  9740. }
  9741. return -1;
  9742. },
  9743. /**
  9744. * @memberOf CommonUtil
  9745. * @description 转换查询结果。
  9746. * @param {Object} result - 查询结果。
  9747. * @returns {Object} 转换后的查询结果。
  9748. */
  9749. transformResult: function (result) {
  9750. if (result.responseText && typeof result.responseText === 'string') {
  9751. result = JSON.parse(result.responseText);
  9752. }
  9753. return result;
  9754. },
  9755. /**
  9756. * @memberOf CommonUtil
  9757. * @description 属性拷贝,不拷贝方法类名(CLASS_NAME)等。
  9758. * @param {Object} [destination] - 拷贝目标。
  9759. * @param {Object} source - 源对象。
  9760. *
  9761. */
  9762. copyAttributes: function (destination, source) {
  9763. destination = destination || {};
  9764. if (source) {
  9765. for (var property in source) {
  9766. var value = source[property];
  9767. if (value !== undefined && property !== 'CLASS_NAME' && typeof value !== 'function') {
  9768. destination[property] = value;
  9769. }
  9770. }
  9771. }
  9772. return destination;
  9773. },
  9774. /**
  9775. * @memberOf CommonUtil
  9776. * @description 将源对象上的属性拷贝到目标对象上。(不拷贝 CLASS_NAME 和方法)
  9777. * @param {Object} [destination] - 目标对象。
  9778. * @param {Object} source - 源对象。
  9779. * @param {Array.<string>} clip - 源对象中禁止拷贝到目标对象的属性,目的是防止目标对象上不可修改的属性被篡改。
  9780. *
  9781. */
  9782. copyAttributesWithClip: function (destination, source, clip) {
  9783. destination = destination || {};
  9784. if (source) {
  9785. for (var property in source) {
  9786. //去掉禁止拷贝的属性
  9787. var isInClip = false;
  9788. if (clip && clip.length) {
  9789. for (var i = 0, len = clip.length; i < len; i++) {
  9790. if (property === clip[i]) {
  9791. isInClip = true;
  9792. break;
  9793. }
  9794. }
  9795. }
  9796. if (isInClip === true) {
  9797. continue;
  9798. }
  9799. var value = source[property];
  9800. if (value !== undefined && property !== 'CLASS_NAME' && typeof value !== 'function') {
  9801. destination[property] = value;
  9802. }
  9803. }
  9804. }
  9805. return destination;
  9806. },
  9807. /**
  9808. * @memberOf CommonUtil
  9809. * @description 克隆一个 Object 对象。
  9810. * @param {Object} obj - 需要克隆的对象。
  9811. * @returns {Object} 对象的拷贝对象,注意是新的对象,不是指向。
  9812. */
  9813. cloneObject: function (obj) {
  9814. // Handle the 3 simple types, and null or undefined
  9815. if (null === obj || 'object' !== typeof obj) {
  9816. return obj;
  9817. }
  9818. // Handle Date
  9819. if (obj instanceof Date) {
  9820. let copy = new Date();
  9821. copy.setTime(obj.getTime());
  9822. return copy;
  9823. }
  9824. // Handle Array
  9825. if (obj instanceof Array) {
  9826. let copy = obj.slice(0);
  9827. return copy;
  9828. }
  9829. // Handle Object
  9830. if (obj instanceof Object) {
  9831. let copy = {};
  9832. for (var attr in obj) {
  9833. if (obj.hasOwnProperty(attr)) {
  9834. copy[attr] = Util_Util.cloneObject(obj[attr]);
  9835. }
  9836. }
  9837. return copy;
  9838. }
  9839. throw new Error("Unable to copy obj! Its type isn't supported.");
  9840. },
  9841. /**
  9842. * @memberOf CommonUtil
  9843. * @description 判断两条线段是不是有交点。
  9844. * @param {GeometryPoint} a1 - 第一条线段的起始节点。
  9845. * @param {GeometryPoint} a2 - 第一条线段的结束节点。
  9846. * @param {GeometryPoint} b1 - 第二条线段的起始节点。
  9847. * @param {GeometryPoint} b2 - 第二条线段的结束节点。
  9848. * @returns {Object} 如果相交返回交点,如果不相交返回两条线段的位置关系。
  9849. */
  9850. lineIntersection: function (a1, a2, b1, b2) {
  9851. var intersectValue = null;
  9852. var k1;
  9853. var k2;
  9854. var b = (b2.x - b1.x) * (a1.y - b1.y) - (b2.y - b1.y) * (a1.x - b1.x);
  9855. var a = (a2.x - a1.x) * (a1.y - b1.y) - (a2.y - a1.y) * (a1.x - b1.x);
  9856. var ab = (b2.y - b1.y) * (a2.x - a1.x) - (b2.x - b1.x) * (a2.y - a1.y);
  9857. //ab==0代表两条线断的斜率一样
  9858. if (ab != 0) {
  9859. k1 = b / ab;
  9860. k2 = a / ab;
  9861. if (k1 >= 0 && k2 <= 1 && k1 <= 1 && k2 >= 0) {
  9862. intersectValue = new Geometry_Geometry.Point(a1.x + k1 * (a2.x - a1.x), a1.y + k1 * (a2.y - a1.y));
  9863. } else {
  9864. intersectValue = 'No Intersection';
  9865. }
  9866. } else {
  9867. if (b == 0 && a == 0) {
  9868. var maxy = Math.max(a1.y, a2.y);
  9869. var miny = Math.min(a1.y, a2.y);
  9870. var maxx = Math.max(a1.x, a2.x);
  9871. var minx = Math.min(a1.x, a2.x);
  9872. if (
  9873. (((b1.y >= miny && b1.y <= maxy) || (b2.y >= miny && b2.y <= maxy)) && b1.x >= minx && b1.x <= maxx) ||
  9874. (b2.x >= minx && b2.x <= maxx)
  9875. ) {
  9876. intersectValue = 'Coincident'; //重合
  9877. } else {
  9878. intersectValue = 'Parallel'; //平行
  9879. }
  9880. } else {
  9881. intersectValue = 'Parallel'; //平行
  9882. }
  9883. }
  9884. return intersectValue;
  9885. },
  9886. /**
  9887. * @memberOf CommonUtil
  9888. * @description 获取文本外接矩形宽度与高度。
  9889. * @param {ThemeStyle} style - 文本样式。
  9890. * @param {string} text - 文本内容。
  9891. * @param {Object} element - DOM 元素。
  9892. * @returns {Object} 裁剪后的宽度,高度信息。
  9893. */
  9894. getTextBounds: function (style, text, element) {
  9895. document.body.appendChild(element);
  9896. element.style.width = 'auto';
  9897. element.style.height = 'auto';
  9898. if (style.fontSize) {
  9899. element.style.fontSize = style.fontSize;
  9900. }
  9901. if (style.fontFamily) {
  9902. element.style.fontFamily = style.fontFamily;
  9903. }
  9904. if (style.fontWeight) {
  9905. element.style.fontWeight = style.fontWeight;
  9906. }
  9907. element.style.position = 'relative';
  9908. element.style.visibility = 'hidden';
  9909. //fix 在某些情况下,element内的文本变成竖起排列,导致宽度计算不正确的bug
  9910. element.style.display = 'inline-block';
  9911. element.innerHTML = text;
  9912. var textWidth = element.clientWidth;
  9913. var textHeight = element.clientHeight;
  9914. document.body.removeChild(element);
  9915. return {
  9916. textWidth: textWidth,
  9917. textHeight: textHeight
  9918. };
  9919. },
  9920. /**
  9921. * @memberOf CommonUtil
  9922. * @description 获取转换后的path路径。
  9923. * @param {string} path - 待转换的path,包含`{param}`。
  9924. * @param {Object} pathParams - path中待替换的参数。
  9925. * @returns {string} 转换后的path路径。
  9926. */
  9927. convertPath: function (path, pathParams) {
  9928. if (!pathParams) {
  9929. return path;
  9930. }
  9931. return path.replace(/\{([\w-\.]+)\}/g, (fullMatch, key) => {
  9932. var value;
  9933. if (pathParams.hasOwnProperty(key)) {
  9934. value = paramToString(pathParams[key]);
  9935. } else {
  9936. value = fullMatch;
  9937. }
  9938. return encodeURIComponent(value);
  9939. });
  9940. }
  9941. };
  9942. /**
  9943. * @enum INCHES_PER_UNIT
  9944. * @description 每单位的英尺数。
  9945. * @type {number}
  9946. * @private
  9947. */
  9948. const INCHES_PER_UNIT = {
  9949. inches: 1.0,
  9950. ft: 12.0,
  9951. mi: 63360.0,
  9952. m: 39.3701,
  9953. km: 39370.1,
  9954. dd: 4374754,
  9955. yd: 36
  9956. };
  9957. INCHES_PER_UNIT['in'] = INCHES_PER_UNIT.inches;
  9958. INCHES_PER_UNIT['degrees'] = INCHES_PER_UNIT.dd;
  9959. INCHES_PER_UNIT['nmi'] = 1852 * INCHES_PER_UNIT.m;
  9960. // Units from CS-Map
  9961. const METERS_PER_INCH = 0.0254000508001016002;
  9962. Util_Util.extend(INCHES_PER_UNIT, {
  9963. Inch: INCHES_PER_UNIT.inches,
  9964. Meter: 1.0 / METERS_PER_INCH, //EPSG:9001
  9965. Foot: 0.30480060960121920243 / METERS_PER_INCH, //EPSG:9003
  9966. IFoot: 0.3048 / METERS_PER_INCH, //EPSG:9002
  9967. ClarkeFoot: 0.3047972651151 / METERS_PER_INCH, //EPSG:9005
  9968. SearsFoot: 0.30479947153867624624 / METERS_PER_INCH, //EPSG:9041
  9969. GoldCoastFoot: 0.30479971018150881758 / METERS_PER_INCH, //EPSG:9094
  9970. IInch: 0.0254 / METERS_PER_INCH,
  9971. MicroInch: 0.0000254 / METERS_PER_INCH,
  9972. Mil: 0.0000000254 / METERS_PER_INCH,
  9973. Centimeter: 0.01 / METERS_PER_INCH,
  9974. Kilometer: 1000.0 / METERS_PER_INCH, //EPSG:9036
  9975. Yard: 0.91440182880365760731 / METERS_PER_INCH,
  9976. SearsYard: 0.914398414616029 / METERS_PER_INCH, //EPSG:9040
  9977. IndianYard: 0.91439853074444079983 / METERS_PER_INCH, //EPSG:9084
  9978. IndianYd37: 0.91439523 / METERS_PER_INCH, //EPSG:9085
  9979. IndianYd62: 0.9143988 / METERS_PER_INCH, //EPSG:9086
  9980. IndianYd75: 0.9143985 / METERS_PER_INCH, //EPSG:9087
  9981. IndianFoot: 0.30479951 / METERS_PER_INCH, //EPSG:9080
  9982. IndianFt37: 0.30479841 / METERS_PER_INCH, //EPSG:9081
  9983. IndianFt62: 0.3047996 / METERS_PER_INCH, //EPSG:9082
  9984. IndianFt75: 0.3047995 / METERS_PER_INCH, //EPSG:9083
  9985. Mile: 1609.34721869443738887477 / METERS_PER_INCH,
  9986. IYard: 0.9144 / METERS_PER_INCH, //EPSG:9096
  9987. IMile: 1609.344 / METERS_PER_INCH, //EPSG:9093
  9988. NautM: 1852.0 / METERS_PER_INCH, //EPSG:9030
  9989. 'Lat-66': 110943.316488932731 / METERS_PER_INCH,
  9990. 'Lat-83': 110946.25736872234125 / METERS_PER_INCH,
  9991. Decimeter: 0.1 / METERS_PER_INCH,
  9992. Millimeter: 0.001 / METERS_PER_INCH,
  9993. Dekameter: 10.0 / METERS_PER_INCH,
  9994. Decameter: 10.0 / METERS_PER_INCH,
  9995. Hectometer: 100.0 / METERS_PER_INCH,
  9996. GermanMeter: 1.0000135965 / METERS_PER_INCH, //EPSG:9031
  9997. CaGrid: 0.999738 / METERS_PER_INCH,
  9998. ClarkeChain: 20.1166194976 / METERS_PER_INCH, //EPSG:9038
  9999. GunterChain: 20.11684023368047 / METERS_PER_INCH, //EPSG:9033
  10000. BenoitChain: 20.116782494375872 / METERS_PER_INCH, //EPSG:9062
  10001. SearsChain: 20.11676512155 / METERS_PER_INCH, //EPSG:9042
  10002. ClarkeLink: 0.201166194976 / METERS_PER_INCH, //EPSG:9039
  10003. GunterLink: 0.2011684023368047 / METERS_PER_INCH, //EPSG:9034
  10004. BenoitLink: 0.20116782494375872 / METERS_PER_INCH, //EPSG:9063
  10005. SearsLink: 0.2011676512155 / METERS_PER_INCH, //EPSG:9043
  10006. Rod: 5.02921005842012 / METERS_PER_INCH,
  10007. IntnlChain: 20.1168 / METERS_PER_INCH, //EPSG:9097
  10008. IntnlLink: 0.201168 / METERS_PER_INCH, //EPSG:9098
  10009. Perch: 5.02921005842012 / METERS_PER_INCH,
  10010. Pole: 5.02921005842012 / METERS_PER_INCH,
  10011. Furlong: 201.1684023368046 / METERS_PER_INCH,
  10012. Rood: 3.778266898 / METERS_PER_INCH,
  10013. CapeFoot: 0.3047972615 / METERS_PER_INCH,
  10014. Brealey: 375.0 / METERS_PER_INCH,
  10015. ModAmFt: 0.304812252984505969011938 / METERS_PER_INCH,
  10016. Fathom: 1.8288 / METERS_PER_INCH,
  10017. 'NautM-UK': 1853.184 / METERS_PER_INCH,
  10018. '50kilometers': 50000.0 / METERS_PER_INCH,
  10019. '150kilometers': 150000.0 / METERS_PER_INCH
  10020. });
  10021. //unit abbreviations supported by PROJ.4
  10022. Util_Util.extend(INCHES_PER_UNIT, {
  10023. mm: INCHES_PER_UNIT['Meter'] / 1000.0,
  10024. cm: INCHES_PER_UNIT['Meter'] / 100.0,
  10025. dm: INCHES_PER_UNIT['Meter'] * 100.0,
  10026. km: INCHES_PER_UNIT['Meter'] * 1000.0,
  10027. kmi: INCHES_PER_UNIT['nmi'], //International Nautical Mile
  10028. fath: INCHES_PER_UNIT['Fathom'], //International Fathom
  10029. ch: INCHES_PER_UNIT['IntnlChain'], //International Chain
  10030. link: INCHES_PER_UNIT['IntnlLink'], //International Link
  10031. 'us-in': INCHES_PER_UNIT['inches'], //U.S. Surveyor's Inch
  10032. 'us-ft': INCHES_PER_UNIT['Foot'], //U.S. Surveyor's Foot
  10033. 'us-yd': INCHES_PER_UNIT['Yard'], //U.S. Surveyor's Yard
  10034. 'us-ch': INCHES_PER_UNIT['GunterChain'], //U.S. Surveyor's Chain
  10035. 'us-mi': INCHES_PER_UNIT['Mile'], //U.S. Surveyor's Statute Mile
  10036. 'ind-yd': INCHES_PER_UNIT['IndianYd37'], //Indian Yard
  10037. 'ind-ft': INCHES_PER_UNIT['IndianFt37'], //Indian Foot
  10038. 'ind-ch': 20.11669506 / METERS_PER_INCH //Indian Chain
  10039. });
  10040. //将服务端的地图单位转成SuperMap的地图单位
  10041. INCHES_PER_UNIT['degree'] = INCHES_PER_UNIT.dd;
  10042. INCHES_PER_UNIT['meter'] = INCHES_PER_UNIT.m;
  10043. INCHES_PER_UNIT['foot'] = INCHES_PER_UNIT.ft;
  10044. INCHES_PER_UNIT['inch'] = INCHES_PER_UNIT.inches;
  10045. INCHES_PER_UNIT['mile'] = INCHES_PER_UNIT.mi;
  10046. INCHES_PER_UNIT['kilometer'] = INCHES_PER_UNIT.km;
  10047. INCHES_PER_UNIT['yard'] = INCHES_PER_UNIT.yd;
  10048. function paramToString(param) {
  10049. if (param == undefined || param == null) {
  10050. return '';
  10051. }
  10052. if (param instanceof Date) {
  10053. return param.toJSON();
  10054. }
  10055. if (canBeJsonified(param)) {
  10056. return JSON.stringify(param);
  10057. }
  10058. return param.toString();
  10059. }
  10060. function canBeJsonified(str) {
  10061. if (typeof str !== 'string' && typeof str !== 'object') {
  10062. return false;
  10063. }
  10064. try {
  10065. const type = str.toString();
  10066. return type === '[object Object]' || type === '[object Array]';
  10067. } catch (err) {
  10068. return false;
  10069. }
  10070. }
  10071. ;// CONCATENATED MODULE: ./src/common/commontypes/LonLat.js
  10072. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  10073. * This program are made available under the terms of the Apache License, Version 2.0
  10074. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10075. /**
  10076. * @class LonLat
  10077. * @category BaseTypes Geometry
  10078. * @classdesc 这个类用来表示经度和纬度对。
  10079. * @param {number|Array.<number>} [lon=0.0] - 地图单位上的 X 轴坐标或者横纵坐标组成的数组;如果地图是地理投影,则此值是经度,否则,此值是地图地理位置的 x 坐标。
  10080. * @param {number} [lat=0.0] - 地图单位上的 Y 轴坐标,如果地图是地理投影,则此值是纬度,否则,此值是地图地理位置的 y 坐标。
  10081. * @example
  10082. * var lonLat = new LonLat(30,45);
  10083. * @usage
  10084. */
  10085. class LonLat {
  10086. constructor(lon, lat) {
  10087. if (Util_Util.isArray(lon)) {
  10088. lat = lon[1];
  10089. lon = lon[0];
  10090. }
  10091. /**
  10092. * @member {number} [LonLat.prototype.lon=0.0]
  10093. * @description 地图的单位的 X 轴(横轴)坐标。
  10094. */
  10095. this.lon = lon ? Util_Util.toFloat(lon) : 0.0;
  10096. /**
  10097. * @member {number} [LonLat.prototype.lat=0.0]
  10098. * @description 地图的单位的 Y 轴(纵轴)坐标。
  10099. */
  10100. this.lat = lat ? Util_Util.toFloat(lat) : 0.0;
  10101. this.CLASS_NAME = "SuperMap.LonLat";
  10102. }
  10103. /**
  10104. * @function LonLat.prototype.toString
  10105. * @description 返回此对象的字符串形式。
  10106. * @example
  10107. * var lonLat = new LonLat(100,50);
  10108. * var str = lonLat.toString();
  10109. * @returns {string} 例如: "lon=100,lat=50"。
  10110. */
  10111. toString() {
  10112. return ("lon=" + this.lon + ",lat=" + this.lat);
  10113. }
  10114. /**
  10115. * @function LonLat.prototype.toShortString
  10116. * @description 将经度纬度转换成简单字符串。
  10117. * @example
  10118. * var lonLat = new LonLat(100,50);
  10119. * var str = lonLat.toShortString();
  10120. * @returns {string} 处理后的经纬度字符串。例如:"100,50"。
  10121. */
  10122. toShortString() {
  10123. return (this.lon + "," + this.lat);
  10124. }
  10125. /**
  10126. * @function LonLat.prototype.clone
  10127. * @description 复制坐标对象,并返回复制后的新对象。
  10128. * @example
  10129. * var lonLat1 = new LonLat(100,50);
  10130. * var lonLat2 = lonLat1.clone();
  10131. * @returns {LonLat} 相同坐标值的新的坐标对象。
  10132. */
  10133. clone() {
  10134. return new LonLat(this.lon, this.lat);
  10135. }
  10136. /**
  10137. * @function LonLat.prototype.add
  10138. * @description 在已有坐标对象的经纬度基础上加上新的坐标经纬度,并返回新的坐标对象。
  10139. * @example
  10140. * var lonLat1 = new LonLat(100,50);
  10141. * //lonLat2 是新的对象
  10142. * var lonLat2 = lonLat1.add(100,50);
  10143. * @param {number} lon - 经度参数。
  10144. * @param {number} lat - 纬度参数。
  10145. * @returns {LonLat} 新的 LonLat 对象,此对象的经纬度是由传入的经纬度与当前的经纬度相加所得。
  10146. */
  10147. add(lon, lat) {
  10148. if ((lon == null) || (lat == null)) {
  10149. throw new TypeError('LonLat.add cannot receive null values');
  10150. }
  10151. return new LonLat(this.lon + Util_Util.toFloat(lon),
  10152. this.lat + Util_Util.toFloat(lat));
  10153. }
  10154. /**
  10155. * @function LonLat.prototype.equals
  10156. * @description 判断两个坐标对象是否相等。
  10157. * @example
  10158. * var lonLat1 = new LonLat(100,50);
  10159. * var lonLat2 = new LonLat(100,50);
  10160. * var isEquals = lonLat1.equals(lonLat2);
  10161. * @param {LonLat} ll - 需要进行比较的坐标对象。
  10162. * @returns {boolean} 如果LonLat对象的经纬度和传入的经纬度一致则返回true,不一
  10163. * 致或传入的ll参数为NULL则返回false。
  10164. */
  10165. equals(ll) {
  10166. var equals = false;
  10167. if (ll != null) {
  10168. equals = ((this.lon === ll.lon && this.lat === ll.lat) ||
  10169. (isNaN(this.lon) && isNaN(this.lat) && isNaN(ll.lon) && isNaN(ll.lat)));
  10170. }
  10171. return equals;
  10172. }
  10173. /**
  10174. * @function LonLat.prototype.wrapDateLine
  10175. * @description 通过传入的范围对象对坐标对象转换到该范围内。
  10176. * 如果经度小于给定范围最小精度,则在原经度基础上加上范围宽度,直到精度在范围内为止,如果经度大于给定范围则在原经度基础上减去范围宽度。
  10177. * 即指将不在经度范围内的坐标转换到范围以内(只会转换 lon,不会转换 lat,主要用于转移到日界线以内)。
  10178. * @example
  10179. * var lonLat1 = new LonLat(420,50);
  10180. * var lonLat2 = lonLat1.wrapDateLine(
  10181. * new Bounds(-180,-90,180,90)
  10182. * );
  10183. * @param {Bounds} maxExtent - 最大边界的范围。
  10184. * @returns {LonLat} 将坐标转换到范围对象以内,并返回新的坐标。
  10185. */
  10186. wrapDateLine(maxExtent) {
  10187. var newLonLat = this.clone();
  10188. if (maxExtent) {
  10189. //shift right?
  10190. while (newLonLat.lon < maxExtent.left) {
  10191. newLonLat.lon += maxExtent.getWidth();
  10192. }
  10193. //shift left?
  10194. while (newLonLat.lon > maxExtent.right) {
  10195. newLonLat.lon -= maxExtent.getWidth();
  10196. }
  10197. }
  10198. return newLonLat;
  10199. }
  10200. /**
  10201. *
  10202. * @function LonLat.prototype.destroy
  10203. * @description 销毁此对象。
  10204. * 销毁后此对象的所有属性为 null,而不是初始值。
  10205. * @example
  10206. * var lonLat = new LonLat(100,50);
  10207. * lonLat.destroy();
  10208. */
  10209. destroy() {
  10210. this.lon = null;
  10211. this.lat = null;
  10212. }
  10213. /**
  10214. * @function LonLat.fromString
  10215. * @description 通过字符串生成一个 {@link LonLat} 对象。
  10216. * @example
  10217. * var str = "100,50";
  10218. * var lonLat = LonLat.fromString(str);
  10219. * @param {string} str - 字符串的格式:Lon+","+Lat。如:"100,50"。
  10220. * @returns {LonLat} {@link LonLat} 对象。
  10221. */
  10222. static fromString(str) {
  10223. var pair = str.split(",");
  10224. return new LonLat(pair[0], pair[1]);
  10225. }
  10226. /**
  10227. * @function LonLat.fromArray
  10228. * @description 通过数组生成一个 {@link LonLat} 对象。
  10229. * @param {Array.<number>} arr - 数组的格式,长度只能为2,:[Lon,Lat]。如:[5,-42]。
  10230. * @returns {LonLat} {@link LonLat} 对象。
  10231. */
  10232. static fromArray(arr) {
  10233. var gotArr = Util_Util.isArray(arr),
  10234. lon = gotArr && arr[0],
  10235. lat = gotArr && arr[1];
  10236. return new LonLat(lon, lat);
  10237. }
  10238. }
  10239. ;// CONCATENATED MODULE: ./src/common/commontypes/Bounds.js
  10240. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  10241. * This program are made available under the terms of the Apache License, Version 2.0
  10242. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10243. /**
  10244. * @class Bounds
  10245. * @deprecatedclass SuperMap.Bounds
  10246. * @category BaseTypes Geometry
  10247. * @classdesc 表示边界类实例。使用 bounds 之前需要设置 left,bottom,right,top 四个属性,这些属性的初始值为 null。
  10248. * @param {number|Array.<number>} [left] - 如果是number,则表示左边界,注意考虑宽度,理论上小于 right 值。如果是数组,则表示 [left, bottom, right, top] 左下右上组成的数组。
  10249. * @param {number} [bottom] - 下边界。考虑高度,理论上小于 top 值。
  10250. * @param {number} [right] - 右边界。
  10251. * @param {number} [top] - 上边界。
  10252. * @example
  10253. * var bounds = new Bounds();
  10254. * bounds.extend(new LonLat(4,5));
  10255. * bounds.extend(new LonLat(5,6));
  10256. * bounds.toBBOX(); // returns 4,5,5,6
  10257. * @usage
  10258. */
  10259. class Bounds {
  10260. constructor(left, bottom, right, top) {
  10261. if (Util_Util.isArray(left)) {
  10262. top = left[3];
  10263. right = left[2];
  10264. bottom = left[1];
  10265. left = left[0];
  10266. }
  10267. /**
  10268. * @member {number} Bounds.prototype.left
  10269. * @description 最小的水平坐标系。
  10270. */
  10271. this.left = left != null ? Util_Util.toFloat(left) : this.left;
  10272. /**
  10273. * @member {number} Bounds.prototype.bottom
  10274. * @description 最小的垂直坐标系。
  10275. */
  10276. this.bottom = bottom != null ? Util_Util.toFloat(bottom) : this.bottom;
  10277. /**
  10278. * @member {number} Bounds.prototype.right
  10279. * @description 最大的水平坐标系。
  10280. */
  10281. this.right = right != null ? Util_Util.toFloat(right) : this.right;
  10282. /**
  10283. * @member {number} Bounds.prototype.top
  10284. * @description 最大的垂直坐标系。
  10285. */
  10286. this.top = top != null ? Util_Util.toFloat(top) : this.top;
  10287. /**
  10288. * @member {LonLat} Bounds.prototype.centerLonLat
  10289. * @description bounds 的地图空间的中心点。用 getCenterLonLat() 获得。
  10290. */
  10291. this.centerLonLat = null;
  10292. this.CLASS_NAME = "SuperMap.Bounds";
  10293. }
  10294. /**
  10295. * @function Bounds.prototype.clone
  10296. * @description 复制当前 bounds 对象。
  10297. * @example
  10298. * var bounds1 = new Bounds(-180,-90,180,90);
  10299. * var bounds2 = bounds1.clone();
  10300. * @returns {Bounds} 克隆后的 bounds。
  10301. */
  10302. clone() {
  10303. return new Bounds(this.left, this.bottom,
  10304. this.right, this.top);
  10305. }
  10306. /**
  10307. * @function Bounds.prototype.equals
  10308. * @description 判断两个 bounds 对象是否相等。
  10309. * @example
  10310. * var bounds1 = new Bounds(-180,-90,180,90);
  10311. * var bounds2 = new Bounds(-180,-90,180,90);
  10312. * var isEquals = bounds1.equals(bounds2);
  10313. * @param {Bounds} bounds - 需要进行计较的 bounds。
  10314. * @returns {boolean} 如果 bounds 对象的边和传入的 bounds 一致则返回 true,不一致或传入的 bounds 参数为 NULL 则返回 false。
  10315. */
  10316. equals(bounds) {
  10317. var equals = false;
  10318. if (bounds != null) {
  10319. equals = ((this.left === bounds.left) &&
  10320. (this.right === bounds.right) &&
  10321. (this.top === bounds.top) &&
  10322. (this.bottom === bounds.bottom));
  10323. }
  10324. return equals;
  10325. }
  10326. /**
  10327. * @function Bounds.prototype.toString
  10328. * @description 返回此对象的字符串形式。
  10329. * @example
  10330. * var bounds = new Bounds(-180,-90,180,90);
  10331. * var str = bounds.toString();
  10332. * @returns {string} 边界对象的字符串表示形式(left,bottom,right,top),例如: "-180,-90,180,90"。
  10333. */
  10334. toString() {
  10335. return [this.left, this.bottom, this.right, this.top].join(",");
  10336. }
  10337. /**
  10338. * @function Bounds.prototype.toArray
  10339. * @description 边界对象的数组表示形式。
  10340. * @example
  10341. * var bounds = new Bounds(-180,-90,100,80);
  10342. * //array1 = [-180,-90,100,80];
  10343. * var array1 = bounds.toArray();
  10344. * //array1 = [-90,-180,80,100];
  10345. * var array2 = bounds.toArray(true);
  10346. * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
  10347. * 如果设为 true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  10348. * @returns {Array.<number>} left, bottom, right, top 数组。
  10349. */
  10350. toArray(reverseAxisOrder) {
  10351. if (reverseAxisOrder === true) {
  10352. return [this.bottom, this.left, this.top, this.right];
  10353. } else {
  10354. return [this.left, this.bottom, this.right, this.top];
  10355. }
  10356. }
  10357. /**
  10358. * @function Bounds.prototype.toBBOX
  10359. * @description 取小数点后 decimal 位数字进行四舍五入再转换为 BBOX 字符串。
  10360. * @example
  10361. * var bounds = new Bounds(-1.1234567,-1.7654321,1.4444444,1.5555555);
  10362. * //str1 = "-1.123457,-1.765432,1.444444,1.555556";
  10363. * var str1 = bounds.toBBOX();
  10364. * //str2 = "-1.1,-1.8,1.4,1.6";
  10365. * var str2 = bounds.toBBOX(1);
  10366. * //str2 = "-1.8,-1.1,1.6,1.4";
  10367. * var str2 = bounds.toBBOX(1,true);
  10368. * @param {number} [decimal=6] - 边界方位坐标的有效数字个数。
  10369. * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。
  10370. * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  10371. * @returns {string} 边界对象的字符串表示形式,如:"5,42,10,45"。
  10372. */
  10373. toBBOX(decimal, reverseAxisOrder) {
  10374. if (decimal == null) {
  10375. decimal = 6;
  10376. }
  10377. var mult = Math.pow(10, decimal);
  10378. var xmin = Math.round(this.left * mult) / mult;
  10379. var ymin = Math.round(this.bottom * mult) / mult;
  10380. var xmax = Math.round(this.right * mult) / mult;
  10381. var ymax = Math.round(this.top * mult) / mult;
  10382. if (reverseAxisOrder === true) {
  10383. return ymin + "," + xmin + "," + ymax + "," + xmax;
  10384. } else {
  10385. return xmin + "," + ymin + "," + xmax + "," + ymax;
  10386. }
  10387. }
  10388. ///**
  10389. // * @function Bounds.prototype.toGeometry
  10390. // * @description 基于当前边界范围创建一个新的多边形对象。
  10391. // * @example
  10392. // * var bounds = new Bounds(-180,-90,100,80);
  10393. // * // Polygon对象
  10394. // * var geo = bounds.toGeometry();
  10395. // * @returns {GeometryPolygon} 基于当前 bounds 坐标创建的新的多边形。
  10396. // */
  10397. // toGeometry() {
  10398. // return new Polygon([
  10399. // new LinearRing([
  10400. // new Point(this.left, this.bottom),
  10401. // new Point(this.right, this.bottom),
  10402. // new Point(this.right, this.top),
  10403. // new Point(this.left, this.top)
  10404. // ])
  10405. // ]);
  10406. // }
  10407. /**
  10408. * @function Bounds.prototype.getWidth
  10409. * @description 获取 bounds 的宽度。
  10410. * @example
  10411. * var bounds = new Bounds(-180,-90,100,80);
  10412. * //width = 280;
  10413. * var width = bounds.getWidth();
  10414. * @returns {number} 获取当前 bounds 的宽度(right 减去 left)。
  10415. */
  10416. getWidth() {
  10417. return (this.right - this.left);
  10418. }
  10419. /**
  10420. * @function Bounds.prototype.getHeight
  10421. * @description 获取 bounds 的高度。
  10422. * @example
  10423. * var bounds = new Bounds(-180,-90,100,80);
  10424. * //height = 170;
  10425. * var height = bounds.getHeight();
  10426. * @returns {number} 边界高度(top 减去 bottom)。
  10427. */
  10428. getHeight() {
  10429. return (this.top - this.bottom);
  10430. }
  10431. /**
  10432. * @function Bounds.prototype.getSize
  10433. * @description 获取边框大小。
  10434. * @example
  10435. * var bounds = new Bounds(-180,-90,100,80);
  10436. * var size = bounds.getSize();
  10437. * @returns {Size} 边框大小。
  10438. */
  10439. getSize() {
  10440. return new Size(this.getWidth(), this.getHeight());
  10441. }
  10442. /**
  10443. * @function Bounds.prototype.getCenterPixel
  10444. * @description 获取像素格式的范围中心点。
  10445. * @example
  10446. * var bounds = new Bounds(-180,-90,100,80);
  10447. * var pixel = bounds.getCenterPixel();
  10448. * @returns {Pixel} 像素格式的当前范围的中心点。
  10449. */
  10450. getCenterPixel() {
  10451. return new Pixel((this.left + this.right) / 2,
  10452. (this.bottom + this.top) / 2);
  10453. }
  10454. /**
  10455. * @function Bounds.prototype.getCenterLonLat
  10456. * @description 获取地理格式的范围中心点。
  10457. * @example
  10458. * var bounds = new Bounds(-180,-90,100,80);
  10459. * var lonlat = bounds.getCenterLonLat();
  10460. * @returns {LonLat} 当前地理范围的中心点。
  10461. */
  10462. getCenterLonLat() {
  10463. if (!this.centerLonLat) {
  10464. this.centerLonLat = new LonLat(
  10465. (this.left + this.right) / 2, (this.bottom + this.top) / 2
  10466. );
  10467. }
  10468. return this.centerLonLat;
  10469. }
  10470. /**
  10471. * @function Bounds.prototype.scale
  10472. * @description 按照比例扩大/缩小出一个新的 bounds。
  10473. * @example
  10474. * var bounds = new Bounds(-50,-50,40,40);
  10475. * var bounds2 = bounds.scale(2);
  10476. * @param {number} [ratio=1] - 需要扩大的比例。
  10477. * @param {(Pixel|LonLat)} [origin] - 扩大时的基准点,默认为当前 bounds 的中心点。
  10478. * @returns {Bounds} 通过 ratio、origin 计算得到的新的边界范围。
  10479. */
  10480. scale(ratio, origin) {
  10481. ratio = ratio ? ratio : 1;
  10482. if (origin == null) {
  10483. origin = this.getCenterLonLat();
  10484. }
  10485. var origx, origy;
  10486. // get origin coordinates
  10487. if (origin.CLASS_NAME === "SuperMap.LonLat") {
  10488. origx = origin.lon;
  10489. origy = origin.lat;
  10490. } else {
  10491. origx = origin.x;
  10492. origy = origin.y;
  10493. }
  10494. var left = (this.left - origx) * ratio + origx;
  10495. var bottom = (this.bottom - origy) * ratio + origy;
  10496. var right = (this.right - origx) * ratio + origx;
  10497. var top = (this.top - origy) * ratio + origy;
  10498. return new Bounds(left, bottom, right, top);
  10499. }
  10500. /**
  10501. * @function Bounds.prototype.add
  10502. * @description 在当前的 Bounds 上按照传入的坐标点进行平移,返回新的范围。
  10503. * @example
  10504. * var bounds1 = new Bounds(-50,-50,40,40);
  10505. * //bounds2 是新的 bounds
  10506. * var bounds2 = bounds.add(20,10);
  10507. * @param {number} x - 坐标点的 x 坐标。
  10508. * @param {number} y - 坐标点的 y 坐标。
  10509. * @returns {Bounds} 新的 bounds,此 bounds 的坐标是由传入的 x,y 参数与当前 bounds 坐标计算所得。
  10510. */
  10511. add(x, y) {
  10512. if ((x == null) || (y == null)) {
  10513. throw new TypeError('Bounds.add cannot receive null values');
  10514. }
  10515. return new Bounds(this.left + x, this.bottom + y,
  10516. this.right + x, this.top + y);
  10517. }
  10518. /**
  10519. * @function Bounds.prototype.extend
  10520. * @description 在当前 bounds 上扩展 bounds,支持 point,lonlat 和 bounds。扩展后的 bounds 的范围是两者的结合。
  10521. * @example
  10522. * var bounds1 = new Bounds(-50,-50,40,40);
  10523. * //bounds 改变
  10524. * bounds.extend(new LonLat(50,60));
  10525. * @param {GeometryPoint|LonLat|Bounds} object - 可以是 point、lonlat 和 bounds。
  10526. */
  10527. extend(object) {
  10528. var bounds = null;
  10529. if (object) {
  10530. // clear cached center location
  10531. switch (object.CLASS_NAME) {
  10532. case "SuperMap.LonLat":
  10533. bounds = new Bounds(object.lon, object.lat,
  10534. object.lon, object.lat);
  10535. break;
  10536. case "SuperMap.Geometry.Point":
  10537. bounds = new Bounds(object.x, object.y,
  10538. object.x, object.y);
  10539. break;
  10540. case "SuperMap.Bounds":
  10541. bounds = object;
  10542. break;
  10543. }
  10544. if (bounds) {
  10545. this.centerLonLat = null;
  10546. if ((this.left == null) || (bounds.left < this.left)) {
  10547. this.left = bounds.left;
  10548. }
  10549. if ((this.bottom == null) || (bounds.bottom < this.bottom)) {
  10550. this.bottom = bounds.bottom;
  10551. }
  10552. if ((this.right == null) || (bounds.right > this.right)) {
  10553. this.right = bounds.right;
  10554. }
  10555. if ((this.top == null) || (bounds.top > this.top)) {
  10556. this.top = bounds.top;
  10557. }
  10558. }
  10559. }
  10560. }
  10561. /**
  10562. * @function Bounds.prototype.containsLonLat
  10563. * @description 判断传入的坐标是否在范围内。
  10564. * @example
  10565. * var bounds1 = new Bounds(-50,-50,40,40);
  10566. * //isContains1 = true
  10567. * //这里的第二个参数可以直接为 boolean 类型,也就是inclusive
  10568. * var isContains1 = bounds.containsLonLat(new LonLat(40,40),true);
  10569. *
  10570. * //(40,40)在范围内,同样(40+360,40)也在范围内
  10571. * var bounds2 = new Bounds(-50,-50,40,40);
  10572. * //isContains2 = true;
  10573. * var isContains2 = bounds2.containsLonLat(
  10574. * new LonLat(400,40),
  10575. * {
  10576. * inclusive:true,
  10577. * //全球的范围
  10578. * worldBounds: new Bounds(-180,-90,180,90)
  10579. * }
  10580. * );
  10581. * @param {(LonLat|Object)} ll - <LonLat> 对象或者是一个包含 'lon' 与 'lat' 属性的对象。
  10582. * @param {Object} options - 可选参数。
  10583. * @param {boolean} [options.inclusive=true] - 是否包含边界。
  10584. * @param {Bounds} [options.worldBounds] - 如果提供 worldBounds 参数, 如果 ll 参数提供的坐标超出了世界边界(worldBounds),
  10585. * 但是通过日界线的转化可以被包含, 它将被认为是包含在该范围内的。
  10586. * @returns {boolean} 传入坐标是否包含在范围内。
  10587. */
  10588. containsLonLat(ll, options) {
  10589. if (typeof options === "boolean") {
  10590. options = {inclusive: options};
  10591. }
  10592. options = options || {};
  10593. var contains = this.contains(ll.lon, ll.lat, options.inclusive),
  10594. worldBounds = options.worldBounds;
  10595. //日界线以外的也有可能算包含,
  10596. if (worldBounds && !contains) {
  10597. var worldWidth = worldBounds.getWidth();
  10598. var worldCenterX = (worldBounds.left + worldBounds.right) / 2;
  10599. //这一步很关键
  10600. var worldsAway = Math.round((ll.lon - worldCenterX) / worldWidth);
  10601. contains = this.containsLonLat({
  10602. lon: ll.lon - worldsAway * worldWidth,
  10603. lat: ll.lat
  10604. }, {inclusive: options.inclusive});
  10605. }
  10606. return contains;
  10607. }
  10608. /**
  10609. * @function Bounds.prototype.containsPixel
  10610. * @description 判断传入的像素是否在范围内。直接匹配大小,不涉及像素和地理转换。
  10611. * @example
  10612. * var bounds = new Bounds(-50,-50,40,40);
  10613. * //isContains = true
  10614. * var isContains = bounds.containsPixel(new Pixel(40,40),true);
  10615. * @param {Pixel} px - 提供的像素参数。
  10616. * @param {boolean} [inclusive=true] - 是否包含边界。
  10617. * @returns {boolean} 传入的 pixel 在当前边界范围之内。
  10618. */
  10619. containsPixel(px, inclusive) {
  10620. return this.contains(px.x, px.y, inclusive);
  10621. }
  10622. /**
  10623. * @function Bounds.prototype.contains
  10624. * @description 判断传入的 x,y 坐标值是否在范围内。
  10625. * @example
  10626. * var bounds = new Bounds(-50,-50,40,40);
  10627. * //isContains = true
  10628. * var isContains = bounds.contains(40,40,true);
  10629. * @param {number} x - x 坐标值。
  10630. * @param {number} y - y 坐标值。
  10631. * @param {boolean} [inclusive=true] - 是否包含边界。
  10632. * @returns {boolean} 传入的 x,y 坐标是否在当前范围内。
  10633. */
  10634. contains(x, y, inclusive) {
  10635. //set default
  10636. if (inclusive == null) {
  10637. inclusive = true;
  10638. }
  10639. if (x == null || y == null) {
  10640. return false;
  10641. }
  10642. //x = Util.toFloat(x);
  10643. //y = Util.toFloat(y);
  10644. var contains = false;
  10645. if (inclusive) {
  10646. contains = ((x >= this.left) && (x <= this.right) &&
  10647. (y >= this.bottom) && (y <= this.top));
  10648. } else {
  10649. contains = ((x > this.left) && (x < this.right) &&
  10650. (y > this.bottom) && (y < this.top));
  10651. }
  10652. return contains;
  10653. }
  10654. /**
  10655. * @function Bounds.prototype.intersectsBounds
  10656. * @description 判断目标边界范围是否与当前边界范围相交。如果两个边界范围中的任意边缘相交或者一个边界包含了另外一个就认为这两个边界相交。
  10657. * @example
  10658. * var bounds = new Bounds(-180,-90,100,80);
  10659. * var isIntersects = bounds.intersectsBounds(
  10660. * new Bounds(-170,-90,120,80)
  10661. * );
  10662. * @param {Bounds} bounds - 目标边界。
  10663. * @param {Object} options - 参数。
  10664. * @param {boolean} [options.inclusive=true] - 边缘重合也看成相交。如果是false,两个边界范围没有重叠部分仅仅是在边缘相接(重合),这种情况被认为没有相交。
  10665. * @param {Bounds} [options.worldBounds] - 提供了 worldBounds 参数,如果他们相交时是在全球范围内,两个边界将被视为相交。这仅适用于交叉或完全不在世界范围的边界。
  10666. * @returns {boolean} 传入的 bounds 对象与当前 bounds 相交。
  10667. */
  10668. intersectsBounds(bounds, options) {
  10669. if (typeof options === "boolean") {
  10670. options = {inclusive: options};
  10671. }
  10672. options = options || {};
  10673. if (options.worldBounds) {
  10674. var self = this.wrapDateLine(options.worldBounds);
  10675. bounds = bounds.wrapDateLine(options.worldBounds);
  10676. } else {
  10677. self = this;
  10678. }
  10679. if (options.inclusive == null) {
  10680. options.inclusive = true;
  10681. }
  10682. var intersects = false;
  10683. var mightTouch = (
  10684. self.left === bounds.right ||
  10685. self.right === bounds.left ||
  10686. self.top === bounds.bottom ||
  10687. self.bottom === bounds.top
  10688. );
  10689. // if the two bounds only touch at an edge, and inclusive is false,
  10690. // then the bounds don't *really* intersect.
  10691. if (options.inclusive || !mightTouch) {
  10692. // otherwise, if one of the boundaries even partially contains another,
  10693. // inclusive of the edges, then they do intersect.
  10694. var inBottom = (
  10695. ((bounds.bottom >= self.bottom) && (bounds.bottom <= self.top)) ||
  10696. ((self.bottom >= bounds.bottom) && (self.bottom <= bounds.top))
  10697. );
  10698. var inTop = (
  10699. ((bounds.top >= self.bottom) && (bounds.top <= self.top)) ||
  10700. ((self.top > bounds.bottom) && (self.top < bounds.top))
  10701. );
  10702. var inLeft = (
  10703. ((bounds.left >= self.left) && (bounds.left <= self.right)) ||
  10704. ((self.left >= bounds.left) && (self.left <= bounds.right))
  10705. );
  10706. var inRight = (
  10707. ((bounds.right >= self.left) && (bounds.right <= self.right)) ||
  10708. ((self.right >= bounds.left) && (self.right <= bounds.right))
  10709. );
  10710. intersects = ((inBottom || inTop) && (inLeft || inRight));
  10711. }
  10712. // document me
  10713. if (options.worldBounds && !intersects) {
  10714. var world = options.worldBounds;
  10715. var width = world.getWidth();
  10716. var selfCrosses = !world.containsBounds(self);
  10717. var boundsCrosses = !world.containsBounds(bounds);
  10718. if (selfCrosses && !boundsCrosses) {
  10719. bounds = bounds.add(-width, 0);
  10720. intersects = self.intersectsBounds(bounds, {inclusive: options.inclusive});
  10721. } else if (boundsCrosses && !selfCrosses) {
  10722. self = self.add(-width, 0);
  10723. intersects = bounds.intersectsBounds(self, {inclusive: options.inclusive});
  10724. }
  10725. }
  10726. return intersects;
  10727. }
  10728. /**
  10729. * @function Bounds.prototype.containsBounds
  10730. * @description 判断目标边界是否被当前边界包含在内。
  10731. * @example
  10732. * var bounds = new Bounds(-180,-90,100,80);
  10733. * var isContains = bounds.containsBounds(
  10734. * new Bounds(-170,-90,100,80),true,true
  10735. * );
  10736. * @param {Bounds} bounds - 目标边界。
  10737. * @param {boolean} [partial=false] - 目标边界的任意部分都包含在当前边界中则被认为是包含关系。
  10738. * 如果设为 false,整个目标边界全部被包含在当前边界范围内。
  10739. * @param {boolean} [inclusive=true] - 边缘共享是否被视为包含。
  10740. * @returns {boolean} 传入的边界是否被当前边界包含。
  10741. */
  10742. containsBounds(bounds, partial, inclusive) {
  10743. if (partial == null) {
  10744. partial = false;
  10745. }
  10746. if (inclusive == null) {
  10747. inclusive = true;
  10748. }
  10749. var bottomLeft = this.contains(bounds.left, bounds.bottom, inclusive);
  10750. var bottomRight = this.contains(bounds.right, bounds.bottom, inclusive);
  10751. var topLeft = this.contains(bounds.left, bounds.top, inclusive);
  10752. var topRight = this.contains(bounds.right, bounds.top, inclusive);
  10753. return (partial) ? (bottomLeft || bottomRight || topLeft || topRight)
  10754. : (bottomLeft && bottomRight && topLeft && topRight);
  10755. }
  10756. /**
  10757. * @function Bounds.prototype.determineQuadrant
  10758. * @description 判断传入坐标是否在 bounds 范围内的象限。以 bounds 中心点为坐标原点。
  10759. * @example
  10760. * var bounds = new Bounds(-180,-90,100,80);
  10761. * //str = "tr";
  10762. * var str = bounds.determineQuadrant(
  10763. * new LonLat(20,20)
  10764. * );
  10765. * @param {LonLat} lonlat - 传入的坐标对象。
  10766. * @returns {string} 传入坐标所在的象限("br" "tr" "tl" "bl" 分别对应"右下","右上","左上" "左下")。
  10767. */
  10768. determineQuadrant(lonlat) {
  10769. var quadrant = "";
  10770. var center = this.getCenterLonLat();
  10771. quadrant += (lonlat.lat < center.lat) ? "b" : "t";
  10772. quadrant += (lonlat.lon < center.lon) ? "l" : "r";
  10773. return quadrant;
  10774. }
  10775. /**
  10776. * @function Bounds.prototype.wrapDateLine
  10777. * @description 将当前 bounds 移动到最大边界范围内部(所谓的内部是相交或者内部)。
  10778. * @example
  10779. * var bounds = new Bounds(380,-40,400,-20);
  10780. * var maxExtent = new Bounds(-180,-90,100,80);
  10781. * //新的bounds
  10782. * var newBounds = bounds.wrapDateLine(maxExtent);
  10783. * @param {Bounds} maxExtent - 最大的边界范围(一般是全球范围)。
  10784. * @param {Object} options - 可选选项参数。
  10785. * @param {number} [options.leftTolerance=0] - left 允许的误差。
  10786. * @param {number} [options.rightTolerance=0] - right 允许的误差。
  10787. * @returns {Bounds} 克隆当前边界。如果当前边界完全在最大范围之外此函数则返回一个不同值的边界,
  10788. * 若落在最大边界的左边,则给当前的bounds值加上最大范围的宽度,即向右移动,
  10789. * 若落在右边,则向左移动,即给当前的bounds值加上负的最大范围的宽度。
  10790. */
  10791. wrapDateLine(maxExtent, options) {
  10792. options = options || {};
  10793. var leftTolerance = options.leftTolerance || 0;
  10794. var rightTolerance = options.rightTolerance || 0;
  10795. var newBounds = this.clone();
  10796. if (maxExtent) {
  10797. var width = maxExtent.getWidth();
  10798. //如果 newBounds 在 maxExtent 的左边,那么一直向右移动,直到相交或者包含为止,每次移动width
  10799. //shift right?
  10800. while (newBounds.left < maxExtent.left &&
  10801. newBounds.right - rightTolerance <= maxExtent.left) {
  10802. newBounds = newBounds.add(width, 0);
  10803. }
  10804. //如果 newBounds 在 maxExtent 的右边,那么一直向左移动,直到相交或者包含为止,每次移动width
  10805. //shift left?
  10806. while (newBounds.left + leftTolerance >= maxExtent.right &&
  10807. newBounds.right > maxExtent.right) {
  10808. newBounds = newBounds.add(-width, 0);
  10809. }
  10810. //如果和右边相交,左边又在内部,那么再次向左边移动一次
  10811. // crosses right only? force left
  10812. var newLeft = newBounds.left + leftTolerance;
  10813. if (newLeft < maxExtent.right && newLeft > maxExtent.left &&
  10814. newBounds.right - rightTolerance > maxExtent.right) {
  10815. newBounds = newBounds.add(-width, 0);
  10816. }
  10817. }
  10818. return newBounds;
  10819. }
  10820. /**
  10821. * @function Bounds.prototype.toServerJSONObject
  10822. * @description 转换成对应的 JSON 格式对象。
  10823. * @example
  10824. * var bounds = new Bounds(-180,-90,100,80);
  10825. * var obj = bounds.toServerJSONObject();
  10826. * @returns {Object} JSON 格式的 Object 对象。
  10827. */
  10828. toServerJSONObject() {
  10829. var jsonObject = {
  10830. rightTop: {x: this.right, y: this.top},
  10831. leftBottom: {x: this.left, y: this.bottom},
  10832. left: this.left,
  10833. right: this.right,
  10834. top: this.top,
  10835. bottom: this.bottom
  10836. }
  10837. return jsonObject;
  10838. }
  10839. /**
  10840. *
  10841. * @function Bounds.prototype.destroy
  10842. * @description 销毁此对象。
  10843. * 销毁后此对象的所有属性为 null,而不是初始值。
  10844. * @example
  10845. * var bounds = new Bounds(-180,-90,100,80);
  10846. * bounds.destroy();
  10847. */
  10848. destroy() {
  10849. this.left = null;
  10850. this.right = null;
  10851. this.top = null;
  10852. this.bottom = null;
  10853. this.centerLonLat = null;
  10854. }
  10855. /**
  10856. * @function Bounds.fromString
  10857. * @description 通过字符串参数创建新的 bounds 的构造函数。
  10858. * @example
  10859. * var bounds = Bounds.fromString("-180,-90,100,80");
  10860. * @param {string} str - 边界字符串,用逗号隔开(e.g. <i>"5,42,10,45"</i>)。
  10861. * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
  10862. * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  10863. * @returns {Bounds} 给定的字符串创建的新的边界对象。
  10864. */
  10865. static fromString(str, reverseAxisOrder) {
  10866. var bounds = str.split(",");
  10867. return Bounds.fromArray(bounds, reverseAxisOrder);
  10868. }
  10869. /**
  10870. * @function Bounds.fromArray
  10871. * @description 通过边界框数组创建 Bounds。
  10872. * @example
  10873. * var bounds = Bounds.fromArray([-180,-90,100,80]);
  10874. * @param {Array.<number>} bbox - 边界值数组。(e.g. <i>[5,42,10,45]</i>)。
  10875. * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  10876. * @returns {Bounds} 根据传入的数组创建的新的边界对象。
  10877. */
  10878. static fromArray(bbox, reverseAxisOrder) {
  10879. return reverseAxisOrder === true ?
  10880. new Bounds(bbox[1], bbox[0], bbox[3], bbox[2]) :
  10881. new Bounds(bbox[0], bbox[1], bbox[2], bbox[3]);
  10882. }
  10883. /**
  10884. * @function Bounds.fromSize
  10885. * @description 通过传入的边界大小来创建新的边界。
  10886. * @example
  10887. * var bounds = Bounds.fromSize(new Size(20,10));
  10888. * @param {Size} size - 边界大小。
  10889. * @returns {Bounds} 根据传入的边界大小的创建新的边界。
  10890. */
  10891. static fromSize(size) {
  10892. return new Bounds(0,
  10893. size.h,
  10894. size.w,
  10895. 0);
  10896. }
  10897. /**
  10898. * @function Bounds.oppositeQuadrant
  10899. * @description 反转象限。"t"和"b" 交换,"r"和"l"交换, 如:"tl"变为"br"。
  10900. * @param {string} quadrant - 代表象限的字符串,如:"tl"。
  10901. * @returns {string} 反转后的象限。
  10902. */
  10903. static oppositeQuadrant(quadrant) {
  10904. var opp = "";
  10905. opp += (quadrant.charAt(0) === 't') ? 'b' : 't';
  10906. opp += (quadrant.charAt(1) === 'l') ? 'r' : 'l';
  10907. return opp;
  10908. }
  10909. }
  10910. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Point.js
  10911. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  10912. * This program are made available under the terms of the Apache License, Version 2.0
  10913. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10914. /**
  10915. * @class GeometryPoint
  10916. * @aliasclass Geometry.Point
  10917. * @deprecatedclass SuperMap.Geometry.Point
  10918. * @classdesc 点几何对象类。
  10919. * @category BaseTypes Geometry
  10920. * @extends {Geometry}
  10921. * @param {number} x - x 坐标。
  10922. * @param {number} y - y 坐标。
  10923. * @param {string} [type = 'Point'] - 点的类型。
  10924. * @param {number} [tag] - 额外的属性,比如插值分析中的 Z 值。
  10925. * @example
  10926. * var point = new GeometryPoint(-111.04, 45.68);
  10927. * @usage
  10928. */
  10929. class Point extends Geometry_Geometry {
  10930. constructor(x, y, type, tag) {
  10931. super(x, y, type, tag);
  10932. /**
  10933. * @member {number} GeometryPoint.prototype.x
  10934. * @description 横坐标。
  10935. */
  10936. this.x = parseFloat(x);
  10937. /**
  10938. * @member {number} GeometryPoint.prototype.y
  10939. * @description 纵坐标。
  10940. */
  10941. this.y = parseFloat(y);
  10942. /**
  10943. * @member {string} GeometryPoint.prototype.tag
  10944. * @description 用来存储额外的属性,比如插值分析中的 Z 值。
  10945. */
  10946. this.tag = (tag || tag == 0) ? parseFloat(tag) : null;
  10947. /**
  10948. * @member {string} GeometryPoint.prototype.type
  10949. * @description 用来存储点的类型。
  10950. */
  10951. this.type = type || "Point";
  10952. this.CLASS_NAME = "SuperMap.Geometry.Point";
  10953. this.geometryType = "Point";
  10954. }
  10955. /**
  10956. * @function GeometryPoint.prototype.clone
  10957. * @description 克隆点对象。
  10958. * @returns {GeometryPoint} 克隆后的点对象。
  10959. */
  10960. clone(obj) {
  10961. if (obj == null) {
  10962. obj = new Point(this.x, this.y);
  10963. }
  10964. // catch any randomly tagged-on properties
  10965. Util_Util.applyDefaults(obj, this);
  10966. return obj;
  10967. }
  10968. /**
  10969. * @function GeometryPoint.prototype.calculateBounds
  10970. * @description 计算点对象的范围。
  10971. */
  10972. calculateBounds() {
  10973. this.bounds = new Bounds(this.x, this.y,
  10974. this.x, this.y);
  10975. }
  10976. /**
  10977. * @function GeometryPoint.prototype.equals
  10978. * @description 判断两个点对象是否相等。如果两个点对象具有相同的坐标,则认为是相等的。
  10979. * @example
  10980. * var point= new GeometryPoint(0,0);
  10981. * var point1={x:0,y:0};
  10982. * var result= point.equals(point1);
  10983. * @param {GeometryPoint} geom - 需要判断的点对象。
  10984. * @returns {boolean} 两个点对象是否相等(true 为相等,false 为不等)。
  10985. */
  10986. equals(geom) {
  10987. var equals = false;
  10988. if (geom != null) {
  10989. equals = ((this.x === geom.x && this.y === geom.y) ||
  10990. (isNaN(this.x) && isNaN(this.y) && isNaN(geom.x) && isNaN(geom.y)));
  10991. }
  10992. return equals;
  10993. }
  10994. /**
  10995. * @function GeometryPoint.prototype.move
  10996. * @description 沿着 x、y 轴的正方向上按照给定的位移移动点对象,move 不仅改变了几何对象的位置并且清理了边界缓存。
  10997. * @param {number} x - x 轴正方向上的偏移量。
  10998. * @param {number} y - y 轴正方向上偏移量。
  10999. */
  11000. move(x, y) {
  11001. this.x = this.x + x;
  11002. this.y = this.y + y;
  11003. this.clearBounds();
  11004. }
  11005. /**
  11006. * @function GeometryPoint.prototype.toShortString
  11007. * @description 将 x/y 坐标转换成简单字符串。
  11008. * @returns {string} 字符串代表点对象。(ex. <i>"5, 42"</i>)
  11009. */
  11010. toShortString() {
  11011. return (this.x + ", " + this.y);
  11012. }
  11013. /**
  11014. * @function GeometryPoint.prototype.destroy
  11015. * @description 释放点对象的资源。
  11016. */
  11017. destroy() {
  11018. this.x = null;
  11019. this.y = null;
  11020. this.tag = null;
  11021. super.destroy();
  11022. }
  11023. /**
  11024. * @function GeometryPoint.prototype.getVertices
  11025. * @description 获取几何图形所有顶点的列表。
  11026. * @returns {Array} 几何图形的顶点列表。
  11027. */
  11028. getVertices() {
  11029. return [this];
  11030. }
  11031. }
  11032. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Collection.js
  11033. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  11034. * This program are made available under the terms of the Apache License, Version 2.0
  11035. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11036. /**
  11037. * @class GeometryCollection
  11038. * @aliasclass Geometry.Collection
  11039. * @deprecatedclass SuperMap.Geometry.Collection
  11040. * @classdesc 几何对象集合类,存储在本地的 components 属性中(可作为参数传递给构造函数)。<br>
  11041. * 随着新的几何图形添加到集合中,将不能被克隆,当移动几何图形时,需要指定参照物。<br>
  11042. * getArea 和 getLength 函数只能通过遍历存储几何对象的 components 数组,总计所有几何图形的面积和长度。
  11043. * @category BaseTypes Geometry
  11044. * @extends {Geometry}
  11045. * @param {Array.<Geometry>} components - 几何对象数组。
  11046. * @example
  11047. * var point1 = new GeometryPoint(10,20);
  11048. * var point2 = new GeometryPoint(30,40);
  11049. * var col = new GeometryCollection([point1,point2]);
  11050. * @usage
  11051. */
  11052. class Collection extends Geometry_Geometry {
  11053. constructor(components) {
  11054. super();
  11055. /**
  11056. * @description 存储几何对象的数组。
  11057. * @member {Array.<Geometry>} GeometryCollection.prototype.components
  11058. */
  11059. this.components = [];
  11060. /**
  11061. * @member {Array.<string>} GeometryCollection.prototype.componentTypes
  11062. * @description components 存储的几何对象所支持的几何类型数组,为空表示类型不受限制。
  11063. */
  11064. this.componentTypes = null;
  11065. if (components != null) {
  11066. this.addComponents(components);
  11067. }
  11068. this.CLASS_NAME = "SuperMap.Geometry.Collection";
  11069. this.geometryType = "Collection";
  11070. }
  11071. /**
  11072. * @function GeometryCollection.prototype.destroy
  11073. * @description 销毁几何图形。
  11074. */
  11075. destroy() {
  11076. this.components.length = 0;
  11077. this.components = null;
  11078. super.destroy();
  11079. }
  11080. /**
  11081. * @function GeometryCollection.prototype.clone
  11082. * @description 克隆当前几何对象。
  11083. * @returns {GeometryCollection} 克隆的几何对象集合。
  11084. */
  11085. clone() {
  11086. var geometry = new Collection();
  11087. for (var i = 0, len = this.components.length; i < len; i++) {
  11088. geometry.addComponent(this.components[i].clone());
  11089. }
  11090. // catch any randomly tagged-on properties
  11091. Util_Util.applyDefaults(geometry, this);
  11092. return geometry;
  11093. }
  11094. /**
  11095. * @function GeometryCollection.prototype.getComponentsString
  11096. * @description 获取 components 字符串。
  11097. * @returns {string} components 字符串。
  11098. */
  11099. getComponentsString() {
  11100. var strings = [];
  11101. for (var i = 0, len = this.components.length; i < len; i++) {
  11102. strings.push(this.components[i].toShortString());
  11103. }
  11104. return strings.join(",");
  11105. }
  11106. /**
  11107. * @function GeometryCollection.prototype.calculateBounds
  11108. * @description 通过遍历数组重新计算边界,在遍历每一子项中时调用 extend 方法。
  11109. */
  11110. calculateBounds() {
  11111. this.bounds = null;
  11112. var bounds = new Bounds();
  11113. var components = this.components;
  11114. if (components) {
  11115. for (var i = 0, len = components.length; i < len; i++) {
  11116. bounds.extend(components[i].getBounds());
  11117. }
  11118. }
  11119. // to preserve old behavior, we only set bounds if non-null
  11120. // in the future, we could add bounds.isEmpty()
  11121. if (bounds.left != null && bounds.bottom != null &&
  11122. bounds.right != null && bounds.top != null) {
  11123. this.setBounds(bounds);
  11124. }
  11125. }
  11126. /**
  11127. * @function GeometryCollection.prototype.addComponents
  11128. * @description 给几何图形对象添加元素。
  11129. * @param {Array.<Geometry>} components - 几何对象组件。
  11130. * @example
  11131. * var geometryCollection = new GeometryCollection();
  11132. * geometryCollection.addComponents(new SuerpMap.Geometry.Point(10,10));
  11133. */
  11134. addComponents(components) {
  11135. if (!(Util_Util.isArray(components))) {
  11136. components = [components];
  11137. }
  11138. for (var i = 0, len = components.length; i < len; i++) {
  11139. this.addComponent(components[i]);
  11140. }
  11141. }
  11142. /**
  11143. * @function GeometryCollection.prototype.addComponent
  11144. * @description 添加几何对象到集合中。如果设置了 componentTypes 类型,则添加的几何对象必须是 componentTypes 中的类型。
  11145. * @param {Geometry} component - 待添加的几何对象。
  11146. * @param {number} [index] - 几何对象插入的位置。
  11147. * @returns {boolean} 是否添加成功。
  11148. */
  11149. addComponent(component, index) {
  11150. var added = false;
  11151. if (component) {
  11152. if (this.componentTypes == null ||
  11153. (Util_Util.indexOf(this.componentTypes,
  11154. component.CLASS_NAME) > -1)) {
  11155. if (index != null && (index < this.components.length)) {
  11156. var components1 = this.components.slice(0, index);
  11157. var components2 = this.components.slice(index,
  11158. this.components.length);
  11159. components1.push(component);
  11160. this.components = components1.concat(components2);
  11161. } else {
  11162. this.components.push(component);
  11163. }
  11164. component.parent = this;
  11165. this.clearBounds();
  11166. added = true;
  11167. }
  11168. }
  11169. return added;
  11170. }
  11171. /**
  11172. * @function GeometryCollection.prototype.removeComponents
  11173. * @description 清除几何对象。
  11174. * @param {Array.<Geometry>} components - 需要清除的几何对象。
  11175. * @returns {boolean} 元素是否被删除。
  11176. */
  11177. removeComponents(components) {
  11178. var removed = false;
  11179. if (!(Util_Util.isArray(components))) {
  11180. components = [components];
  11181. }
  11182. for (var i = components.length - 1; i >= 0; --i) {
  11183. removed = this.removeComponent(components[i]) || removed;
  11184. }
  11185. return removed;
  11186. }
  11187. /**
  11188. * @function GeometryCollection.prototype.removeComponent
  11189. * @description 从集合中移除几何对象。
  11190. * @param {Geometry} component - 要移除的几何对象。
  11191. * @returns {boolean} 几何对象是否移除成功。
  11192. */
  11193. removeComponent(component) {
  11194. Util_Util.removeItem(this.components, component);
  11195. // clearBounds() so that it gets recalculated on the next call
  11196. // to this.getBounds();
  11197. this.clearBounds();
  11198. return true;
  11199. }
  11200. /**
  11201. * @function GeometryCollection.prototype.getArea
  11202. * @description 计算几何对象的面积。注意,这个方法在 {@link GeometryPolygon} 类中需要重写。
  11203. * @returns {number} 几何图形的面积,是几何对象中所有组成部分的面积之和。
  11204. */
  11205. getArea() {
  11206. var area = 0.0;
  11207. for (var i = 0, len = this.components.length; i < len; i++) {
  11208. area += this.components[i].getArea();
  11209. }
  11210. return area;
  11211. }
  11212. /**
  11213. * @function GeometryCollection.prototype.equals
  11214. * @description 判断两个几何图形是否相等。如果所有的 components 具有相同的坐标,则认为是相等的。
  11215. * @param {Geometry} geometry - 需要判断的几何图形。
  11216. * @returns {boolean} 输入的几何图形与当前几何图形是否相等。
  11217. */
  11218. equals(geometry) {
  11219. var equivalent = true;
  11220. if (!geometry || !geometry.CLASS_NAME ||
  11221. (this.CLASS_NAME !== geometry.CLASS_NAME)) {
  11222. equivalent = false;
  11223. } else if (!(Util_Util.isArray(geometry.components)) ||
  11224. (geometry.components.length !== this.components.length)) {
  11225. equivalent = false;
  11226. } else {
  11227. for (var i = 0, len = this.components.length; i < len; ++i) {
  11228. if (!this.components[i].equals(geometry.components[i])) {
  11229. equivalent = false;
  11230. break;
  11231. }
  11232. }
  11233. }
  11234. return equivalent;
  11235. }
  11236. /**
  11237. * @function GeometryCollection.prototype.getVertices
  11238. * @description 返回几何对象的所有结点的列表。
  11239. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
  11240. * @returns {Array} 几何对象的顶点列表。
  11241. */
  11242. getVertices(nodes) {
  11243. var vertices = [];
  11244. for (var i = 0, len = this.components.length; i < len; ++i) {
  11245. Array.prototype.push.apply(
  11246. vertices, this.components[i].getVertices(nodes)
  11247. );
  11248. }
  11249. return vertices;
  11250. }
  11251. }
  11252. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPoint.js
  11253. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  11254. * This program are made available under the terms of the Apache License, Version 2.0
  11255. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11256. /**
  11257. * @class GeometryMultiPoint
  11258. * @aliasclass Geometry.MultiPoint
  11259. * @deprecatedclass SuperMap.Geometry.MultiPoint
  11260. * @classdesc 几何对象多点类。
  11261. * @category BaseTypes Geometry
  11262. * @extends GeometryCollection
  11263. * @param {Array.<GeometryPoint>} components - 点对象数组。
  11264. * @example
  11265. * var point1 = new GeometryPoint(5,6);
  11266. * var poine2 = new GeometryMultiPoint(7,8);
  11267. * var multiPoint = new MultiPoint([point1,point2]);
  11268. * @usage
  11269. */
  11270. class MultiPoint extends Collection {
  11271. constructor(components) {
  11272. super(components);
  11273. /**
  11274. * @member {Array.<string>} [GeometryMultiPoint.prototype.componentTypes=["SuperMap.Geometry.Point"]]
  11275. * @description components 存储的几何对象所支持的几何类型数组。
  11276. * @readonly
  11277. */
  11278. this.componentTypes = ["SuperMap.Geometry.Point"];
  11279. this.CLASS_NAME = "SuperMap.Geometry.MultiPoint";
  11280. this.geometryType = "MultiPoint";
  11281. }
  11282. /**
  11283. * @function GeometryMultiPoint.prototype.addPoint
  11284. * @description 添加点,封装了 {@link GeometryCollection|GeometryCollection.addComponent} 方法。
  11285. * @param {GeometryPoint} point - 添加的点。
  11286. * @param {number} [index] - 下标。
  11287. */
  11288. addPoint(point, index) {
  11289. this.addComponent(point, index);
  11290. }
  11291. /**
  11292. * @function GeometryMultiPoint.prototype.removePoint
  11293. * @description 移除点,封装了 {@link GeometryCollection|GeometryCollection.removeComponent} 方法。
  11294. * @param {GeometryPoint} point - 移除的点对象。
  11295. */
  11296. removePoint(point) {
  11297. this.removeComponent(point);
  11298. }
  11299. }
  11300. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Curve.js
  11301. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  11302. * This program are made available under the terms of the Apache License, Version 2.0
  11303. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11304. /**
  11305. * @class GeometryCurve
  11306. * @aliasclass Geometry.Curve
  11307. * @deprecatedclass SuperMap.Geometry.Curve
  11308. * @classdesc 几何对象曲线类。
  11309. * @category BaseTypes Geometry
  11310. * @extends GeometryMultiPoint
  11311. * @param {Array.<GeometryPoint>} components - 几何对象数组。
  11312. * @example
  11313. * var point1 = new GeometryPoint(10,20);
  11314. * var point2 = new GeometryPoint(30,40);
  11315. * var curve = new Curve([point1,point2]);
  11316. * @usage
  11317. */
  11318. class Curve extends MultiPoint {
  11319. constructor(components) {
  11320. super(components);
  11321. /**
  11322. * @member {Array.<string>} [GeometryCurve.prototype.componentTypes=["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"]]
  11323. * @description components 存储的几何对象所支持的几何类型数组。
  11324. * @readonly
  11325. */
  11326. this.componentTypes = ["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"];
  11327. this.CLASS_NAME = "SuperMap.Geometry.Curve";
  11328. this.geometryType = "Curve";
  11329. }
  11330. }
  11331. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/LineString.js
  11332. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  11333. * This program are made available under the terms of the Apache License, Version 2.0
  11334. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11335. /**
  11336. * @class GeometryLineString
  11337. * @aliasclass Geometry.LineString
  11338. * @deprecatedclass SuperMap.Geometry.LineString
  11339. * @classdesc 几何对象线串类。
  11340. * @category BaseTypes Geometry
  11341. * @param {Array.<GeometryPoint>} points - 用来生成线串的点数组。
  11342. * @extends GeometryCurve
  11343. * @example
  11344. * var points = [new GeometryPoint(4933.319287022352, -3337.3849141502124),
  11345. * new GeometryPoint(4960.9674060199022, -3349.3316322355736),
  11346. * new GeometryPoint(5006.0235999418364, -3358.8890067038628),
  11347. * new GeometryPoint(5075.3145648369318, -3378.0037556404409),
  11348. * new GeometryPoint(5305.19551436013, -3376.9669111768926)],
  11349. * var roadLine = new GeometryLineString(points);
  11350. * @usage
  11351. */
  11352. class LineString extends Curve {
  11353. constructor(points) {
  11354. super(points);
  11355. this.CLASS_NAME = "SuperMap.Geometry.LineString";
  11356. this.geometryType = "LineString";
  11357. }
  11358. /**
  11359. * @function GeometryLineString.prototype.removeComponent
  11360. * @description 只有在线串上有三个或更多的点的时候,才会允许移除点(否则结果将会是单一的点)。
  11361. * @param {GeometryPoint} point - 将被删除的点。
  11362. * @returns {boolean} 删除的点。
  11363. */
  11364. removeComponent(point) { // eslint-disable-line no-unused-vars
  11365. var removed = this.components && (this.components.length > 2);
  11366. if (removed) {
  11367. super.removeComponent.apply(this, arguments);
  11368. }
  11369. return removed;
  11370. }
  11371. /**
  11372. * @function GeometryLineString.prototype.getSortedSegments
  11373. * @description 获取升序排列的点坐标对象数组。
  11374. * @returns {Array} 升序排列的点坐标对象数组。
  11375. */
  11376. getSortedSegments() {
  11377. var numSeg = this.components.length - 1;
  11378. var segments = new Array(numSeg), point1, point2;
  11379. for (var i = 0; i < numSeg; ++i) {
  11380. point1 = this.components[i];
  11381. point2 = this.components[i + 1];
  11382. if (point1.x < point2.x) {
  11383. segments[i] = {
  11384. x1: point1.x,
  11385. y1: point1.y,
  11386. x2: point2.x,
  11387. y2: point2.y
  11388. };
  11389. } else {
  11390. segments[i] = {
  11391. x1: point2.x,
  11392. y1: point2.y,
  11393. x2: point1.x,
  11394. y2: point1.y
  11395. };
  11396. }
  11397. }
  11398. // more efficient to define this somewhere static
  11399. function byX1(seg1, seg2) {
  11400. return seg1.x1 - seg2.x1;
  11401. }
  11402. return segments.sort(byX1);
  11403. }
  11404. /**
  11405. * @function GeometryLineString.prototype.getVertices
  11406. * @description 返回几何图形的所有顶点的列表。
  11407. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
  11408. * @returns {Array} 几何图形的顶点列表。
  11409. */
  11410. getVertices(nodes) {
  11411. var vertices;
  11412. if (nodes === true) {
  11413. vertices = [
  11414. this.components[0],
  11415. this.components[this.components.length - 1]
  11416. ];
  11417. } else if (nodes === false) {
  11418. vertices = this.components.slice(1, this.components.length - 1);
  11419. } else {
  11420. vertices = this.components.slice();
  11421. }
  11422. return vertices;
  11423. }
  11424. /**
  11425. * @function GeometryLineString.calculateCircle
  11426. * @description 三点画圆弧。
  11427. * @param {Array.<GeometryPoint>} points - 传入的待计算的初始点串。
  11428. * @returns {Array.<GeometryPoint>} 计算出相应的圆弧控制点。
  11429. * @example
  11430. * var points = [];
  11431. * points.push(new GeometryPoint(-50,30));
  11432. * points.push(new GeometryPoint(-30,50));
  11433. * points.push(new GeometryPoint(2,60));
  11434. * var circle = GeometryLineString.calculateCircle(points);
  11435. */
  11436. static calculateCircle(points) {
  11437. if (points.length < 3) {
  11438. return points
  11439. }
  11440. var centerPoint = {},
  11441. p1 = points[0],
  11442. p2 = points[1],
  11443. p3 = points[2];
  11444. var R = 0,
  11445. dStep = 0,
  11446. direc = true,
  11447. dRotation = 0,
  11448. dRotationBegin = 0,
  11449. dRotationAngle = 0,
  11450. nSegmentCount = 72,
  11451. circlePoints = [];
  11452. var KTan13 = (p3.y - p1.y) / (p3.x - p1.x);
  11453. var B13 = p3.y - KTan13 * p3.x;
  11454. if ((((p3.x != p1.x) && (p3.y != p1.y)) && (p2.y == KTan13 * p2.x + B13)) ||
  11455. ((p3.x == p1.x) && (p2.x == p1.x)) || ((p3.y == p1.y) && (p2.y == p1.y)) ||
  11456. ((p3.x == p1.x) && (p3.y == p1.y)) || ((p3.x == p2.x) && (p3.y == p2.y)) || ((p1.x == p2.x) && (p1.y == p2.y))) {
  11457. circlePoints.push(p1);
  11458. circlePoints.push(p2);
  11459. circlePoints.push(p3);
  11460. } else {
  11461. 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) -
  11462. (p1.x * p1.x + p1.y * p1.y)) * (2 * (p2.y - p1.y));
  11463. var E = (2 * (p2.x - p1.x)) * ((p3.x * p3.x + p3.y * p3.y) - (p1.x * p1.x + p1.y * p1.y)) -
  11464. (2 * (p3.x - p1.x)) * ((p2.x * p2.x + p2.y * p2.y) - (p1.x * p1.x + p1.y * p1.y));
  11465. var F = 4 * ((p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y));
  11466. centerPoint.x = D / F;
  11467. centerPoint.y = E / F;
  11468. R = Math.sqrt((p1.x - centerPoint.x) * (p1.x - centerPoint.x) + (p1.y - centerPoint.y) * (p1.y - centerPoint.y));
  11469. var dis = (p1.x - p3.x) * (p1.x - p3.x) + (p1.y - p3.y) * (p1.y - p3.y);
  11470. var cons = (2 * R * R - dis) / (2 * R * R);
  11471. cons = cons >= 1 ? 1 : cons;
  11472. cons = cons <= -1 ? -1 : cons;
  11473. dRotationAngle = Math.acos(cons) * 180 / Math.PI;
  11474. if (p3.x == p1.x) {
  11475. dRotationAngle = ((centerPoint.x > p1.x && p2.x > p1.x) || (centerPoint.x < p1.x && p2.x < p1.x)) ? (360 - dRotationAngle) : dRotationAngle;
  11476. } else {
  11477. dRotationAngle = ((centerPoint.y > (KTan13 * centerPoint.x + B13) && p2.y > (KTan13 * p2.x + B13)) ||
  11478. (centerPoint.y < (KTan13 * centerPoint.x + B13) && p2.y < (KTan13 * p2.x + B13))) ? (360 - dRotationAngle) : dRotationAngle;
  11479. }
  11480. dStep = dRotationAngle / 72;
  11481. if (p3.y != p1.y) {
  11482. if (p3.x == p1.x) {
  11483. if (p3.y > p1.y) {
  11484. if (p2.x < p1.x) {
  11485. direc = false;
  11486. }
  11487. } else {
  11488. if (p2.x > p1.x) {
  11489. direc = false;
  11490. }
  11491. }
  11492. } else if (p3.x < p1.x) {
  11493. if (p2.y < KTan13 * p2.x + B13) {
  11494. direc = false;
  11495. }
  11496. } else {
  11497. if (p2.y > KTan13 * p2.x + B13) {
  11498. direc = false;
  11499. }
  11500. }
  11501. } else {
  11502. if (p3.x > p1.x) {
  11503. if (p2.y > p1.y) {
  11504. direc = false;
  11505. }
  11506. } else {
  11507. if (p2.y < p1.y) {
  11508. direc = false;
  11509. }
  11510. }
  11511. }
  11512. var K10 = (p1.y - centerPoint.y) / (p1.x - centerPoint.x);
  11513. var atan10 = K10 >= 0 ? Math.atan(K10) * 180 / Math.PI : Math.abs(Math.atan(K10) * 180 / Math.PI) + 90;
  11514. var CY = Math.abs(centerPoint.y);
  11515. if ((p1.y == CY) && (CY == p3.y)) {
  11516. if (p1.x < p3.x) {
  11517. atan10 = atan10 + 180;
  11518. }
  11519. }
  11520. var newPY = p1.y - centerPoint.y;
  11521. circlePoints.push(p1);
  11522. for (var i = 1; i < nSegmentCount; i++) {
  11523. dRotation = dStep * i;
  11524. dRotationBegin = atan10;
  11525. if (direc) {
  11526. if (newPY >= 0) {
  11527. if (K10 >= 0) {
  11528. dRotationBegin = dRotationBegin + dRotation;
  11529. } else {
  11530. dRotationBegin = (180 - (dRotationBegin - 90)) + dRotation;
  11531. }
  11532. } else {
  11533. if (K10 > 0) {
  11534. dRotationBegin = (dRotationBegin - 180) + dRotation;
  11535. } else {
  11536. dRotationBegin = (90 - dRotationBegin) + dRotation;
  11537. }
  11538. }
  11539. } else {
  11540. if (newPY >= 0) {
  11541. if (K10 >= 0) {
  11542. dRotationBegin = dRotationBegin - dRotation;
  11543. } else {
  11544. dRotationBegin = (180 - (dRotationBegin - 90)) - dRotation;
  11545. }
  11546. } else {
  11547. if (K10 >= 0) {
  11548. dRotationBegin = (dRotationBegin - 180) - dRotation;
  11549. } else {
  11550. dRotationBegin = (90 - dRotationBegin) - dRotation;
  11551. }
  11552. }
  11553. }
  11554. dRotationBegin = dRotationBegin * Math.PI / 180;
  11555. var x = centerPoint.x + R * Math.cos(dRotationBegin);
  11556. var y = centerPoint.y + R * Math.sin(dRotationBegin);
  11557. circlePoints.push(new Point(x, y));
  11558. }
  11559. circlePoints.push(p3);
  11560. }
  11561. return circlePoints;
  11562. }
  11563. /**
  11564. * @function GeometryLineString.createLineEPS
  11565. * @description 根据点的类型画出不同类型的曲线。
  11566. * 点的类型有三种:LTypeArc,LTypeCurve,NONE。
  11567. * @param {Array.<GeometryPoint>} points - 传入的待计算的初始点串。
  11568. * @returns {Array.<GeometryPoint>} 计算出相应的 lineEPS 控制点。
  11569. * @example
  11570. * var points = [];
  11571. * points.push(new GeometryPoint(-50,30));
  11572. * points.push(new GeometryPoint(-30,50,"LTypeArc"));
  11573. * points.push(new GeometryPoint(2,60));
  11574. * points.push(new GeometryPoint(8,20));
  11575. * var lineEPS = GeometryLineString.createLineEPS(points);
  11576. */
  11577. static createLineEPS(points) {
  11578. var list = [],
  11579. len = points.length;
  11580. if (len < 2) {
  11581. return points;
  11582. }
  11583. for (var i = 0; i < len;) {
  11584. var type = points[i].type;
  11585. if (type == 'LTypeArc') {
  11586. var listObj = LineString.createLineArc(list, i, len, points);
  11587. list = listObj[0];
  11588. i = listObj[1];
  11589. } else {
  11590. list.push(points[i]);
  11591. i++;
  11592. }
  11593. }
  11594. return list;
  11595. }
  11596. static createLineArc(list, i, len, points) {
  11597. if (i == 0) {
  11598. let bezierPtsObj = LineString.addPointEPS(points, i, len, 'LTypeArc');
  11599. Array.prototype.push.apply(list, bezierPtsObj[0]);
  11600. i = bezierPtsObj[1] + 1;
  11601. } else if (i == len - 1) {
  11602. var bezierP = [points[i - 1], points[i]],
  11603. bezierPts = LineString.calculateCircle(bezierP);
  11604. Array.prototype.push.apply(list, bezierPts);
  11605. i++;
  11606. } else {
  11607. let bezierPtsObj = LineString.addPointEPS(points, i, len, 'LTypeArc');
  11608. list.pop();
  11609. Array.prototype.push.apply(list, bezierPtsObj[0]);
  11610. i = bezierPtsObj[1] + 1;
  11611. }
  11612. return [list, i];
  11613. }
  11614. static addPointEPS(points, i, len, type) {
  11615. var bezierP = [], j = i + 1;
  11616. if (i == 0) {
  11617. Array.prototype.push.apply(bezierP, [points[i], points[i + 1]]);
  11618. } else if (i == len - 1) {
  11619. Array.prototype.push.apply(bezierP, [points[i - 1], points[i]]);
  11620. } else {
  11621. Array.prototype.push.apply(bezierP, [points[i - 1], points[i], points[i + 1]]);
  11622. }
  11623. var bezierPts;
  11624. if (type == 'LTypeCurve') {
  11625. bezierPts = LineString.calculatePointsFBZN(bezierP);
  11626. } else if (type == 'LTypeArc') {
  11627. bezierPts = LineString.calculateCircle(bezierP);
  11628. }
  11629. return [bezierPts, j];
  11630. }
  11631. }
  11632. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/LinearRing.js
  11633. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  11634. * This program are made available under the terms of the Apache License, Version 2.0
  11635. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11636. /**
  11637. * @class GeometryLinearRing
  11638. * @aliasclass Geometry.LinearRing
  11639. * @deprecatedclass SuperMap.Geometry.LinearRing
  11640. * @classdesc 几何对象线环类,是一个特殊的封闭的线串,在每次 addPoint/removePoint 之后会通过添加一个点(此点是复制的第一个点得到的)
  11641. * 作为最后的一个点来自动关闭线环。
  11642. * @category BaseTypes Geometry
  11643. * @extends GeometryLineString
  11644. * @param {Array.<GeometryPoint>} points - 组成线性环的点。
  11645. * @example
  11646. * var points = [new GeometryPoint(4933.319287022352, -3337.3849141502124),
  11647. * new GeometryPoint(4960.9674060199022, -3349.3316322355736),
  11648. * new GeometryPoint(5006.0235999418364, -3358.8890067038628),
  11649. * new GeometryPoint(5075.3145648369318, -3378.0037556404409),
  11650. * new GeometryPoint(5305.19551436013, -3376.9669111768926)],
  11651. * var linearRing = new GeometryLinearRing(points);
  11652. * @usage
  11653. */
  11654. class LinearRing_LinearRing extends LineString {
  11655. constructor(points) {
  11656. super(points);
  11657. /**
  11658. * @member {Array.<string>} [GeometryLinearRing.prototype.componentTypes=["SuperMap.Geometry.Point"]]
  11659. * @description components 存储的几何对象所支持的几何类型数组,为空表示类型不受限制。
  11660. * @readonly
  11661. */
  11662. this.componentTypes = ["SuperMap.Geometry.Point"];
  11663. this.CLASS_NAME = "SuperMap.Geometry.LinearRing";
  11664. this.geometryType = "LinearRing";
  11665. }
  11666. /**
  11667. * @function GeometryLinearRing.prototype.addComponent
  11668. * @description 添加一个点到几何图形数组中,如果这个点将要被添加到组件数组的末端,并且与数组中已经存在的最后一个点相同,
  11669. * 重复的点是不能被添加的。这将影响未关闭环的关闭。
  11670. * 这个方法可以通过将非空索引(组件数组的下标)作为第二个参数重写。
  11671. * @param {GeometryPoint} point - 点对象。
  11672. * @param {number} [index] - 插入组件数组的下标。
  11673. * @returns {boolean} 点对象是否添加成功。
  11674. */
  11675. addComponent(point, index) {
  11676. var added = false;
  11677. //remove last point
  11678. var lastPoint = this.components.pop();
  11679. // given an index, add the point
  11680. // without an index only add non-duplicate points
  11681. if (index != null || !point.equals(lastPoint)) {
  11682. added = super.addComponent.apply(this, arguments);
  11683. }
  11684. //append copy of first point
  11685. var firstPoint = this.components[0];
  11686. super.addComponent.apply(this, [firstPoint]);
  11687. return added;
  11688. }
  11689. /**
  11690. * @function GeometryLinearRing.prototype.removeComponent
  11691. * @description 从几何组件中删除一个点。
  11692. * @param {GeometryPoint} point - 点对象。
  11693. * @returns {boolean} 点对象是否删除。
  11694. */
  11695. removeComponent(point) { // eslint-disable-line no-unused-vars
  11696. var removed = this.components && (this.components.length > 3);
  11697. if (removed) {
  11698. //remove last point
  11699. this.components.pop();
  11700. //remove our point
  11701. super.removeComponent.apply(this, arguments);
  11702. //append copy of first point
  11703. var firstPoint = this.components[0];
  11704. super.addComponent.apply(this, [firstPoint]);
  11705. }
  11706. return removed;
  11707. }
  11708. /**
  11709. * @function GeometryLinearRing.prototype.getArea
  11710. * @description 获得当前几何对象区域大小,如果是沿顺时针方向的环则是正值,否则为负值。
  11711. * @returns {number} 环的面积。
  11712. */
  11713. getArea() {
  11714. var area = 0.0;
  11715. if (this.components && (this.components.length > 2)) {
  11716. var sum = 0.0;
  11717. for (var i = 0, len = this.components.length; i < len - 1; i++) {
  11718. var b = this.components[i];
  11719. var c = this.components[i + 1];
  11720. sum += (b.x + c.x) * (c.y - b.y);
  11721. }
  11722. area = -sum / 2.0;
  11723. }
  11724. return area;
  11725. }
  11726. /**
  11727. * @function GeometryLinearRing.prototype.getVertices
  11728. * @description 返回几何图形的所有点的列表。
  11729. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false ,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
  11730. * @returns {Array} 几何对象所有点的列表。
  11731. */
  11732. getVertices(nodes) {
  11733. return (nodes === true) ? [] : this.components.slice(0, this.components.length - 1);
  11734. }
  11735. }
  11736. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Polygon.js
  11737. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  11738. * This program are made available under the terms of the Apache License, Version 2.0
  11739. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11740. /**
  11741. * @class GeometryPolygon
  11742. * @aliasclass Geometry.Polygon
  11743. * @deprecatedclass SuperMap.Geometry.Polygon
  11744. * @classdesc 多边形几何对象类。
  11745. * @category BaseTypes Geometry
  11746. * @extends GeometryCollection
  11747. * @param {Array.<GeometryLinearRing>} components - 多边形的线环数组。
  11748. * @example
  11749. * var points =[new GeometryPoint(0,4010338),
  11750. * new GeometryPoint(1063524,4010338),
  11751. * new GeometryPoint(1063524,3150322),
  11752. * new GeometryPoint(0,3150322)
  11753. * ],
  11754. * var linearRings = new GeometryLinearRing(points),
  11755. * var region = new GeometryPolygon([linearRings]);
  11756. * @usage
  11757. */
  11758. class Polygon_Polygon extends Collection {
  11759. constructor(components) {
  11760. super(components);
  11761. /**
  11762. * @member {Array.<string>} [GeometryPolygon.prototype.componentTypes=["SuperMap.Geometry.LinearRing"]]
  11763. * @description components 存储的几何对象所支持的几何类型数组。
  11764. * @readonly
  11765. */
  11766. this.componentTypes = ["SuperMap.Geometry.LinearRing"];
  11767. this.CLASS_NAME = "SuperMap.Geometry.Polygon";
  11768. this.geometryType = "Polygon";
  11769. }
  11770. /**
  11771. * @function GeometryMultiPoint.prototype.getArea
  11772. * @description 获得区域面积,从区域的外部口径减去计此区域内部口径算所得的面积。
  11773. * @returns {number} 几何对象的面积。
  11774. */
  11775. getArea() {
  11776. var area = 0.0;
  11777. if (this.components && (this.components.length > 0)) {
  11778. area += Math.abs(this.components[0].getArea());
  11779. for (var i = 1, len = this.components.length; i < len; i++) {
  11780. area -= Math.abs(this.components[i].getArea());
  11781. }
  11782. }
  11783. return area;
  11784. }
  11785. }
  11786. ;// CONCATENATED MODULE: ./src/common/commontypes/Feature.js
  11787. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  11788. * This program are made available under the terms of the Apache License, Version 2.0
  11789. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11790. /**
  11791. * @class Feature
  11792. * @deprecatedclass SuperMap.Feature
  11793. * @category BaseTypes Geometry
  11794. * @classdesc 要素类组合了地理和属性,Feature 类同时具有 marker 和 lonlat 属性。
  11795. * @param {SuperMap.Layer} layer - 图层。
  11796. * @param {LonLat} lonlat - 经纬度。
  11797. * @param {Object} data - 数据对象。
  11798. * @usage
  11799. */
  11800. class Feature_Feature {
  11801. constructor(layer, lonlat, data) {
  11802. this.CLASS_NAME = "SuperMap.Feature";
  11803. /**
  11804. * @deprecated
  11805. * @member {SuperMap.Layer} Feature.prototype.layer
  11806. * @description 图层。
  11807. */
  11808. this.layer = layer;
  11809. /**
  11810. * @member {string} Feature.prototype.id
  11811. * @description 要素 ID。
  11812. */
  11813. this.id = Util_Util.createUniqueID(this.CLASS_NAME + "_");
  11814. /**
  11815. * @member {LonLat} Feature.prototype.lonlat
  11816. * @description 经纬度。
  11817. *
  11818. */
  11819. this.lonlat = lonlat;
  11820. /**
  11821. * @member {Object} Feature.prototype.data
  11822. * @description 数据对象。
  11823. */
  11824. this.data = (data != null) ? data : {};
  11825. }
  11826. /**
  11827. * @function Feature.prototype.destroy
  11828. * @description 释放相关资源。
  11829. */
  11830. destroy() {
  11831. this.id = null;
  11832. this.lonlat = null;
  11833. this.data = null;
  11834. }
  11835. }
  11836. ;// CONCATENATED MODULE: ./src/common/commontypes/Vector.js
  11837. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  11838. * This program are made available under the terms of the Apache License, Version 2.0
  11839. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11840. /**
  11841. * @class FeatureVector
  11842. * @aliasclass Feature.Vector
  11843. * @deprecatedclass SuperMap.Feature.Vector
  11844. * @category BaseTypes Geometry
  11845. * @classdesc 矢量要素类。该类具有 Geometry 属性存放几何信息,
  11846. * attributes 属性存放非几何信息,另外还包含了 style 属性,用来定义矢量要素的样式,
  11847. * 其中,默认的样式在 {@link FeatureVector.style} 类中定义,如果没有特别的指定将使用默认的样式。
  11848. * @extends {Feature}
  11849. * @param {Geometry} geometry - 要素的几何信息。
  11850. * @param {Object} [attributes] - 描述要素的任意的可序列化属性,将要映射到 attributes 属性中的对象。
  11851. * @param {Object} [style] - 样式对象。
  11852. * @example
  11853. * var geometry = new GeometryPoint(-115,10);
  11854. * var style = {
  11855. * strokeColor:"#339933",
  11856. * strokeOpacity:1,
  11857. * strokeWidth:3,
  11858. * pointRadius:6
  11859. * }
  11860. * var pointFeature = new FeatureVector(geometry,null,style);
  11861. * vectorLayer.addFeatures(pointFeature);
  11862. * @usage
  11863. */
  11864. // TRASH THIS
  11865. const State = {
  11866. /** states */
  11867. UNKNOWN: 'Unknown',
  11868. INSERT: 'Insert',
  11869. UPDATE: 'Update',
  11870. DELETE: 'Delete'
  11871. };
  11872. class Vector extends Feature_Feature {
  11873. constructor(geometry, attributes, style) {
  11874. super(null, null, attributes);
  11875. /**
  11876. * @member {string} FeatureVector.prototype.fid
  11877. * @description fid。
  11878. */
  11879. this.fid = null;
  11880. /**
  11881. * @member {Geometry} FeatureVector.prototype.geometry
  11882. * @description 存放几何信息。
  11883. */
  11884. this.geometry = geometry ? geometry : null;
  11885. /**
  11886. * @member {Object} FeatureVector.prototype.attributes
  11887. * @description 描述要素的任意的可序列化属性。
  11888. */
  11889. this.attributes = {};
  11890. if (attributes) {
  11891. this.attributes = Util_Util.extend(this.attributes, attributes);
  11892. }
  11893. /**
  11894. * @member {Bounds} FeatureVector.prototype.bounds
  11895. * @description 限制要素几何的边界。
  11896. */
  11897. this.bounds = null;
  11898. /**
  11899. * @member {string} FeatureVector.prototype.state
  11900. * @description state。
  11901. */
  11902. this.state = null;
  11903. /**
  11904. * @member {Object} FeatureVector.prototype.style
  11905. * @description 要素的样式属性,地图查询返回的 feature 的 style,8C 变为null。
  11906. */
  11907. this.style = style ? style : null;
  11908. /**
  11909. * @member {string} FeatureVector.prototype.url
  11910. * @description 如果设置了这个属性,在更新或者删除要素时需要考虑 {@link HTTP} 。
  11911. */
  11912. this.url = null;
  11913. this.lonlat = null;
  11914. this.CLASS_NAME = "SuperMap.Feature.Vector";
  11915. Vector.style = {
  11916. 'default': {
  11917. fillColor: "#ee9900",
  11918. fillOpacity: 0.4,
  11919. hoverFillColor: "white",
  11920. hoverFillOpacity: 0.8,
  11921. strokeColor: "#ee9900",
  11922. strokeOpacity: 1,
  11923. strokeWidth: 1,
  11924. strokeLinecap: "round",
  11925. strokeDashstyle: "solid",
  11926. hoverStrokeColor: "red",
  11927. hoverStrokeOpacity: 1,
  11928. hoverStrokeWidth: 0.2,
  11929. pointRadius: 6,
  11930. hoverPointRadius: 1,
  11931. hoverPointUnit: "%",
  11932. pointerEvents: "visiblePainted",
  11933. cursor: "inherit",
  11934. fontColor: "#000000",
  11935. labelAlign: "cm",
  11936. labelOutlineColor: "white",
  11937. labelOutlineWidth: 3
  11938. },
  11939. 'select': {
  11940. fillColor: "blue",
  11941. fillOpacity: 0.4,
  11942. hoverFillColor: "white",
  11943. hoverFillOpacity: 0.8,
  11944. strokeColor: "blue",
  11945. strokeOpacity: 1,
  11946. strokeWidth: 2,
  11947. strokeLinecap: "round",
  11948. strokeDashstyle: "solid",
  11949. hoverStrokeColor: "red",
  11950. hoverStrokeOpacity: 1,
  11951. hoverStrokeWidth: 0.2,
  11952. pointRadius: 6,
  11953. hoverPointRadius: 1,
  11954. hoverPointUnit: "%",
  11955. pointerEvents: "visiblePainted",
  11956. cursor: "pointer",
  11957. fontColor: "#000000",
  11958. labelAlign: "cm",
  11959. labelOutlineColor: "white",
  11960. labelOutlineWidth: 3
  11961. },
  11962. 'temporary': {
  11963. fillColor: "#66cccc",
  11964. fillOpacity: 0.2,
  11965. hoverFillColor: "white",
  11966. hoverFillOpacity: 0.8,
  11967. strokeColor: "#66cccc",
  11968. strokeOpacity: 1,
  11969. strokeLinecap: "round",
  11970. strokeWidth: 2,
  11971. strokeDashstyle: "solid",
  11972. hoverStrokeColor: "red",
  11973. hoverStrokeOpacity: 1,
  11974. hoverStrokeWidth: 0.2,
  11975. pointRadius: 6,
  11976. hoverPointRadius: 1,
  11977. hoverPointUnit: "%",
  11978. pointerEvents: "visiblePainted",
  11979. //cursor:"inherit",
  11980. cursor: "default",
  11981. fontColor: "#000000",
  11982. labelAlign: "cm",
  11983. labelOutlineColor: "white",
  11984. labelOutlineWidth: 3
  11985. },
  11986. 'delete': {
  11987. display: "none"
  11988. }
  11989. };
  11990. }
  11991. /**
  11992. * @function FeatureVector.prototype.destroy
  11993. * @description 释放资源,将引用资源的属性置空。
  11994. */
  11995. destroy() {
  11996. if (this.layer) {
  11997. this.layer.removeFeatures(this);
  11998. this.layer = null;
  11999. }
  12000. this.geometry = null;
  12001. super.destroy();
  12002. }
  12003. /**
  12004. * @function FeatureVector.prototype.clone
  12005. * @description 复制矢量要素,并返回复制后的新对象。
  12006. * @returns {FeatureVector} 相同要素的新的矢量要素。
  12007. */
  12008. clone() {
  12009. return new Vector(
  12010. this.geometry ? this.geometry.clone() : null,
  12011. this.attributes,
  12012. this.style);
  12013. }
  12014. /**
  12015. * @function FeatureVector.prototype.toState
  12016. * @description 设置新状态。
  12017. * @param {string} state - 状态。
  12018. */
  12019. toState(state) {
  12020. if (state === State.UPDATE) {
  12021. switch (this.state) {
  12022. case State.UNKNOWN:
  12023. case State.DELETE:
  12024. this.state = state;
  12025. break;
  12026. case State.UPDATE:
  12027. case State.INSERT:
  12028. break;
  12029. }
  12030. } else if (state === State.INSERT) {
  12031. switch (this.state) {
  12032. case State.UNKNOWN:
  12033. break;
  12034. default:
  12035. this.state = state;
  12036. break;
  12037. }
  12038. } else if (state === State.DELETE) {
  12039. switch (this.state) {
  12040. case State.INSERT:
  12041. // the feature should be destroyed
  12042. break;
  12043. case State.DELETE:
  12044. break;
  12045. case State.UNKNOWN:
  12046. case State.UPDATE:
  12047. this.state = state;
  12048. break;
  12049. }
  12050. } else if (state === State.UNKNOWN) {
  12051. this.state = state;
  12052. }
  12053. }
  12054. }
  12055. /**
  12056. *
  12057. * @typedef {Object} FeatureVector.style
  12058. * @description Feature 有大量的样式属性,如果没有特别的指定将使用默认的样式,
  12059. * 大部分样式通过 SVG 标准定义属性。
  12060. * - fill properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#FillProperties}
  12061. * - stroke properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#StrokeProperties}
  12062. * @property {boolean} [fill] - 不需要填充则设置为 false。
  12063. * @property {string} [fillColor='#ee9900'] - 十六进制填充颜色。
  12064. * @property {number} [fillOpacity=0.4] - 填充不透明度。
  12065. * @property {boolean} [stroke] - 不需要描边则设为 false。
  12066. * @property {string} [strokeColor='#ee9900'] - 十六进制描边颜色。
  12067. * @property {number} [strokeOpacity=0.4] - 描边的不透明度(0-1)。
  12068. * @property {number} [strokeWidth=1] - 像素描边宽度。
  12069. * @property {string} [strokeLinecap='round'] - strokeLinecap 有三种类型 butt,round,square。
  12070. * @property {string} [strokeDashstyle='solid'] - 有 dot,dash,dashdot,longdash,longdashdot,solid 几种样式。
  12071. * @property {boolean} [graphic] - 不需要则设置为 false。
  12072. * @property {number} [pointRadius=6] - 像素点半径。
  12073. * @property {string} [pointerEvents='visiblePainted'] - pointerEvents。
  12074. * @property {string} [cursor] - cursor。
  12075. * @property {boolean} [allowRotate='false'] - 是否允许图标随着运行方向旋转。用于时空数据图层。
  12076. * @property {string} [externalGraphic] - 连接到用来渲染点的外部的图形。
  12077. * @property {number} [graphicWidth] - 外部图表的像素宽度。
  12078. * @property {number} [graphicHeight] - 外部图表的像素高度。
  12079. * @property {number} [graphicOpacity] - 外部图表的不透明度(0-1)。
  12080. * @property {number} [graphicXOffset] - 外部图表沿着x方向的偏移量。
  12081. * @property {number} [graphicYOffset] - 外部图表沿着y方向的偏移量。
  12082. * @property {number} [rotation] - 一个图表沿着其中心点(或者偏移中心指定点)在顺时针方向旋转。
  12083. * @property {number} [graphicZIndex] - 渲染时使用的索引值。
  12084. * @property {string} [graphicName='circle'] - 渲染点时图标使用的名字。支持"circle" , "square", "star", "x", "cross", "triangle"。
  12085. * @property {string} [graphicTitle] - 外部图表的提示框。
  12086. * @property {string} [backgroundGraphic] - 外部图表的背景。
  12087. * @property {number} [backgroundGraphicZIndex] - 背景图渲染时使用的索引值。
  12088. * @property {number} [backgroundXOffset] - 背景图在 x 轴的偏移量。
  12089. * @property {number} [backgroundYOffset] - 背景图在 y 轴的偏移量。
  12090. * @property {number} [backgroundHeight] - 背景图的高度。如果没有设置,将用 graphicHeight。
  12091. * @property {number} [backgroundWidth] - 背景图的宽度。如果没有设置,将用 graphicWidth。
  12092. * @property {boolean} [isUnicode=false] - 这个属性要配合 label 属性来用,当为 true时,label 就可以使用 unicode 编码,
  12093. * 比如 "a" 的 unicode 十六进制编码为 61,则 label 属性可以为 "&#x61;",其中 "&#" 为前缀,标志这个为 unicode 编码,
  12094. * "x" 是指 16 进制,这时页面显示的是 "a";当此值为 false 的时候,label 的内容会被直接输出,
  12095. * 比如,label 为 "&#x61;",这时页面显示的也是 "&#x61;"。
  12096. * @property {string} [label] - 可选的标签文本。
  12097. * @property {string} [labelAlign='cm'] - 标签对齐,是由两个字符组成的字符串,如:"lt", "cm", "rb",
  12098. * 其中第一个字符代表水平方向上的对齐,"l"=left, "c"=center, "r"=right;
  12099. * 第二个字符代表垂直方向上的对齐,"t"=top, "m"=middle, "b"=bottom。
  12100. * @property {number} [labelXOffset] - 标签在 x 轴方向的偏移量。
  12101. * @property {number} [labelYOffset] - 标签在 y 轴方向的偏移量。
  12102. * @property {boolean} [labelSelect=false] - 如果设为 true,标签可以选用 SelectFeature 或者 similar 控件。
  12103. * @property {string} [fontColor='#000000'] - 标签字体颜色。
  12104. * @property {number} [fontOpacity] - 标签透明度 (0-1)。
  12105. * @property {string} [fontFamily] - 标签的字体类型。
  12106. * @property {string} [fontSize] - 标签的字体大小。
  12107. * @property {string} [fontStyle] - 标签的字体样式。
  12108. * @property {string} [fontWeight] - 标签的字体粗细。
  12109. * @property {string} [display] - 如果 display 属性设置为 “none”,符号将没有任何效果。
  12110. * @example
  12111. * // label的用法如下:
  12112. * function addGeoTest(){
  12113. * var geometry = new GeometryPoint(105, 35);
  12114. * var pointFeature = new FeatureVector(geometry);
  12115. * var styleTest = {
  12116. * label:"supermap",
  12117. * fontColor:"#0000ff",
  12118. * fontOpacity:"0.5",
  12119. * fontFamily:"隶书",
  12120. * fontSize:"8em",
  12121. * fontWeight:"bold",
  12122. * fontStyle:"italic",
  12123. * labelSelect:"true",
  12124. * }
  12125. * pointFeature.style = styleTest;
  12126. * vectorLayer.addFeatures([pointFeature]);
  12127. * }
  12128. */
  12129. ;// CONCATENATED MODULE: ./src/common/format/Format.js
  12130. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  12131. * This program are made available under the terms of the Apache License, Version 2.0
  12132. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12133. /**
  12134. * @class Format
  12135. * @deprecatedclass SuperMap.Format
  12136. * @classdesc 读写各种格式的格式类基类。其子类应该包含并实现 read 和 write 方法。
  12137. * @category BaseTypes Format
  12138. * @param {Object} options - 可选参数。
  12139. * @param {boolean} [options.keepData=false] - 如果设置为 true, data 属性会指向被解析的对象(例如 JSON 或 xml 数据对象)。
  12140. * @param {Object} [options.data] - 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  12141. * @usage
  12142. */
  12143. class Format {
  12144. constructor(options) {
  12145. /**
  12146. * @member {Object} Format.prototype.data
  12147. * @description 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  12148. */
  12149. this.data = null;
  12150. /**
  12151. * @member {Object} [Format.prototype.keepData=false]
  12152. * @description 保持最近读到的数据的引用(通过 data 属性)。
  12153. */
  12154. this.keepData = false;
  12155. Util_Util.extend(this, options);
  12156. this.options = options;
  12157. this.CLASS_NAME = "SuperMap.Format";
  12158. }
  12159. /**
  12160. * @function Format.prototype.destroy
  12161. * @description 销毁该格式类,释放相关资源。
  12162. */
  12163. destroy() {
  12164. //用来销毁该格式类,释放相关资源
  12165. }
  12166. /**
  12167. * @function Format.prototype.read
  12168. * @description 来从字符串中读取数据。
  12169. * @param {string} data - 读取的数据。
  12170. */
  12171. read(data) { // eslint-disable-line no-unused-vars
  12172. //用来从字符串中读取数据
  12173. }
  12174. /**
  12175. * @function Format.prototype.write
  12176. * @description 将对象写成字符串。
  12177. * @param {Object} object - 可序列化的对象。
  12178. * @returns {string} 对象转化后的字符串。
  12179. */
  12180. write(object) { // eslint-disable-line no-unused-vars
  12181. //用来写字符串
  12182. }
  12183. }
  12184. ;// CONCATENATED MODULE: ./src/common/format/JSON.js
  12185. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  12186. * This program are made available under the terms of the Apache License, Version 2.0
  12187. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12188. /**
  12189. * @class JSONFormat
  12190. * @aliasclass Format.JSON
  12191. * @deprecatedclass SuperMap.Format.JSON
  12192. * @classdesc 安全的读写 JSON 的解析类。使用 {@link JSONFormat} 构造函数创建新实例。
  12193. * @category BaseTypes Format
  12194. * @param {Object} [options] - 可选参数。
  12195. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  12196. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  12197. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  12198. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  12199. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  12200. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  12201. * @extends {Format}
  12202. * @usage
  12203. */
  12204. class JSONFormat extends Format {
  12205. constructor(options) {
  12206. super(options);
  12207. /**
  12208. * @member {string} [JSONFormat.prototype.indent=" "]
  12209. * @description 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  12210. */
  12211. this.indent = " ";
  12212. /**
  12213. * @member {string} [JSONFormat.prototype.space=" "]
  12214. * @description 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  12215. */
  12216. this.space = " ";
  12217. /**
  12218. * @member {string} [JSONFormat.prototype.newline="\n"]
  12219. * @description 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  12220. */
  12221. this.newline = "\n";
  12222. /**
  12223. * @member {number} [JSONFormat.prototype.level=0]
  12224. * @description 用于格式化输出, 表示的是缩进级别。
  12225. */
  12226. this.level = 0;
  12227. /**
  12228. * @member {boolean} [JSONFormat.prototype.pretty=false]
  12229. * @description 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  12230. */
  12231. this.pretty = false;
  12232. /**
  12233. * @member {boolean} JSONFormat.prototype.nativeJSON
  12234. * @description 判断浏览器是否原生支持 JSON 格式数据。
  12235. */
  12236. this.nativeJSON = (function () {
  12237. return !!(window.JSON && typeof JSON.parse === "function" && typeof JSON.stringify === "function");
  12238. })();
  12239. this.CLASS_NAME = "SuperMap.Format.JSON";
  12240. /**
  12241. * @member JSONFormat.prototype.serialize
  12242. * @description 提供一些类型对象转 JSON 字符串的方法。
  12243. */
  12244. this.serialize = {
  12245. /**
  12246. * @function JSONFormat.serialize.object
  12247. * @description 把对象转换为 JSON 字符串。
  12248. * @param {Object} object - 可序列化的对象。
  12249. * @returns {string} JSON 字符串。
  12250. */
  12251. 'object': function (object) {
  12252. // three special objects that we want to treat differently
  12253. if (object == null) {
  12254. return "null";
  12255. }
  12256. if (object.constructor === Date) {
  12257. return this.serialize.date.apply(this, [object]);
  12258. }
  12259. if (object.constructor === Array) {
  12260. return this.serialize.array.apply(this, [object]);
  12261. }
  12262. var pieces = ['{'];
  12263. this.level += 1;
  12264. var key, keyJSON, valueJSON;
  12265. var addComma = false;
  12266. for (key in object) {
  12267. if (object.hasOwnProperty(key)) {
  12268. // recursive calls need to allow for sub-classing
  12269. keyJSON = this.write.apply(this,
  12270. [key, this.pretty]);
  12271. valueJSON = this.write.apply(this,
  12272. [object[key], this.pretty]);
  12273. if (keyJSON != null && valueJSON != null) {
  12274. if (addComma) {
  12275. pieces.push(',');
  12276. }
  12277. pieces.push(this.writeNewline(), this.writeIndent(),
  12278. keyJSON, ':', this.writeSpace(), valueJSON);
  12279. addComma = true;
  12280. }
  12281. }
  12282. }
  12283. this.level -= 1;
  12284. pieces.push(this.writeNewline(), this.writeIndent(), '}');
  12285. return pieces.join('');
  12286. },
  12287. /**
  12288. * @function JSONFormat.serialize.array
  12289. * @description 把数组转换成 JSON 字符串。
  12290. * @param {Array} array - 可序列化的数组。
  12291. * @returns {string} JSON 字符串。
  12292. */
  12293. 'array': function (array) {
  12294. var json;
  12295. var pieces = ['['];
  12296. this.level += 1;
  12297. for (var i = 0, len = array.length; i < len; ++i) {
  12298. // recursive calls need to allow for sub-classing
  12299. json = this.write.apply(this,
  12300. [array[i], this.pretty]);
  12301. if (json != null) {
  12302. if (i > 0) {
  12303. pieces.push(',');
  12304. }
  12305. pieces.push(this.writeNewline(), this.writeIndent(), json);
  12306. }
  12307. }
  12308. this.level -= 1;
  12309. pieces.push(this.writeNewline(), this.writeIndent(), ']');
  12310. return pieces.join('');
  12311. },
  12312. /**
  12313. * @function JSONFormat.serialize.string
  12314. * @description 把字符串转换成 JSON 字符串。
  12315. * @param {string} string - 可序列化的字符串。
  12316. * @returns {string} JSON 字符串。
  12317. */
  12318. 'string': function (string) {
  12319. // If the string contains no control characters, no quote characters, and no
  12320. // backslash characters, then we can simply slap some quotes around it.
  12321. // Otherwise we must also replace the offending characters with safe
  12322. // sequences.
  12323. var m = {
  12324. '\b': '\\b',
  12325. '\t': '\\t',
  12326. '\n': '\\n',
  12327. '\f': '\\f',
  12328. '\r': '\\r',
  12329. '"': '\\"',
  12330. '\\': '\\\\'
  12331. };
  12332. /*eslint-disable no-control-regex*/
  12333. if (/["\\\x00-\x1f]/.test(string)) {
  12334. return '"' + string.replace(/([\x00-\x1f\\"])/g, function (a, b) {
  12335. var c = m[b];
  12336. if (c) {
  12337. return c;
  12338. }
  12339. c = b.charCodeAt();
  12340. return '\\u00' +
  12341. Math.floor(c / 16).toString(16) +
  12342. (c % 16).toString(16);
  12343. }) + '"';
  12344. }
  12345. return '"' + string + '"';
  12346. },
  12347. /**
  12348. * @function JSONFormat.serialize.number
  12349. * @description 把数字转换成 JSON 字符串。
  12350. * @param {number} number - 可序列化的数字。
  12351. * @returns {string} JSON 字符串。
  12352. */
  12353. 'number': function (number) {
  12354. return isFinite(number) ? String(number) : "null";
  12355. },
  12356. /**
  12357. * @function JSONFormat.serialize.boolean
  12358. * @description Transform a boolean into a JSON string.
  12359. * @param {boolean} bool - The boolean to be serialized.
  12360. * @returns {string} A JSON string representing the boolean.
  12361. */
  12362. 'boolean': function (bool) {
  12363. return String(bool);
  12364. },
  12365. /**
  12366. * @function JSONFormat.serialize.object
  12367. * @description 将日期对象转换成 JSON 字符串。
  12368. * @param {Date} date - 可序列化的日期对象。
  12369. * @returns {string} JSON 字符串。
  12370. */
  12371. 'date': function (date) {
  12372. function format(number) {
  12373. // Format integers to have at least two digits.
  12374. return (number < 10) ? '0' + number : number;
  12375. }
  12376. return '"' + date.getFullYear() + '-' +
  12377. format(date.getMonth() + 1) + '-' +
  12378. format(date.getDate()) + 'T' +
  12379. format(date.getHours()) + ':' +
  12380. format(date.getMinutes()) + ':' +
  12381. format(date.getSeconds()) + '"';
  12382. }
  12383. };
  12384. }
  12385. /**
  12386. * @function JSONFormat.prototype.read
  12387. * @description 将一个符合 JSON 结构的字符串进行解析。
  12388. * @param {string} json - 符合 JSON 结构的字符串。
  12389. * @param {function} filter - 过滤方法,最终结果的每一个键值对都会调用该过滤方法,并在对应的值的位置替换成该方法返回的值。
  12390. * @returns {(Object|string|Array|number|boolean)} 对象,数组,字符串或数字。
  12391. */
  12392. read(json, filter) {
  12393. var object;
  12394. if (this.nativeJSON) {
  12395. try {
  12396. object = JSON.parse(json, filter);
  12397. } catch (e) {
  12398. // Fall through if the regexp test fails.
  12399. return { data: json}
  12400. }
  12401. }
  12402. if (this.keepData) {
  12403. this.data = object;
  12404. }
  12405. return object;
  12406. }
  12407. /**
  12408. * @function JSONFormat.prototype.write
  12409. * @description 序列化一个对象到一个符合 JSON 格式的字符串。
  12410. * @param {Object|string|Array|number|boolean} value - 需要被序列化的对象,数组,字符串,数字,布尔值。
  12411. * @param {boolean} [pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  12412. * @returns {string} 符合 JSON 格式的字符串。
  12413. *
  12414. */
  12415. write(value, pretty) {
  12416. this.pretty = !!pretty;
  12417. var json = null;
  12418. var type = typeof value;
  12419. if (this.serialize[type]) {
  12420. try {
  12421. json = (!this.pretty && this.nativeJSON) ?
  12422. JSON.stringify(value) :
  12423. this.serialize[type].apply(this, [value]);
  12424. } catch (err) {
  12425. //console.error("Trouble serializing: " + err);
  12426. }
  12427. }
  12428. return json;
  12429. }
  12430. /**
  12431. * @function JSONFormat.prototype.writeIndent
  12432. * @description 根据缩进级别输出一个缩进字符串。
  12433. * @private
  12434. * @returns {string} 一个适当的缩进字符串。
  12435. */
  12436. writeIndent() {
  12437. var pieces = [];
  12438. if (this.pretty) {
  12439. for (var i = 0; i < this.level; ++i) {
  12440. pieces.push(this.indent);
  12441. }
  12442. }
  12443. return pieces.join('');
  12444. }
  12445. /**
  12446. * @function JSONFormat.prototype.writeNewline
  12447. * @description 在格式化输出模式情况下输出代表新一行的字符串。
  12448. * @private
  12449. * @returns {string} 代表新的一行的字符串。
  12450. */
  12451. writeNewline() {
  12452. return (this.pretty) ? this.newline : '';
  12453. }
  12454. /**
  12455. * @function JSONFormat.prototype.writeSpace
  12456. * @private
  12457. * @description 在格式化输出模式情况下输出一个代表空格的字符串。
  12458. * @returns {string} 空格字符串。
  12459. */
  12460. writeSpace() {
  12461. return (this.pretty) ? this.space : '';
  12462. }
  12463. }
  12464. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiLineString.js
  12465. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  12466. * This program are made available under the terms of the Apache License, Version 2.0
  12467. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12468. /**
  12469. * @class GeometryMultiLineString
  12470. * @aliasclass Geometry.MultiLineString
  12471. * @deprecatedclass SuperMap.Geometry.MultiLineString
  12472. * @classdesc 几何对象多线类。
  12473. * @category BaseTypes Geometry
  12474. * @extends GeometryCollection
  12475. * @param {Array.<GeometryLineString>} components - GeometryLineString 数组。
  12476. * @example
  12477. * var multi = new GeometryMultiLineString([
  12478. * new GeometryLineString([
  12479. * new GeometryPoint(1, 0),
  12480. * new GeometryPoint(0, 1)
  12481. * ])
  12482. * ]);
  12483. * @usage
  12484. */
  12485. class MultiLineString extends Collection {
  12486. constructor(components) {
  12487. super(components);
  12488. /**
  12489. * @member {Array.<string>} [GeometryMultiLineString.prototype.componentTypes=["SuperMap.Geometry.LineString"]]
  12490. * @description components 存储的几何对象所支持的几何类型数组。
  12491. * @readonly
  12492. */
  12493. this.componentTypes = ["SuperMap.Geometry.LineString"];
  12494. this.CLASS_NAME = "SuperMap.Geometry.MultiLineString";
  12495. this.geometryType = "MultiLineString";
  12496. }
  12497. }
  12498. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPolygon.js
  12499. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  12500. * This program are made available under the terms of the Apache License, Version 2.0
  12501. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12502. /**
  12503. * @class GeometryMultiPolygon
  12504. * @aliasclass Geometry.MultiPolygon
  12505. * @deprecatedclass SuperMap.Geometry.MultiPolygon
  12506. * @classdesc 几何对象多多边形类。
  12507. * @category BaseTypes Geometry
  12508. * @extends GeometryCollection
  12509. * @param {Array.<GeometryPolygon>} components - 形成 GeometryMultiPolygon 的多边形数组。
  12510. * @example
  12511. * var points1 = [new GeometryPoint(10,10),new GeometryPoint(0,0)];
  12512. * var points2 = [new GeometryPoint(10,10),new GeometryPoint(0,0),new GeometryPoint(3,3),new GeometryPoint(10,10)];
  12513. *
  12514. * var linearRing1 = new GeometryLinearRing(points1);
  12515. * var linearRing2 = new GeometryLinearRing(points2);
  12516. *
  12517. * var polygon1 = new GeometryPolygon([linearRing1]);
  12518. * var polygon2 = new GeometryPolygon([linearRing2]);
  12519. *
  12520. * var multiPolygon1 = new GeometryMultiPolygon([polygon1,polygon2]);
  12521. * @usage
  12522. */
  12523. class MultiPolygon extends Collection {
  12524. constructor(components) {
  12525. super(components);
  12526. /**
  12527. * @member {Array.<string>} [GeometryMultiPolygon.prototype.componentTypes=["SuperMap.Geometry.Polygon"]]
  12528. * @description components 存储的几何对象所支持的几何类型数组。
  12529. * @readonly
  12530. */
  12531. this.componentTypes = ["SuperMap.Geometry.Polygon"];
  12532. this.CLASS_NAME = "SuperMap.Geometry.MultiPolygon";
  12533. this.geometryType = "MultiPolygon";
  12534. }
  12535. }
  12536. ;// CONCATENATED MODULE: ./src/common/iServer/ServerColor.js
  12537. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  12538. * This program are made available under the terms of the Apache License, Version 2.0
  12539. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12540. /**
  12541. * @class ServerColor
  12542. * @deprecatedclass SuperMap.ServerColor
  12543. * @category iServer Map Theme
  12544. * @classdesc 颜色类。该类使用三原色( RGB )来表达颜色。
  12545. * @param {Object} options - 可选参数。
  12546. * @param {number} [options.red=255] - 获取或设置红色值。
  12547. * @param {number} [options.green=0] - 获取或设置绿色值。
  12548. * @param {number} [options.blue=0] - 获取或设置蓝色值。
  12549. * @usage
  12550. */
  12551. class ServerColor {
  12552. constructor(red, green, blue) {
  12553. /**
  12554. * @member {number} [ServerColor.prototype.red=255]
  12555. * @description 获取或设置红色值。
  12556. */
  12557. this.red = (!red && red != 0)?255:red;
  12558. /**
  12559. * @member {number} [ServerColor.prototype.green=0]
  12560. * @description 获取或设置绿色值。
  12561. */
  12562. this.green = green||0;
  12563. /**
  12564. * @member {number} [ServerColor.prototype.blue=0]
  12565. * @description 获取或设置蓝色值。
  12566. */
  12567. this.blue = blue||0;
  12568. this.CLASS_NAME = "SuperMap.ServerColor";
  12569. }
  12570. /**
  12571. * @function ServerColor.prototype.destroy
  12572. * @description 释放资源,将引用资源的属性置空。
  12573. */
  12574. destroy() {
  12575. var me = this;
  12576. me.red = null;
  12577. me.green = null;
  12578. me.blue = null;
  12579. }
  12580. /**
  12581. * @function ServerColor.formJson
  12582. * @description 将 JSON 对象转化为 ServerColor 对象。
  12583. * @param {Object} jsonObject - 要转换的 JSON 对象。
  12584. * @returns {ServerColor} 转化后的 ServerColor 对象。
  12585. */
  12586. static fromJson(jsonObject) {
  12587. if (!jsonObject) {
  12588. return;
  12589. }
  12590. var color = new ServerColor();
  12591. var red = 255;
  12592. if (jsonObject.red !== null) {
  12593. red = Number(jsonObject.red);
  12594. }
  12595. color.red = red;
  12596. var green = 0;
  12597. if (jsonObject.green !== null) {
  12598. green = Number(jsonObject.green);
  12599. }
  12600. color.green = green;
  12601. var blue = 0;
  12602. if (jsonObject.blue !== null) {
  12603. blue = Number(jsonObject.blue);
  12604. }
  12605. color.blue = blue;
  12606. return color;
  12607. }
  12608. }
  12609. ;// CONCATENATED MODULE: ./src/common/iServer/ServerStyle.js
  12610. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  12611. * This program are made available under the terms of the Apache License, Version 2.0
  12612. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12613. /**
  12614. * @class ServerStyle
  12615. * @deprecatedclass SuperMap.ServerStyle
  12616. * @category iServer Map Theme
  12617. * @classdesc 服务端矢量要素风格类。该类用于定义点状符号、线状符号、填充符号风格及其相关属性。
  12618. * @param {Object} options - 参数。
  12619. * @param {FillGradientMode} options.fillGradientMode - 渐变填充风格的渐变类型。
  12620. * @param {ServerColor} [options.fillBackColor=[255,255,255]] - 填充背景颜色。
  12621. * @param {boolean} [options.fillBackOpaque=false] - 背景是否不透明。
  12622. * @param {ServerColor} [options.fillForeColor=[255,0,0]] - 填充颜色。
  12623. * @param {number} [options.fillGradientAngle=0] - 渐变填充的旋转角度。
  12624. * @param {number} [options.fillGradientOffsetRatioX=0] - 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。
  12625. * @param {number} [options.fillGradientOffsetRatioY=0] - 填充中心点相对于填充区域范围中心点的垂直偏移百分比。
  12626. * @param {number} [options.fillOpaqueRate=100] - 填充不透明度。
  12627. * @param {number} [options.fillSymbolID=0] - 填充符号的编码。
  12628. * @param {ServerColor} [options.lineColor] - 矢量要素的边线颜色。默认 lineColor = new ServerColor(0, 0, 0)。
  12629. * @param {number} [options.lineSymbolID=0] - 线状符号的编码。
  12630. * @param {number} [options.lineWidth=1] - 边线的宽度。
  12631. * @param {number} [options.markerAngle=0] - 点状符号的旋转角度。
  12632. * @param {number} [options.markerSize=1] - 点状符号的大小。
  12633. * @param {number} [options.markerSymbolID=-1] - 点状符号的编码。
  12634. * @usage
  12635. */
  12636. class ServerStyle {
  12637. constructor(options) {
  12638. /**
  12639. * @member {ServerColor} ServerStyle.prototype.fillBackColor
  12640. * @description 填充背景颜色。当填充模式为渐变填充时,该颜色为填充终止色。
  12641. */
  12642. this.fillBackColor = new ServerColor(255, 255, 255);
  12643. /**
  12644. * @member {boolean} [ServerStyle.prototype.fillBackOpaque=false]
  12645. * @description 背景是否不透明。false 表示透明。
  12646. */
  12647. this.fillBackOpaque = false;
  12648. /**
  12649. * @member {ServerColor} ServerStyle.prototype.fillForeColor
  12650. * @description 填充颜色。当填充模式为渐变填充时,该颜色为填充起始颜色。
  12651. */
  12652. this.fillForeColor = new ServerColor(255, 0, 0);
  12653. /**
  12654. * @member {FillGradientMode} ServerStyle.prototype.fillGradientMode
  12655. * @description 渐变填充风格的渐变类型。
  12656. */
  12657. this.fillGradientMode = null;
  12658. /**
  12659. * @member {number} ServerStyle.prototype.fillGradientAngle -
  12660. * @description 渐变填充的旋转角度。单位为度,精确到 0.1 度,逆时针方向为正方向。
  12661. */
  12662. this.fillGradientAngle = 0;
  12663. /**
  12664. * @member {number} ServerStyle.prototype.fillGradientOffsetRatioX
  12665. * @description 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。它们的关系如下:设填充区域范围中心点的坐标为(x0, y0),
  12666. * 填充中心点的坐标为(x, y),填充区域范围的宽度为 a,水平偏移百分比为 dx,则 x=x0 + a*dx/100。
  12667. */
  12668. this.fillGradientOffsetRatioX = 0;
  12669. /**
  12670. * @member {number} ServerStyle.prototype.fillGradientOffsetRatioY
  12671. * @description 填充中心点相对于填充区域范围中心点的垂直偏移百分比。它们的关系如下:<br>
  12672. * 设填充区域范围中心点的坐标为(x0, y0),填充中心点的坐标为(x, y),填充区域范围的高度为 b,垂直偏移百分比为 dy,则 y=y0 + b*dx/100。
  12673. */
  12674. this.fillGradientOffsetRatioY = 0;
  12675. /**
  12676. * @member {number} [ServerStyle.prototype.fillOpaqueRate=100]
  12677. * @description 填充不透明度。合法值为 0 - 100 的数值。其中为 0 表示完全透明;
  12678. * 100 表示完全不透明。赋值小于 0 时按照 0 处理,大于 100 时按照 100 处理。
  12679. */
  12680. this.fillOpaqueRate = 100;
  12681. /**
  12682. * @member {number} ServerStyle.prototype.fillSymbolID
  12683. * @description 填充符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
  12684. * 关于填充符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  12685. */
  12686. this.fillSymbolID = 0;
  12687. /**
  12688. * @member {ServerColor} ServerStyle.prototype.lineColor
  12689. * @description 矢量要素的边线颜色。如果等级符号是点符号,点符号的颜色由 lineColor 控制。
  12690. */
  12691. this.lineColor = new ServerColor(0, 0, 0);
  12692. /**
  12693. * @member {number} [ServerStyle.prototype.lineSymbolID=0]
  12694. * @description 线状符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
  12695. * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  12696. */
  12697. this.lineSymbolID = 0;
  12698. /**
  12699. * @member {number} [ServerStyle.prototype.lineWidth=1.0]
  12700. * @description 边线的宽度。单位为毫米,精度到 0.1。
  12701. */
  12702. this.lineWidth = 1;
  12703. /**
  12704. * @member {number} [ServerStyle.prototype.markerAngle=0]
  12705. * @description 点状符号的旋转角度。以度为单位,精确到 0.1 度,逆时针方向为正方向。
  12706. */
  12707. this.markerAngle = 0;
  12708. /**
  12709. * @member {number} [ServerStyle.prototype.markerSize=1.0]
  12710. * @description 点状符号的大小。单位为毫米,精度为 0.1。当该属性设置为0时,采用符号默认大小 1.0 显示。
  12711. * 当该属性设置为非法值时,交由服务器默认处理。
  12712. */
  12713. this.markerSize = 1;
  12714. /**
  12715. * @member {number} [ServerStyle.prototype.markerSymbolID=-1]
  12716. * @description 点状符号的编码。此编码用于唯一标识各点状符号。
  12717. * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  12718. */
  12719. this.markerSymbolID = -1;
  12720. if (options) {
  12721. Util_Util.extend(this, options);
  12722. }
  12723. this.CLASS_NAME = "SuperMap.ServerStyle";
  12724. }
  12725. /**
  12726. * @function ServerStyle.prototype.destroy
  12727. * @description 释放资源,将引用资源的属性置空。
  12728. */
  12729. destroy() {
  12730. var me = this;
  12731. if (me.fillBackColor) {
  12732. me.fillBackColor.destroy();
  12733. me.fillBackColor = null;
  12734. }
  12735. me.fillBackOpaque = null;
  12736. if (me.fillForeColor) {
  12737. me.fillForeColor.destroy();
  12738. me.fillForeColor = null;
  12739. }
  12740. me.fillGradientMode = null;
  12741. me.fillGradientAngle = null;
  12742. me.fillGradientOffsetRatioX = null;
  12743. me.fillGradientOffsetRatioY = null;
  12744. me.fillOpaqueRate = null;
  12745. me.fillSymbolID = null;
  12746. if (me.lineColor) {
  12747. me.lineColor.destroy();
  12748. me.lineColor = null;
  12749. }
  12750. me.lineSymbolID = null;
  12751. me.lineWidth = null;
  12752. me.markerAngle = null;
  12753. me.markerSize = null;
  12754. me.markerSymbolID = null;
  12755. }
  12756. /**
  12757. * @function ServerStyle.prototype.toServerJSONObject
  12758. * @description 转换成对应的 JSON 格式对象。
  12759. * @returns {Object} 对应的 JSON 格式对象.
  12760. */
  12761. toServerJSONObject() {
  12762. var styleObj = {};
  12763. styleObj = Util_Util.copyAttributes(styleObj, this);
  12764. //暂时先忽略serverColor往Json的转换
  12765. return styleObj;
  12766. }
  12767. /**
  12768. * @function ServerStyle.fromJson
  12769. * @description 将JSON对象转换为 ServerStyle 对象。
  12770. * @param {Object} jsonObject - 要转换的 JSON 对象。
  12771. * @returns {ServerStyle} 转化后的 ServerStyle 对象。
  12772. */
  12773. static fromJson(jsonObject) {
  12774. if (!jsonObject) {
  12775. return;
  12776. }
  12777. return new ServerStyle({
  12778. fillBackColor: ServerColor.fromJson(jsonObject.fillBackColor),
  12779. fillBackOpaque: jsonObject.fillBackOpaque,
  12780. fillForeColor: ServerColor.fromJson(jsonObject.fillForeColor),
  12781. fillGradientMode: jsonObject.fillGradientMode,
  12782. fillGradientAngle: jsonObject.fillGradientAngle,
  12783. fillGradientOffsetRatioX: jsonObject.fillGradientOffsetRatioX,
  12784. fillGradientOffsetRatioY: jsonObject.fillGradientOffsetRatioY,
  12785. fillOpaqueRate: jsonObject.fillOpaqueRate,
  12786. fillSymbolID: jsonObject.fillSymbolID,
  12787. lineColor: ServerColor.fromJson(jsonObject.lineColor),
  12788. lineSymbolID: jsonObject.lineSymbolID,
  12789. lineWidth: jsonObject.lineWidth,
  12790. markerAngle: jsonObject.markerAngle,
  12791. markerSize: jsonObject.markerSize,
  12792. markerSymbolID: jsonObject.markerSymbolID
  12793. });
  12794. }
  12795. }
  12796. ;// CONCATENATED MODULE: ./src/common/iServer/PointWithMeasure.js
  12797. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  12798. * This program are made available under the terms of the Apache License, Version 2.0
  12799. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12800. /**
  12801. * @class PointWithMeasure
  12802. * @deprecatedclass SuperMap.PointWithMeasure
  12803. * @category iServer SpatialAnalyst RouteLocator
  12804. * @classdesc 路由点类。路由点是指具有线性度量值 (Measure) 的二维地理坐标点。
  12805. * @param {Object} options - 参数。
  12806. * @param {number} options.measure - 度量值,即路由对象属性值 M。
  12807. * @param {number} options.x - 地理坐标系下的 X 坐标值。
  12808. * @param {number} options.y - 地理坐标系下的 Y 坐标值。
  12809. * @extends {GeometryPoint}
  12810. * @usage
  12811. */
  12812. class PointWithMeasure extends Point {
  12813. constructor(options) {
  12814. super(options);
  12815. /**
  12816. * @member {number} PointWithMeasure.prototype.measure
  12817. * @description 度量值,即路由对象属性值 M。
  12818. */
  12819. this.measure = null;
  12820. if (options) {
  12821. Util_Util.extend(this, options);
  12822. }
  12823. this.CLASS_NAME = "SuperMap.PointWithMeasure";
  12824. }
  12825. /**
  12826. * @function PointWithMeasure.prototype.equals
  12827. * @description 判断两个路由点对象是否相等。如果两个路由点对象具有相同的坐标以及度量值,则认为是相等的。
  12828. * @param {PointWithMeasure} geom - 需要判断的路由点对象。
  12829. * @returns {boolean} 两个路由点对象是否相等(true 为相等,false 为不等)。
  12830. */
  12831. equals(geom) {
  12832. var equals = false;
  12833. if (geom != null) {
  12834. var isValueEquals = this.x === geom.x && this.y === geom.y && this.measure === geom.measure;
  12835. var isNaNValue = isNaN(this.x) && isNaN(this.y) && isNaN(this.measure);
  12836. var isNaNGeometry = isNaN(geom.x) && isNaN(geom.y) && isNaN(geom.measure);
  12837. equals = ( isValueEquals || ( isNaNValue && isNaNGeometry ));
  12838. }
  12839. return equals;
  12840. }
  12841. /**
  12842. * @function PointWithMeasure.prototype.toJson
  12843. * @description 转换为 JSON 对象。
  12844. * */
  12845. toJson() {
  12846. var result = "{";
  12847. if (this.measure != null && this.measure != undefined) {
  12848. result += "\"measure\":" + this.measure + ",";
  12849. }
  12850. result += "\"x\":" + this.x + ",";
  12851. result += "\"y\":" + this.y;
  12852. result += "}";
  12853. return result;
  12854. }
  12855. /**
  12856. * @function PointWithMeasure.prototype.destroy
  12857. * @description 释放资源,将引用资源的属性置空。
  12858. */
  12859. destroy() {
  12860. var me = this;
  12861. me.measure = null;
  12862. me.x = null;
  12863. me.y = null;
  12864. }
  12865. /**
  12866. * @function PointWithMeasure.fromJson
  12867. * @description 将 JSON 对象转换为{@link PointWithMeasure} 对象。
  12868. * @param {Object} jsonObject - JSON 对象表示的路由点。
  12869. * @returns {PointWithMeasure} 转化后的 PointWithMeasure 对象。
  12870. */
  12871. static fromJson(jsonObject) {
  12872. if (!jsonObject) {
  12873. return;
  12874. }
  12875. return new PointWithMeasure({
  12876. x: jsonObject.x,
  12877. y: jsonObject.y,
  12878. measure: jsonObject.measure
  12879. });
  12880. }
  12881. }
  12882. ;// CONCATENATED MODULE: ./src/common/iServer/Route.js
  12883. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  12884. * This program are made available under the terms of the Apache License, Version 2.0
  12885. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12886. /**
  12887. * @class Route
  12888. * @deprecatedclass SuperMap.Route
  12889. * @category iServer SpatialAnalyst RouteCalculateMeasure
  12890. * @classdesc 路由对象类。路由对象为一系列有序的带有属性值 M 的 x,y 坐标对,其中 M 值为该结点的距离属性(到已知点的距离)。
  12891. * @param {Array.<Geometry>} points - 形成路由对象的线数组。
  12892. * @param {Object} options - 参数。
  12893. * @param {number} options.id - 路由对象在数据库中的 ID。
  12894. * @param {number} options.length - 路由对象的长度。单位与数据集的单位相同。
  12895. * @param {number} [options.maxM] - 最大线性度量值,即所有结点到起始点的量算距离中最大值。
  12896. * @param {number} [options.minM] - 最小线性度量值,即所有结点到起始点的量算距离中最小值。
  12897. * @param {string} [options.type] - 数据类型,如:"LINEM"。
  12898. * @extends GeometryCollection
  12899. * @usage
  12900. */
  12901. class Route extends Collection {
  12902. constructor(points, options) {
  12903. super(points, options);
  12904. /**
  12905. * @member {number} Route.prototype.id
  12906. * @description 路由对象在数据库中的 ID。
  12907. */
  12908. this.id = null;
  12909. /**
  12910. * @member {number} Route.prototype.center
  12911. * @description 路由对象的中心点。
  12912. */
  12913. this.center = null;
  12914. /**
  12915. * @member {string} Route.prototype.style
  12916. * @description 路由对象的样式。
  12917. */
  12918. this.style = null;
  12919. /**
  12920. * @member {number} Route.prototype.length
  12921. * @description 路由对象的长度。单位与数据集的单位相同。
  12922. */
  12923. this.length = null;
  12924. /**
  12925. * @member {number} Route.prototype.maxM
  12926. * @description 最大线性度量值,即所有结点到起始点的量算距离中最大值。
  12927. */
  12928. this.maxM = null;
  12929. /**
  12930. * @member {number} Route.prototype.minM
  12931. * @description 最小线性度量值,即所有结点到起始点的量算距离中最小值。
  12932. */
  12933. this.minM = null;
  12934. /**
  12935. * @member {Array.<number>} Route.prototype.parts
  12936. * @description 服务端几何对象中各个子对象所包含的节点个数。
  12937. */
  12938. this.parts = null;
  12939. /**
  12940. * @member {Array.<Object>} Route.prototype.points
  12941. * @description 路由对象的所有路由点。
  12942. * @example
  12943. * (start code)
  12944. * [
  12945. * {
  12946. * "measure": 0,
  12947. * "y": -4377.027184298267,
  12948. * "x": 4020.0045221720466
  12949. * },
  12950. * {
  12951. * "measure": 37.33288381391519,
  12952. * "y": -4381.569363260499,
  12953. * "x": 4057.0600591960642
  12954. * }
  12955. * ]
  12956. * (end)
  12957. */
  12958. this.points = null;
  12959. /**
  12960. * @member {string} Route.prototype.type
  12961. * @description 服务端几何对象类型。
  12962. */
  12963. this.type = null;
  12964. /**
  12965. * @member {Array.<string>} [Route.prototype.componentTypes=LineString]
  12966. * @description components 存储的几何对象所支持的几何类型数组。
  12967. */
  12968. this.componentTypes = ["SuperMap.Geometry.LinearRing", "SuperMap.Geometry.LineString"];
  12969. if (options) {
  12970. Util_Util.extend(this, options);
  12971. }
  12972. this.CLASS_NAME = "SuperMap.Route";
  12973. this.geometryType = "LINEM";
  12974. }
  12975. /**
  12976. *
  12977. * @function Route.prototype.toJson
  12978. * @description 转换为 JSON 对象。
  12979. * @returns {Object} JSON 对象。
  12980. */
  12981. toJson() {
  12982. var result = "{";
  12983. if (this.id != null && this.id != undefined) {
  12984. result += "\"id\":" + this.id + ",";
  12985. }
  12986. if (this.center != null && this.center != undefined) {
  12987. result += "\"center\":" + this.center + ",";
  12988. }
  12989. if (this.style != null && this.style != undefined) {
  12990. result += "\"style\":" + this.style + ",";
  12991. }
  12992. if (this.length != null && this.length != undefined) {
  12993. result += "\"length\":" + this.length + ",";
  12994. }
  12995. if (this.maxM != null && this.maxM != undefined) {
  12996. result += "\"maxM\":" + this.maxM + ",";
  12997. }
  12998. if (this.minM != null && this.minM != undefined) {
  12999. result += "\"minM\":" + this.minM + ",";
  13000. }
  13001. if (this.type != null && this.type != undefined) {
  13002. result += "\"type\":\"" + this.type + "\",";
  13003. }
  13004. if (this.parts != null && this.parts != undefined) {
  13005. result += "\"parts\":[" + this.parts[0];
  13006. for (var i = 1; i < this.parts.length; i++) {
  13007. result += "," + this.parts[i];
  13008. }
  13009. result += "],";
  13010. }
  13011. if (this.components != null && this.components.length > 0) {
  13012. result += "\"points\":[";
  13013. for (var j = 0, len = this.components.length; j < len; j++) {
  13014. for (var k = 0, len2 = this.components[j].components.length; k < len2; k++) {
  13015. result += this.components[j].components[k].toJson() + ",";
  13016. }
  13017. }
  13018. result = result.replace(/,$/g, '');
  13019. result += "]";
  13020. }
  13021. result = result.replace(/,$/g, '');
  13022. result += "}";
  13023. return result;
  13024. }
  13025. /**
  13026. * @function Route.prototype.destroy
  13027. * @override
  13028. */
  13029. destroy() {
  13030. var me = this;
  13031. me.id = null;
  13032. me.center = null;
  13033. me.style = null;
  13034. me.length = null;
  13035. me.maxM = null;
  13036. me.minM = null;
  13037. me.type = null;
  13038. me.parts = null;
  13039. me.components.length = 0;
  13040. me.components = null;
  13041. me.componentTypes = null;
  13042. }
  13043. /**
  13044. * @function Route.fromJson
  13045. * @description 将 JSON 对象转换为 Route 对象。
  13046. * @param {Object} [jsonObject] - JSON 对象表示的路由对象。
  13047. * @returns {Route} 转化后的 Route 对象。
  13048. */
  13049. static fromJson(jsonObject) {
  13050. if (!jsonObject) {
  13051. return;
  13052. }
  13053. var geoParts = jsonObject.parts || [],
  13054. geoPoints = jsonObject.points || [],
  13055. len = geoParts.length,
  13056. lineList = [];
  13057. if (len > 0) {
  13058. for (var i = 0, pointIndex = 0, pointList = []; i < len; i++) {
  13059. for (var j = 0; j < geoParts[i]; j++) {
  13060. pointList.push(PointWithMeasure.fromJson(geoPoints[pointIndex + j]));
  13061. }
  13062. pointIndex += geoParts[i];
  13063. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  13064. if (pointList[0].equals(pointList[geoParts[i] - 1])) {
  13065. lineList.push(new LinearRing_LinearRing(pointList));
  13066. } else {
  13067. lineList.push(new LineString(pointList));
  13068. }
  13069. pointList = [];
  13070. }
  13071. } else {
  13072. return null;
  13073. }
  13074. return new Route(lineList, {
  13075. id: jsonObject.id,
  13076. center: jsonObject.center,
  13077. style: jsonObject.style,
  13078. length: jsonObject.length,
  13079. maxM: jsonObject.maxM,
  13080. minM: jsonObject.minM,
  13081. type: jsonObject.type,
  13082. parts: jsonObject.parts
  13083. });
  13084. }
  13085. }
  13086. ;// CONCATENATED MODULE: ./src/common/REST.js
  13087. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  13088. * This program are made available under the terms of the Apache License, Version 2.0
  13089. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13090. /**
  13091. * @enum DataFormat
  13092. * @description 服务请求返回结果数据类型
  13093. * @category BaseTypes Constant
  13094. * @type {string}
  13095. * @usage
  13096. * ```
  13097. * // 浏览器
  13098. * <script type="text/javascript" src="{cdn}"></script>
  13099. * <script>
  13100. * const result = {namespace}.DataFormat.GEOJSON;
  13101. *
  13102. * </script>
  13103. * // ES6 Import
  13104. * import { DataFormat } from '{npm}';
  13105. *
  13106. * const result = DataFormat.GEOJSON;
  13107. * ```
  13108. */
  13109. var DataFormat = {
  13110. /** GEOJSON */
  13111. GEOJSON: "GEOJSON",
  13112. /** ISERVER */
  13113. ISERVER: "ISERVER",
  13114. /** FGB */
  13115. FGB: "FGB"
  13116. };
  13117. /**
  13118. * @enum ServerType
  13119. * @description 服务器类型
  13120. * @category BaseTypes Constant
  13121. * @type {string}
  13122. * @usage
  13123. * ```
  13124. * // 浏览器
  13125. * <script type="text/javascript" src="{cdn}"></script>
  13126. * <script>
  13127. * const result = {namespace}.ServerType.ISERVER;
  13128. *
  13129. * </script>
  13130. * // ES6 Import
  13131. * import { ServerType } from '{npm}';
  13132. *
  13133. * const result = ServerType.ISERVER;
  13134. * ```
  13135. */
  13136. var ServerType = {
  13137. /** ISERVER */
  13138. ISERVER: "ISERVER",
  13139. /** IPORTAL */
  13140. IPORTAL: "IPORTAL",
  13141. /** ONLINE */
  13142. ONLINE: "ONLINE"
  13143. };
  13144. /**
  13145. * @enum GeometryType
  13146. * @description 几何对象枚举,定义了一系列几何对象类型。
  13147. * @category BaseTypes Constant
  13148. * @type {string}
  13149. * @usage
  13150. * ```
  13151. * // 浏览器
  13152. * <script type="text/javascript" src="{cdn}"></script>
  13153. * <script>
  13154. * const result = {namespace}.GeometryType.LINE;
  13155. *
  13156. * </script>
  13157. * // ES6 Import
  13158. * import { GeometryType } from '{npm}';
  13159. *
  13160. * const result = GeometryType.LINE;
  13161. * ```
  13162. */
  13163. var REST_GeometryType = {
  13164. /** 线几何对象类型。 */
  13165. LINE: "LINE",
  13166. /** 路由对象。 */
  13167. LINEM: "LINEM",
  13168. /** 点几何对象类型。 */
  13169. POINT: "POINT",
  13170. /** 面几何对象类型。 */
  13171. REGION: "REGION",
  13172. /** EPS点几何对象。 */
  13173. POINTEPS: "POINTEPS",
  13174. /** EPS线几何对象。 */
  13175. LINEEPS: "LINEEPS",
  13176. /** EPS面几何对象。 */
  13177. REGIONEPS: "REGIONEPS",
  13178. /** 椭圆。 */
  13179. ELLIPSE: "ELLIPSE",
  13180. /** 圆。 */
  13181. CIRCLE: "CIRCLE",
  13182. /** 文本几何对象类型。 */
  13183. TEXT: "TEXT",
  13184. /** 矩形。 */
  13185. RECTANGLE: "RECTANGLE",
  13186. /** 未定义。 */
  13187. UNKNOWN: "UNKNOWN",
  13188. /** 复合几何对象类型。 */
  13189. GEOCOMPOUND:"GEOCOMPOUND"
  13190. };
  13191. /**
  13192. * @enum QueryOption
  13193. * @description 查询结果类型枚举,描述查询结果返回类型,包括只返回属性、只返回几何实体以及返回属性和几何实体。
  13194. * @category BaseTypes Constant
  13195. * @type {string}
  13196. * @usage
  13197. * ```
  13198. * // 浏览器
  13199. * <script type="text/javascript" src="{cdn}"></script>
  13200. * <script>
  13201. * const result = {namespace}.QueryOption.ATTRIBUTE;
  13202. *
  13203. * </script>
  13204. * // ES6 Import
  13205. * import { QueryOption } from '{npm}';
  13206. *
  13207. * const result = QueryOption.ATTRIBUTE;
  13208. * ```
  13209. */
  13210. var QueryOption = {
  13211. /** 属性。 */
  13212. ATTRIBUTE: "ATTRIBUTE",
  13213. /** 属性和几何对象。 */
  13214. ATTRIBUTEANDGEOMETRY: "ATTRIBUTEANDGEOMETRY",
  13215. /** 几何对象。 */
  13216. GEOMETRY: "GEOMETRY"
  13217. };
  13218. /**
  13219. * @enum JoinType
  13220. * @description 关联查询时的关联类型常量。
  13221. * 该类定义了两个表之间的连接类型常量,决定了对两个表之间进行连接查询时,查询结果中得到的记录的情况。
  13222. * @category BaseTypes Constant
  13223. * @type {string}
  13224. * @usage
  13225. * ```
  13226. * // 浏览器
  13227. * <script type="text/javascript" src="{cdn}"></script>
  13228. * <script>
  13229. * const result = {namespace}.JoinType.INNERJOIN;
  13230. *
  13231. * </script>
  13232. * // ES6 Import
  13233. * import { JoinType } from '{npm}';
  13234. *
  13235. * const result = JoinType.INNERJOIN;
  13236. * ```
  13237. */
  13238. var JoinType = {
  13239. /** 内连接。 */
  13240. INNERJOIN: "INNERJOIN",
  13241. /** 左连接。 */
  13242. LEFTJOIN: "LEFTJOIN"
  13243. };
  13244. /**
  13245. * @enum SpatialQueryMode
  13246. * @description 空间查询模式枚举。该类定义了空间查询操作模式常量。
  13247. * @category BaseTypes Constant
  13248. * @type {string}
  13249. * @usage
  13250. * ```
  13251. * // 浏览器
  13252. * <script type="text/javascript" src="{cdn}"></script>
  13253. * <script>
  13254. * const result = {namespace}.SpatialQueryMode.CONTAIN;
  13255. *
  13256. * </script>
  13257. * // ES6 Import
  13258. * import { SpatialQueryMode } from '{npm}';
  13259. *
  13260. * const result = SpatialQueryMode.CONTAIN;
  13261. * ```
  13262. */
  13263. var SpatialQueryMode = {
  13264. /** 包含空间查询模式。 */
  13265. CONTAIN: "CONTAIN",
  13266. /** 交叉空间查询模式。 */
  13267. CROSS: "CROSS",
  13268. /** 分离空间查询模式。 */
  13269. DISJOINT: "DISJOINT",
  13270. /** 重合空间查询模式。 */
  13271. IDENTITY: "IDENTITY",
  13272. /** 相交空间查询模式。 */
  13273. INTERSECT: "INTERSECT",
  13274. /** 无空间查询。 */
  13275. NONE: "NONE",
  13276. /** 叠加空间查询模式。 */
  13277. OVERLAP: "OVERLAP",
  13278. /** 邻接空间查询模式。 */
  13279. TOUCH: "TOUCH",
  13280. /** 被包含空间查询模式。 */
  13281. WITHIN: "WITHIN"
  13282. };
  13283. /**
  13284. * @enum SpatialRelationType
  13285. * @description 数据集对象间的空间关系枚举。
  13286. * 该类定义了数据集对象间的空间关系类型常量。
  13287. * @category BaseTypes Constant
  13288. * @type {string}
  13289. * @usage
  13290. * ```
  13291. * // 浏览器
  13292. * <script type="text/javascript" src="{cdn}"></script>
  13293. * <script>
  13294. * const result = {namespace}.SpatialRelationType.CONTAIN;
  13295. *
  13296. * </script>
  13297. * // ES6 Import
  13298. * import { SpatialRelationType } from '{npm}';
  13299. *
  13300. * const result = {namespace}.SpatialRelationType.CONTAIN;
  13301. * ```
  13302. */
  13303. var SpatialRelationType = {
  13304. /** 包含关系。 */
  13305. CONTAIN: "CONTAIN",
  13306. /** 相交关系。 */
  13307. INTERSECT: "INTERSECT",
  13308. /** 被包含关系。 */
  13309. WITHIN: "WITHIN"
  13310. };
  13311. /**
  13312. * @enum MeasureMode
  13313. * @type {string}
  13314. * @description 量算模式枚举。
  13315. * @category BaseTypes Constant
  13316. * 该类定义了两种测量模式:距离测量和面积测量。
  13317. * @usage
  13318. * ```
  13319. * // 浏览器
  13320. * <script type="text/javascript" src="{cdn}"></script>
  13321. * <script>
  13322. * const result = {namespace}.MeasureMode.DISTANCE;
  13323. *
  13324. * </script>
  13325. * // ES6 Import
  13326. * import { MeasureMode } from '{npm}';
  13327. *
  13328. * const result = MeasureMode.DISTANCE;
  13329. * ```
  13330. */
  13331. var MeasureMode = {
  13332. /** 距离测量。 */
  13333. DISTANCE: "DISTANCE",
  13334. /** 面积测量。 */
  13335. AREA: "AREA"
  13336. };
  13337. /**
  13338. * @enum Unit
  13339. * @description 距离单位枚举。
  13340. * 该类定义了一系列距离单位类型。
  13341. * @category BaseTypes Constant
  13342. * @type {string}
  13343. * @usage
  13344. * ```
  13345. * // 浏览器
  13346. * <script type="text/javascript" src="{cdn}"></script>
  13347. * <script>
  13348. * const result = {namespace}.Unit.METER;
  13349. *
  13350. * </script>
  13351. * // ES6 Import
  13352. * import { Unit } from '{npm}';
  13353. *
  13354. * const result = Unit.METER;
  13355. * ```
  13356. */
  13357. var Unit = {
  13358. /** 米。 */
  13359. METER: "METER",
  13360. /** 千米。 */
  13361. KILOMETER: "KILOMETER",
  13362. /** 英里。 */
  13363. MILE: "MILE",
  13364. /** 码。 */
  13365. YARD: "YARD",
  13366. /** 度。 */
  13367. DEGREE: "DEGREE",
  13368. /** 毫米。 */
  13369. MILLIMETER: "MILLIMETER",
  13370. /** 厘米。 */
  13371. CENTIMETER: "CENTIMETER",
  13372. /** 英寸。 */
  13373. INCH: "INCH",
  13374. /** 分米。 */
  13375. DECIMETER: "DECIMETER",
  13376. /** 英尺。 */
  13377. FOOT: "FOOT",
  13378. /** 秒。 */
  13379. SECOND: "SECOND",
  13380. /** 分。 */
  13381. MINUTE: "MINUTE",
  13382. /** 弧度。 */
  13383. RADIAN: "RADIAN"
  13384. };
  13385. /**
  13386. * @enum BufferRadiusUnit
  13387. * @description 缓冲区距离单位枚举。该类定义了一系列缓冲距离单位类型。
  13388. * @category BaseTypes Constant
  13389. * @type {string}
  13390. * @usage
  13391. * ```
  13392. * // 浏览器
  13393. * <script type="text/javascript" src="{cdn}"></script>
  13394. * <script>
  13395. * const result = {namespace}.BufferRadiusUnit.CENTIMETER;
  13396. *
  13397. * </script>
  13398. * // ES6 Import
  13399. * import { BufferRadiusUnit } from '{npm}';
  13400. *
  13401. * const result = BufferRadiusUnit.CENTIMETER;
  13402. * ```
  13403. */
  13404. var BufferRadiusUnit = {
  13405. /** 厘米。 */
  13406. CENTIMETER: "CENTIMETER",
  13407. /** 分米。 */
  13408. DECIMETER: "DECIMETER",
  13409. /** 英尺。 */
  13410. FOOT: "FOOT",
  13411. /** 英寸。 */
  13412. INCH: "INCH",
  13413. /** 千米。 */
  13414. KILOMETER: "KILOMETER",
  13415. /** 米。 */
  13416. METER: "METER",
  13417. /** 英里。 */
  13418. MILE: "MILE",
  13419. /** 毫米。 */
  13420. MILLIMETER: "MILLIMETER",
  13421. /** 码。 */
  13422. YARD: "YARD"
  13423. }
  13424. /**
  13425. * @enum EngineType
  13426. * @description 数据源引擎类型枚举。
  13427. * @category BaseTypes Constant
  13428. * @type {string}
  13429. * @usage
  13430. * ```
  13431. * // 浏览器
  13432. * <script type="text/javascript" src="{cdn}"></script>
  13433. * <script>
  13434. * const result = {namespace}.EngineType.IMAGEPLUGINS;
  13435. *
  13436. * </script>
  13437. * // ES6 Import
  13438. * import { EngineType } from '{npm}';
  13439. *
  13440. * const result = EngineType.IMAGEPLUGINS;
  13441. * ```
  13442. */
  13443. var EngineType = {
  13444. /** 影像只读引擎类型,文件引擎,针对通用影像格式如 BMP,JPG,TIFF 以及超图自定义影像格式 SIT 等。 */
  13445. IMAGEPLUGINS: "IMAGEPLUGINS",
  13446. /** OGC 引擎类型,针对于 Web 数据源,Web 引擎,目前支持的类型有 WMS,WFS,WCS。 */
  13447. OGC: "OGC",
  13448. /** Oracle 引擎类型,针对 Oracle 数据源,数据库引擎。 */
  13449. ORACLEPLUS: "ORACLEPLUS",
  13450. /** SDB 引擎类型,文件引擎,即 SDB 数据源。 */
  13451. SDBPLUS: "SDBPLUS",
  13452. /** SQL Server 引擎类型,针对 SQL Server 数据源,数据库引擎。 */
  13453. SQLPLUS: "SQLPLUS",
  13454. /** UDB 引擎类型,文件引擎。 */
  13455. UDB: "UDB"
  13456. };
  13457. /**
  13458. * @enum ThemeGraphTextFormat
  13459. * @description 统计专题图文本显示格式枚举。
  13460. * @category BaseTypes Constant
  13461. * @type {string}
  13462. * @usage
  13463. * ```
  13464. * // 浏览器
  13465. * <script type="text/javascript" src="{cdn}"></script>
  13466. * <script>
  13467. * const result = {namespace}.ThemeGraphTextFormat.CAPTION;
  13468. *
  13469. * </script>
  13470. * // ES6 Import
  13471. * import { ThemeGraphTextFormat } from '{npm}';
  13472. *
  13473. * const result = ThemeGraphTextFormat.CAPTION;
  13474. * ```
  13475. */
  13476. var ThemeGraphTextFormat = {
  13477. /** 标题。以各子项的标题来进行标注。 */
  13478. CAPTION: "CAPTION",
  13479. /** 标题 + 百分数。以各子项的标题和所占的百分比来进行标注。 */
  13480. CAPTION_PERCENT: "CAPTION_PERCENT",
  13481. /** 标题 + 实际数值。以各子项的标题和真实数值来进行标注。 */
  13482. CAPTION_VALUE: "CAPTION_VALUE",
  13483. /** 百分数。以各子项所占的百分比来进行标注。 */
  13484. PERCENT: "PERCENT",
  13485. /** 实际数值。以各子项的真实数值来进行标注。 */
  13486. VALUE: "VALUE"
  13487. };
  13488. /**
  13489. * @enum ThemeGraphType
  13490. * @description 统计专题图类型枚举。
  13491. * @category BaseTypes Constant
  13492. * @type {string}
  13493. * @usage
  13494. * ```
  13495. * // 浏览器
  13496. * <script type="text/javascript" src="{cdn}"></script>
  13497. * <script>
  13498. * const result = {namespace}.ThemeGraphType.AREA;
  13499. *
  13500. * </script>
  13501. * // ES6 Import
  13502. * import { ThemeGraphType } from '{npm}';
  13503. *
  13504. * const result = ThemeGraphType.AREA;
  13505. * ```
  13506. */
  13507. var ThemeGraphType = {
  13508. /** 面积图。 */
  13509. AREA: "AREA",
  13510. /** 柱状图。 */
  13511. BAR: "BAR",
  13512. /** 三维柱状图。 */
  13513. BAR3D: "BAR3D",
  13514. /** 折线图。 */
  13515. LINE: "LINE",
  13516. /** 饼图。 */
  13517. PIE: "PIE",
  13518. /** 三维饼图。 */
  13519. PIE3D: "PIE3D",
  13520. /** 点状图。 */
  13521. POINT: "POINT",
  13522. /** 环状图。 */
  13523. RING: "RING",
  13524. /** 玫瑰图。 */
  13525. ROSE: "ROSE",
  13526. /** 三维玫瑰图。 */
  13527. ROSE3D: "ROSE3D",
  13528. /** 堆叠柱状图。 */
  13529. STACK_BAR: "STACK_BAR",
  13530. /** 三维堆叠柱状图。 */
  13531. STACK_BAR3D: "STACK_BAR3D",
  13532. /** 阶梯图。 */
  13533. STEP: "STEP"
  13534. };
  13535. /**
  13536. * @enum GraphAxesTextDisplayMode
  13537. * @description 统计专题图坐标轴文本显示模式。
  13538. * @category BaseTypes Constant
  13539. * @type {string}
  13540. * @usage
  13541. * ```
  13542. * // 浏览器
  13543. * <script type="text/javascript" src="{cdn}"></script>
  13544. * <script>
  13545. * const result = {namespace}.GraphAxesTextDisplayMode.ALL;
  13546. *
  13547. * </script>
  13548. * // ES6 Import
  13549. * import { GraphAxesTextDisplayMode } from '{npm}';
  13550. *
  13551. * const result = GraphAxesTextDisplayMode.ALL;
  13552. * ```
  13553. */
  13554. var GraphAxesTextDisplayMode = {
  13555. /** 显示全部文本。 */
  13556. ALL: "ALL",
  13557. /** 不显示。 */
  13558. NONE: "NONE",
  13559. /** 显示Y轴的文本。 */
  13560. YAXES: "YAXES"
  13561. };
  13562. /**
  13563. * @enum GraduatedMode
  13564. * @description 专题图分级模式枚举。
  13565. * @category BaseTypes Constant
  13566. * @type {string}
  13567. * @usage
  13568. * ```
  13569. * // 浏览器
  13570. * <script type="text/javascript" src="{cdn}"></script>
  13571. * <script>
  13572. * const result = {namespace}.GraduatedMode.CONSTANT;
  13573. *
  13574. * </script>
  13575. * // ES6 Import
  13576. * import { GraduatedMode } from '{npm}';
  13577. *
  13578. * const result = GraduatedMode.CONSTANT;
  13579. * ```
  13580. */
  13581. var GraduatedMode = {
  13582. /** 常量分级模式。 */
  13583. CONSTANT: "CONSTANT",
  13584. /** 对数分级模式。 */
  13585. LOGARITHM: "LOGARITHM",
  13586. /** 平方根分级模式。 */
  13587. SQUAREROOT: "SQUAREROOT"
  13588. };
  13589. /**
  13590. * @enum RangeMode
  13591. * @description 范围分段专题图分段方式枚举。
  13592. * @category BaseTypes Constant
  13593. * @type {string}
  13594. * @usage
  13595. * ```
  13596. * // 浏览器
  13597. * <script type="text/javascript" src="{cdn}"></script>
  13598. * <script>
  13599. * const result = {namespace}.RangeMode.CUSTOMINTERVAL;
  13600. *
  13601. * </script>
  13602. * // ES6 Import
  13603. * import { RangeMode } from '{npm}';
  13604. *
  13605. * const result = RangeMode.CUSTOMINTERVAL;
  13606. * ```
  13607. */
  13608. var RangeMode = {
  13609. /** 自定义分段法。 */
  13610. CUSTOMINTERVAL: "CUSTOMINTERVAL",
  13611. /** 等距离分段法。 */
  13612. EQUALINTERVAL: "EQUALINTERVAL",
  13613. /** 对数分段法。 */
  13614. LOGARITHM: "LOGARITHM",
  13615. /** 等计数分段法。 */
  13616. QUANTILE: "QUANTILE",
  13617. /** 平方根分段法。 */
  13618. SQUAREROOT: "SQUAREROOT",
  13619. /** 标准差分段法。 */
  13620. STDDEVIATION: "STDDEVIATION"
  13621. };
  13622. /**
  13623. * @enum ThemeType
  13624. * @description 专题图类型枚举。
  13625. * @category BaseTypes Constant
  13626. * @type {string}
  13627. * @usage
  13628. * ```
  13629. * // 浏览器
  13630. * <script type="text/javascript" src="{cdn}"></script>
  13631. * <script>
  13632. * const result = {namespace}.ThemeType.DOTDENSITY;
  13633. *
  13634. * </script>
  13635. * // ES6 Import
  13636. * import { ThemeType } from '{npm}';
  13637. *
  13638. * const result = ThemeType.DOTDENSITY;
  13639. * ```
  13640. */
  13641. var ThemeType = {
  13642. /** 点密度专题图。 */
  13643. DOTDENSITY: "DOTDENSITY",
  13644. /** 等级符号专题图。 */
  13645. GRADUATEDSYMBOL: "GRADUATEDSYMBOL",
  13646. /** 统计专题图。 */
  13647. GRAPH: "GRAPH",
  13648. /** 标签专题图。 */
  13649. LABEL: "LABEL",
  13650. /** 分段专题图。 */
  13651. RANGE: "RANGE",
  13652. /** 単值专题图。 */
  13653. UNIQUE: "UNIQUE"
  13654. };
  13655. /**
  13656. * @enum ColorGradientType
  13657. * @description 渐变颜色枚举。
  13658. * @category BaseTypes Constant
  13659. * @type {string}
  13660. * @usage
  13661. * ```
  13662. * // 浏览器
  13663. * <script type="text/javascript" src="{cdn}"></script>
  13664. * <script>
  13665. * const result = {namespace}.ColorGradientType.BLACK_WHITE;
  13666. *
  13667. * </script>
  13668. * // ES6 Import
  13669. * import { ColorGradientType } from '{npm}';
  13670. *
  13671. * const result = ColorGradientType.BLACK_WHITE;
  13672. * ```
  13673. */
  13674. var ColorGradientType = {
  13675. /** 黑白渐变色。 */
  13676. BLACK_WHITE: "BLACKWHITE",
  13677. /** 蓝黑渐变色。 */
  13678. BLUE_BLACK: "BLUEBLACK",
  13679. /** 蓝红渐变色。 */
  13680. BLUE_RED: "BLUERED",
  13681. /** 蓝白渐变色。 */
  13682. BLUE_WHITE: "BLUEWHITE",
  13683. /** 青黑渐变色。 */
  13684. CYAN_BLACK: "CYANBLACK",
  13685. /** 青蓝渐变色。 */
  13686. CYAN_BLUE: "CYANBLUE",
  13687. /** 青绿渐变色。 */
  13688. CYAN_GREEN: "CYANGREEN",
  13689. /** 青白渐变色。 */
  13690. CYAN_WHITE: "CYANWHITE",
  13691. /** 绿黑渐变色。 */
  13692. GREEN_BLACK: "GREENBLACK",
  13693. /** 绿蓝渐变色。 */
  13694. GREEN_BLUE: "GREENBLUE",
  13695. /** 绿橙紫渐变色。 */
  13696. GREEN_ORANGE_VIOLET: "GREENORANGEVIOLET",
  13697. /** 绿红渐变色。 */
  13698. GREEN_RED: "GREENRED",
  13699. /** 蓝红渐变色。 */
  13700. GREEN_WHITE: "GREENWHITE",
  13701. /** 粉黑渐变色。 */
  13702. PINK_BLACK: "PINKBLACK",
  13703. /** 粉蓝渐变色。 */
  13704. PINK_BLUE: "PINKBLUE",
  13705. /** 粉红渐变色。 */
  13706. PINK_RED: "PINKRED",
  13707. /** 粉白渐变色。 */
  13708. PINK_WHITE: "PINKWHITE",
  13709. /** 彩虹色。 */
  13710. RAIN_BOW: "RAINBOW",
  13711. /** 红黑渐变色。 */
  13712. RED_BLACK: "REDBLACK",
  13713. /** 红白渐变色。 */
  13714. RED_WHITE: "REDWHITE",
  13715. /** 光谱渐变。 */
  13716. SPECTRUM: "SPECTRUM",
  13717. /** 地形渐变,用于三维显示效果较好。 */
  13718. TERRAIN: "TERRAIN",
  13719. /** 黄黑渐变色。 */
  13720. YELLOW_BLACK: "YELLOWBLACK",
  13721. /** 黄蓝渐变色。 */
  13722. YELLOW_BLUE: "YELLOWBLUE",
  13723. /** 黄绿渐变色。 */
  13724. YELLOW_GREEN: "YELLOWGREEN",
  13725. /** 黄红渐变色。 */
  13726. YELLOW_RED: "YELLOWRED",
  13727. /** 黄白渐变色。 */
  13728. YELLOW_WHITE: "YELLOWWHITE"
  13729. };
  13730. /**
  13731. * @enum TextAlignment
  13732. * @description 文本对齐枚举。
  13733. * @category BaseTypes Constant
  13734. * @type {string}
  13735. * @usage
  13736. * ```
  13737. * // 浏览器
  13738. * <script type="text/javascript" src="{cdn}"></script>
  13739. * <script>
  13740. * const result = {namespace}.TextAlignment.TOPLEFT;
  13741. *
  13742. * </script>
  13743. * // ES6 Import
  13744. * import { TextAlignment } from '{npm}';
  13745. *
  13746. * const result = TextAlignment.TOPLEFT;
  13747. * ```
  13748. */
  13749. var TextAlignment = {
  13750. /** 左上角对齐。 */
  13751. TOPLEFT: "TOPLEFT",
  13752. /** 顶部居中对齐。 */
  13753. TOPCENTER: "TOPCENTER",
  13754. /** 右上角对齐。 */
  13755. TOPRIGHT: "TOPRIGHT",
  13756. /** 基准线左对齐。 */
  13757. BASELINELEFT: "BASELINELEFT",
  13758. /** 基准线居中对齐。 */
  13759. BASELINECENTER: "BASELINECENTER",
  13760. /** 基准线右对齐。 */
  13761. BASELINERIGHT: "BASELINERIGHT",
  13762. /** 左下角对齐。 */
  13763. BOTTOMLEFT: "BOTTOMLEFT",
  13764. /** 底部居中对齐。 */
  13765. BOTTOMCENTER: "BOTTOMCENTER",
  13766. /** 右下角对齐。 */
  13767. BOTTOMRIGHT: "BOTTOMRIGHT",
  13768. /** 左中对齐。 */
  13769. MIDDLELEFT: "MIDDLELEFT",
  13770. /** 中心对齐。 */
  13771. MIDDLECENTER: "MIDDLECENTER",
  13772. /** 右中对齐。 */
  13773. MIDDLERIGHT: "MIDDLERIGHT"
  13774. };
  13775. /**
  13776. * @enum FillGradientMode
  13777. * @description 渐变填充风格的渐变类型枚举。
  13778. * @category BaseTypes Constant
  13779. * @type {string}
  13780. * @usage
  13781. * ```
  13782. * // 浏览器
  13783. * <script type="text/javascript" src="{cdn}"></script>
  13784. * <script>
  13785. * const result = {namespace}.FillGradientMode.NONE;
  13786. *
  13787. * </script>
  13788. * // ES6 Import
  13789. * import { FillGradientMode } from '{npm}';
  13790. *
  13791. * const result = FillGradientMode.NONE;
  13792. * ```
  13793. */
  13794. var FillGradientMode = {
  13795. /** 无渐变。 */
  13796. NONE: "NONE",
  13797. /** 线性渐变填充。 */
  13798. LINEAR: "LINEAR",
  13799. /** 辐射渐变填充。 */
  13800. RADIAL: "RADIAL",
  13801. /** 圆锥渐变填充。 */
  13802. CONICAL: "CONICAL",
  13803. /** 四角渐变填充。 */
  13804. SQUARE: "SQUARE"
  13805. };
  13806. /**
  13807. * @enum AlongLineDirection
  13808. * @description 标签沿线标注方向枚举。
  13809. * @category BaseTypes Constant
  13810. * @type {string}
  13811. * @usage
  13812. * ```
  13813. * // 浏览器
  13814. * <script type="text/javascript" src="{cdn}"></script>
  13815. * <script>
  13816. * const result = {namespace}.AlongLineDirection.NORMAL;
  13817. *
  13818. * </script>
  13819. * // ES6 Import
  13820. * import { AlongLineDirection } from '{npm}';
  13821. *
  13822. * const result = AlongLineDirection.NORMAL;
  13823. * ```
  13824. */
  13825. var AlongLineDirection = {
  13826. /** 沿线的法线方向放置标签。 */
  13827. NORMAL: "ALONG_LINE_NORMAL",
  13828. /** 从下到上,从左到右放置。 */
  13829. LB_TO_RT: "LEFT_BOTTOM_TO_RIGHT_TOP",
  13830. /** 从上到下,从左到右放置。 */
  13831. LT_TO_RB: "LEFT_TOP_TO_RIGHT_BOTTOM",
  13832. /** 从下到上,从右到左放置。 */
  13833. RB_TO_LT: "RIGHT_BOTTOM_TO_LEFT_TOP",
  13834. /** 从上到下,从右到左放置。 */
  13835. RT_TO_LB: "RIGHT_TOP_TO_LEFT_BOTTOM"
  13836. };
  13837. /**
  13838. * @enum LabelBackShape
  13839. * @description 标签专题图中标签背景的形状枚举。
  13840. * @category BaseTypes Constant
  13841. * @type {string}
  13842. * @usage
  13843. * ```
  13844. * // 浏览器
  13845. * <script type="text/javascript" src="{cdn}"></script>
  13846. * <script>
  13847. * const result = {namespace}.LabelBackShape.DIAMOND;
  13848. *
  13849. * </script>
  13850. * // ES6 Import
  13851. * import { LabelBackShape } from '{npm}';
  13852. *
  13853. * const result = LabelBackShape.DIAMOND;
  13854. * ```
  13855. */
  13856. var LabelBackShape = {
  13857. /** 菱形背景,即标签背景的形状为菱形。 */
  13858. DIAMOND: "DIAMOND",
  13859. /** 椭圆形背景,即标签背景的行状为椭圆形。 */
  13860. ELLIPSE: "ELLIPSE",
  13861. /** 符号背景,即标签背景的形状为设定的符号。 */
  13862. MARKER: "MARKER",
  13863. /** 空背景,即不使用任何形状作为标签的背景。 */
  13864. NONE: "NONE",
  13865. /** 矩形背景,即标签背景的形状为矩形。 */
  13866. RECT: "RECT",
  13867. /** 圆角矩形背景,即标签背景的形状为圆角矩形。 */
  13868. ROUNDRECT: "ROUNDRECT",
  13869. /** 三角形背景,即标签背景的形状为三角形。 */
  13870. TRIANGLE: "TRIANGLE"
  13871. };
  13872. /**
  13873. * @enum LabelOverLengthMode
  13874. * @description 标签专题图中超长标签的处理模式枚举。
  13875. * @category BaseTypes Constant
  13876. * @type {string}
  13877. * @usage
  13878. * ```
  13879. * // 浏览器
  13880. * <script type="text/javascript" src="{cdn}"></script>
  13881. * <script>
  13882. * const result = {namespace}.LabelOverLengthMode.NEWLINE;
  13883. *
  13884. * </script>
  13885. * // ES6 Import
  13886. * import { LabelOverLengthMode } from '{npm}';
  13887. *
  13888. * const result = LabelOverLengthMode.NEWLINE;
  13889. * ```
  13890. */
  13891. var LabelOverLengthMode = {
  13892. /** 换行显示。 */
  13893. NEWLINE: "NEWLINE",
  13894. /** 对超长标签不进行处理。 */
  13895. NONE: "NONE",
  13896. /** 省略超出部分。 */
  13897. OMIT: "OMIT"
  13898. };
  13899. /**
  13900. * @enum DirectionType
  13901. * @description 网络分析中方向枚举。
  13902. * 在行驶引导子项中使用。
  13903. * @category BaseTypes Constant
  13904. * @type {string}
  13905. * @usage
  13906. * ```
  13907. * // 浏览器
  13908. * <script type="text/javascript" src="{cdn}"></script>
  13909. * <script>
  13910. * const result = {namespace}.DirectionType.EAST;
  13911. *
  13912. * </script>
  13913. * // ES6 Import
  13914. * import { DirectionType } from '{npm}';
  13915. *
  13916. * const result = DirectionType.EAST;
  13917. * ```
  13918. */
  13919. var DirectionType = {
  13920. /** 东。 */
  13921. EAST: "EAST",
  13922. /** 无方向。 */
  13923. NONE: "NONE",
  13924. /** 北。 */
  13925. NORTH: "NORTH",
  13926. /** 南。 */
  13927. SOURTH: "SOURTH",
  13928. /** 西。 */
  13929. WEST: "WEST"
  13930. };
  13931. /**
  13932. * @enum SideType
  13933. * @description 行驶位置枚举。
  13934. * 表示在行驶在路的左边、右边或者路上的枚举,该类用在行驶导引子项类中。
  13935. * @category BaseTypes Constant
  13936. * @type {string}
  13937. * @usage
  13938. * ```
  13939. * // 浏览器
  13940. * <script type="text/javascript" src="{cdn}"></script>
  13941. * <script>
  13942. * const result = {namespace}.SideType.LEFT;
  13943. *
  13944. * </script>
  13945. * // ES6 Import
  13946. * import { SideType } from '{npm}';
  13947. *
  13948. * const result = SideType.LEFT;
  13949. * ```
  13950. */
  13951. var SideType = {
  13952. /** 路的左侧。 */
  13953. LEFT: "LEFT",
  13954. /** 在路上(即路的中间)。 */
  13955. MIDDLE: "MIDDLE",
  13956. /** 无效值。 */
  13957. NONE: "NONE",
  13958. /** 路的右侧。 */
  13959. RIGHT: "RIGHT"
  13960. };
  13961. /**
  13962. * @enum SupplyCenterType
  13963. * @description 资源供给中心类型枚举。
  13964. * 该枚举定义了网络分析中资源中心点的类型,主要用于资源分配和选址分区。
  13965. * 资源供给中心点的类型包括非中心,固定中心和可选中心。固定中心用于资源分配分析;固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  13966. * @category BaseTypes Constant
  13967. * @type {string}
  13968. * @usage
  13969. * ```
  13970. * // 浏览器
  13971. * <script type="text/javascript" src="{cdn}"></script>
  13972. * <script>
  13973. * const result = {namespace}.SupplyCenterType.FIXEDCENTER;
  13974. *
  13975. * </script>
  13976. * // ES6 Import
  13977. * import { SupplyCenterType } from '{npm}';
  13978. *
  13979. * const result = SupplyCenterType.FIXEDCENTER;
  13980. * ```
  13981. */
  13982. var SupplyCenterType = {
  13983. /** 固定中心点。 */
  13984. FIXEDCENTER: "FIXEDCENTER",
  13985. /** 非中心点。 */
  13986. NULL: "NULL",
  13987. /** 可选中心点。 */
  13988. OPTIONALCENTER: "OPTIONALCENTER"
  13989. };
  13990. /**
  13991. * @enum TurnType
  13992. * @description 转弯方向枚举。
  13993. * 用在行驶引导子项类中,表示转弯的方向。
  13994. * @category BaseTypes Constant
  13995. * @type {string}
  13996. * @usage
  13997. * ```
  13998. * // 浏览器
  13999. * <script type="text/javascript" src="{cdn}"></script>
  14000. * <script>
  14001. * const result = {namespace}.TurnType.AHEAD;
  14002. *
  14003. * </script>
  14004. * // ES6 Import
  14005. * import { TurnType } from '{npm}';
  14006. *
  14007. * const result = TurnType.AHEAD;
  14008. * ```
  14009. */
  14010. var TurnType = {
  14011. /** 向前直行。 */
  14012. AHEAD: "AHEAD",
  14013. /** 掉头。 */
  14014. BACK: "BACK",
  14015. /** 终点,不拐弯。 */
  14016. END: "END",
  14017. /** 左转弯。 */
  14018. LEFT: "LEFT",
  14019. /** 无效值。 */
  14020. NONE: "NONE",
  14021. /** 右转弯。 */
  14022. RIGHT: "RIGHT"
  14023. };
  14024. /**
  14025. * @enum BufferEndType
  14026. * @description 缓冲区分析BufferEnd类型。
  14027. * @category BaseTypes Constant
  14028. * @type {string}
  14029. * @usage
  14030. * ```
  14031. * // 浏览器
  14032. * <script type="text/javascript" src="{cdn}"></script>
  14033. * <script>
  14034. * const result = {namespace}.BufferEndType.FLAT;
  14035. *
  14036. * </script>
  14037. * // ES6 Import
  14038. * import { BufferEndType } from '{npm}';
  14039. *
  14040. * const result = BufferEndType.FLAT;
  14041. * ```
  14042. */
  14043. var BufferEndType = {
  14044. /** 平头缓冲。 */
  14045. FLAT: "FLAT",
  14046. /** 圆头缓冲。 */
  14047. ROUND: "ROUND"
  14048. };
  14049. /**
  14050. * @enum OverlayOperationType
  14051. * @description 叠加分析类型枚举。
  14052. * @category BaseTypes Constant
  14053. * @type {string}
  14054. * @usage
  14055. * ```
  14056. * // 浏览器
  14057. * <script type="text/javascript" src="{cdn}"></script>
  14058. * <script>
  14059. * const result = {namespace}.OverlayOperationType.CLIP;
  14060. *
  14061. * </script>
  14062. * // ES6 Import
  14063. * import { OverlayOperationType } from '{npm}';
  14064. *
  14065. * const result = OverlayOperationType.CLIP;
  14066. * ```
  14067. */
  14068. var OverlayOperationType = {
  14069. /** 操作数据集(几何对象)裁剪被操作数据集(几何对象)。 */
  14070. CLIP: "CLIP",
  14071. /** 在被操作数据集(几何对象)上擦除掉与操作数据集(几何对象)相重合的部分。 */
  14072. ERASE: "ERASE",
  14073. /**对被操作数据集(几何对象)进行同一操作,即操作执行后,被操作数据集(几何对象)包含来自操作数据集(几何对象)的几何形状。 */
  14074. IDENTITY: "IDENTITY",
  14075. /** 对两个数据集(几何对象)求交,返回两个数据集(几何对象)的交集。 */
  14076. INTERSECT: "INTERSECT",
  14077. /** 对两个面数据集(几何对象)进行合并操作。 */
  14078. UNION: "UNION",
  14079. /** 对两个面数据集(几何对象)进行更新操作。 */
  14080. UPDATE: "UPDATE",
  14081. /** 对两个面数据集(几何对象)进行对称差操作。 */
  14082. XOR: "XOR"
  14083. };
  14084. /**
  14085. * @enum OutputType
  14086. * @description 分布式分析输出类型枚举。
  14087. * @category BaseTypes Constant
  14088. * @type {string}
  14089. * @usage
  14090. * ```
  14091. * // 浏览器
  14092. * <script type="text/javascript" src="{cdn}"></script>
  14093. * <script>
  14094. * const result = {namespace}.OutputType.INDEXEDHDFS;
  14095. *
  14096. * </script>
  14097. * // ES6 Import
  14098. * import { OutputType } from '{npm}';
  14099. *
  14100. * const result = OutputType.INDEXEDHDFS;
  14101. * ```
  14102. */
  14103. var OutputType = {
  14104. /** INDEXEDHDFS */
  14105. INDEXEDHDFS: "INDEXEDHDFS",
  14106. /** UDB */
  14107. UDB: "UDB",
  14108. /** MONGODB */
  14109. MONGODB: "MONGODB",
  14110. /** PG */
  14111. PG: "PG"
  14112. };
  14113. /**
  14114. * @enum SmoothMethod
  14115. * @description 光滑方法枚举。
  14116. * 用于从Grid 或DEM数据生成等值线或等值面时对等值线或者等值面的边界线进行平滑处理的方法。
  14117. * @category BaseTypes Constant
  14118. * @type {string}
  14119. * @usage
  14120. * ```
  14121. * // 浏览器
  14122. * <script type="text/javascript" src="{cdn}"></script>
  14123. * <script>
  14124. * const result = {namespace}.SmoothMethod.BSPLINE;
  14125. *
  14126. * </script>
  14127. * // ES6 Import
  14128. * import { SmoothMethod } from '{npm}';
  14129. *
  14130. * const result = SmoothMethod.BSPLINE;
  14131. * ```
  14132. */
  14133. var SmoothMethod = {
  14134. /** B 样条法。 */
  14135. BSPLINE: "BSPLINE",
  14136. /** 磨角法。 */
  14137. POLISH: "POLISH"
  14138. };
  14139. /**
  14140. * @enum SurfaceAnalystMethod
  14141. * @description 表面分析方法枚举。
  14142. * 通过对数据进行表面分析,能够挖掘原始数据所包含的信息,使某些细节明显化,易于分析。
  14143. * @category BaseTypes Constant
  14144. * @type {string}
  14145. * @usage
  14146. * ```
  14147. * // 浏览器
  14148. * <script type="text/javascript" src="{cdn}"></script>
  14149. * <script>
  14150. * const result = {namespace}.SurfaceAnalystMethod.ISOLINE;
  14151. *
  14152. * </script>
  14153. * // ES6 Import
  14154. * import { SurfaceAnalystMethod } from '{npm}';
  14155. *
  14156. * const result = SurfaceAnalystMethod.ISOLINE;
  14157. * ```
  14158. */
  14159. var SurfaceAnalystMethod = {
  14160. /** 等值线提取。 */
  14161. ISOLINE: "ISOLINE",
  14162. /** 等值面提取。 */
  14163. ISOREGION: "ISOREGION"
  14164. };
  14165. /**
  14166. * @enum DataReturnMode
  14167. * @description 数据返回模式枚举。
  14168. * 该枚举用于指定空间分析返回结果模式,包含返回数据集标识和记录集、只返回数据集标识(数据集名称@数据源名称)及只返回记录集三种模式。
  14169. * @category BaseTypes Constant
  14170. * @type {string}
  14171. * @usage
  14172. * ```
  14173. * // 浏览器
  14174. * <script type="text/javascript" src="{cdn}"></script>
  14175. * <script>
  14176. * const result = {namespace}.DataReturnMode.DATASET_AND_RECORDSET;
  14177. *
  14178. * </script>
  14179. * // ES6 Import
  14180. * import { DataReturnMode } from '{npm}';
  14181. *
  14182. * const result = DataReturnMode.DATASET_AND_RECORDSET;
  14183. * ```
  14184. */
  14185. var DataReturnMode = {
  14186. /** 返回结果数据集标识(数据集名称@数据源名称)和记录集(RecordSet)。 */
  14187. DATASET_AND_RECORDSET: "DATASET_AND_RECORDSET",
  14188. /** 只返回数据集标识(数据集名称@数据源名称)。 */
  14189. DATASET_ONLY: "DATASET_ONLY",
  14190. /** 只返回记录集(RecordSet)。 */
  14191. RECORDSET_ONLY: "RECORDSET_ONLY"
  14192. };
  14193. /**
  14194. * @enum EditType
  14195. * @description 要素集更新模式枚举。
  14196. * 该枚举用于指定数据服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  14197. * @category BaseTypes Constant
  14198. * @type {string}
  14199. * @usage
  14200. * ```
  14201. * // 浏览器
  14202. * <script type="text/javascript" src="{cdn}"></script>
  14203. * <script>
  14204. * const result = {namespace}.EditType.ADD;
  14205. *
  14206. * </script>
  14207. * // ES6 Import
  14208. * import { EditType } from '{npm}';
  14209. *
  14210. * const result = {namespace}.EditType.ADD;
  14211. * ```
  14212. */
  14213. var EditType = {
  14214. /** 增加操作。 */
  14215. ADD: "add",
  14216. /** 修改操作。 */
  14217. UPDATE: "update",
  14218. /** 删除操作。 */
  14219. DELETE: "delete"
  14220. };
  14221. /**
  14222. * @enum TransferTactic
  14223. * @description 公交换乘策略枚举。
  14224. * 该枚举用于指定公交服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  14225. * @category BaseTypes Constant
  14226. * @type {string}
  14227. * @usage
  14228. * ```
  14229. * // 浏览器
  14230. * <script type="text/javascript" src="{cdn}"></script>
  14231. * <script>
  14232. * const result = {namespace}.TransferTactic.LESS_TIME;
  14233. *
  14234. * </script>
  14235. * // ES6 Import
  14236. * import { TransferTactic } from '{npm}';
  14237. *
  14238. * const result = TransferTactic.LESS_TIME;
  14239. * ```
  14240. */
  14241. var TransferTactic = {
  14242. /** 时间短。 */
  14243. LESS_TIME: "LESS_TIME",
  14244. /** 少换乘。 */
  14245. LESS_TRANSFER: "LESS_TRANSFER",
  14246. /** 少步行。 */
  14247. LESS_WALK: "LESS_WALK",
  14248. /** 距离最短。 */
  14249. MIN_DISTANCE: "MIN_DISTANCE"
  14250. };
  14251. /**
  14252. * @enum TransferPreference
  14253. * @description 公交换乘策略枚举。
  14254. * 该枚举用于指定交通换乘服务中设置地铁优先、公交优先、不乘地铁、无偏好等偏好设置。
  14255. * @category BaseTypes Constant
  14256. * @type {string}
  14257. * @usage
  14258. * ```
  14259. * // 浏览器
  14260. * <script type="text/javascript" src="{cdn}"></script>
  14261. * <script>
  14262. * const result = {namespace}.TransferPreference.BUS;
  14263. *
  14264. * </script>
  14265. * // ES6 Import
  14266. * import { TransferPreference } from '{npm}';
  14267. *
  14268. * const result = TransferPreference.BUS;
  14269. * ```
  14270. */
  14271. var TransferPreference = {
  14272. /** 公交汽车优先。 */
  14273. BUS: "BUS",
  14274. /** 地铁优先。 */
  14275. SUBWAY: "SUBWAY",
  14276. /** 不乘坐地铁。 */
  14277. NO_SUBWAY: "NO_SUBWAY",
  14278. /** 无乘车偏好。 */
  14279. NONE: "NONE"
  14280. };
  14281. /**
  14282. * @enum GridType
  14283. * @description 地图背景格网类型枚举。
  14284. * @category BaseTypes Constant
  14285. * @type {string}
  14286. * @usage
  14287. * ```
  14288. * // 浏览器
  14289. * <script type="text/javascript" src="{cdn}"></script>
  14290. * <script>
  14291. * const result = {namespace}.GridType.CROSS;
  14292. *
  14293. * </script>
  14294. * // ES6 Import
  14295. * import { GridType } from '{npm}';
  14296. *
  14297. * const result = GridType.CROSS;
  14298. * ```
  14299. */
  14300. var GridType = {
  14301. /** 十字叉丝。 */
  14302. CROSS: "CROSS",
  14303. /** 网格线。 */
  14304. GRID: "GRID",
  14305. /** 点。 */
  14306. POINT: "POINT"
  14307. };
  14308. /**
  14309. * @enum ColorSpaceType
  14310. * @description 色彩空间枚举。
  14311. * 由于成色原理的不同,决定了显示器、投影仪这类靠色光直接合成颜色的颜色设备和打印机、
  14312. * 印刷机这类靠使用颜料的印刷设备在生成颜色方式上的区别。
  14313. * 针对上述不同成色方式,SuperMap 提供两种色彩空间,
  14314. * 分别为 RGB 和 CMYK。RGB 主要用于显示系统中,CMYK 主要用于印刷系统中。
  14315. * @category BaseTypes Constant
  14316. * @type {string}
  14317. * @usage
  14318. * ```
  14319. * // 浏览器
  14320. * <script type="text/javascript" src="{cdn}"></script>
  14321. * <script>
  14322. * const result = {namespace}.ColorSpaceType.CMYK;
  14323. *
  14324. * </script>
  14325. * // ES6 Import
  14326. * import { ColorSpaceType } from '{npm}';
  14327. *
  14328. * const result = ColorSpaceType.CMYK;
  14329. * ```
  14330. */
  14331. var ColorSpaceType = {
  14332. /** 该类型主要在印刷系统使用。 */
  14333. CMYK: "CMYK",
  14334. /** 该类型主要在显示系统中使用。 */
  14335. RGB: "RGB"
  14336. };
  14337. /**
  14338. * @enum LayerType
  14339. * @description 图层类型。
  14340. * @category BaseTypes Constant
  14341. * @type {string}
  14342. * @usage
  14343. * ```
  14344. * // 浏览器
  14345. * <script type="text/javascript" src="{cdn}"></script>
  14346. * <script>
  14347. * const result = {namespace}.LayerType.UGC;
  14348. *
  14349. * </script>
  14350. * // ES6 Import
  14351. * import { LayerType } from '{npm}';
  14352. *
  14353. * const result = LayerType.UGC;
  14354. * ```
  14355. */
  14356. var LayerType = {
  14357. /** SuperMap UGC 类型图层。如矢量图层、栅格(Grid)图层、影像图层。 */
  14358. UGC: "UGC",
  14359. /** WMS 图层。 */
  14360. WMS: "WMS",
  14361. /** WFS 图层。 */
  14362. WFS: "WFS",
  14363. /** 自定义图层。 */
  14364. CUSTOM: "CUSTOM"
  14365. };
  14366. /**
  14367. * @enum UGCLayerType
  14368. * @description SuperMap 图层类型。
  14369. * @category BaseTypes Constant
  14370. * @type {string}
  14371. * @usage
  14372. * ```
  14373. * // 浏览器
  14374. * <script type="text/javascript" src="{cdn}"></script>
  14375. * <script>
  14376. * const result = {namespace}.UGCLayerType.THEME;
  14377. *
  14378. * </script>
  14379. * // ES6 Import
  14380. * import { UGCLayerType } from '{npm}';
  14381. *
  14382. * const result = UGCLayerType.THEME;
  14383. * ```
  14384. */
  14385. var UGCLayerType = {
  14386. /** 专题图层。 */
  14387. THEME: "THEME",
  14388. /** 矢量图层。 */
  14389. VECTOR: "VECTOR",
  14390. /** 栅格图层。 */
  14391. GRID: "GRID",
  14392. /** 影像图层。 */
  14393. IMAGE: "IMAGE"
  14394. };
  14395. /**
  14396. * @enum StatisticMode
  14397. * @description 字段统计方法类型。
  14398. * @category BaseTypes Constant
  14399. * @type {string}
  14400. * @usage
  14401. * ```
  14402. * // 浏览器
  14403. * <script type="text/javascript" src="{cdn}"></script>
  14404. * <script>
  14405. * const result = {namespace}.StatisticMode.AVERAGE;
  14406. *
  14407. * </script>
  14408. * // ES6 Import
  14409. * import { StatisticMode } from '{npm}';
  14410. *
  14411. * const result = StatisticMode.AVERAGE;
  14412. * ```
  14413. */
  14414. var StatisticMode = {
  14415. /** 统计所选字段的平均值。 */
  14416. AVERAGE: "AVERAGE",
  14417. /** 统计所选字段的最大值。 */
  14418. MAX: "MAX",
  14419. /** 统计所选字段的最小值。 */
  14420. MIN: "MIN",
  14421. /** 统计所选字段的标准差 */
  14422. STDDEVIATION: "STDDEVIATION",
  14423. /** 统计所选字段的总和。 */
  14424. SUM: "SUM",
  14425. /** 统计所选字段的方差。 */
  14426. VARIANCE: "VARIANCE"
  14427. };
  14428. /**
  14429. * @enum PixelFormat
  14430. * @description 栅格与影像数据存储的像素格式枚举。
  14431. * @category BaseTypes Constant
  14432. * @type {string}
  14433. * @usage
  14434. * ```
  14435. * // 浏览器
  14436. * <script type="text/javascript" src="{cdn}"></script>
  14437. * <script>
  14438. * const result = {namespace}.PixelFormat.BIT16;
  14439. *
  14440. * </script>
  14441. * // ES6 Import
  14442. * import { PixelFormat } from '{npm}';
  14443. *
  14444. * const result = PixelFormat.BIT16;
  14445. * ```
  14446. */
  14447. var PixelFormat = {
  14448. /** 每个像元用16个比特(即2个字节)表示。 */
  14449. BIT16: "BIT16",
  14450. /** 每个像元用32个比特(即4个字节)表示。 */
  14451. BIT32: "BIT32",
  14452. /** 每个像元用64个比特(即8个字节)表示,只提供给栅格数据集使用。 */
  14453. BIT64: "BIT64",
  14454. /** 每个像元用4个字节来表示,只提供给栅格数据集使用。 */
  14455. SINGLE: "SINGLE",
  14456. /** 每个像元用8个字节来表示,只提供给栅格数据集使用。 */
  14457. DOUBLE: "DOUBLE",
  14458. /** 每个像元用1个比特表示。 */
  14459. UBIT1: "UBIT1",
  14460. /** 每个像元用4个比特来表示。 */
  14461. UBIT4: "UBIT4",
  14462. /** 每个像元用8个比特(即1个字节)来表示。 */
  14463. UBIT8: "UBIT8",
  14464. /** 每个像元用24个比特(即3个字节)来表示。 */
  14465. UBIT24: "UBIT24",
  14466. /** 每个像元用32个比特(即4个字节)来表示。 */
  14467. UBIT32: "UBIT32"
  14468. };
  14469. /**
  14470. * @enum SearchMode
  14471. * @description 内插时使用的样本点的查找方式枚举。
  14472. * @category BaseTypes Constant
  14473. * @type {string}
  14474. * @usage
  14475. * ```
  14476. * // 浏览器
  14477. * <script type="text/javascript" src="{cdn}"></script>
  14478. * <script>
  14479. * const result = {namespace}.SearchMode.KDTREE_FIXED_COUNT;
  14480. *
  14481. * </script>
  14482. * // ES6 Import
  14483. * import { SearchMode } from '{npm}';
  14484. *
  14485. * const result = SearchMode.KDTREE_FIXED_COUNT;
  14486. * ```
  14487. */
  14488. var SearchMode = {
  14489. /** 使用 KDTREE 的固定点数方式查找参与内插分析的点。 */
  14490. KDTREE_FIXED_COUNT: "KDTREE_FIXED_COUNT",
  14491. /** 使用 KDTREE 的定长方式查找参与内插分析的点。 */
  14492. KDTREE_FIXED_RADIUS: "KDTREE_FIXED_RADIUS",
  14493. /** 不进行查找,使用所有的输入点进行内插分析。 */
  14494. NONE: "NONE",
  14495. /** 使用 QUADTREE 方式查找参与内插分析的点,仅对样条(RBF)插值和普通克吕金(Kriging)有用。 */
  14496. QUADTREE: "QUADTREE"
  14497. };
  14498. /**
  14499. * @enum InterpolationAlgorithmType
  14500. * @description 插值分析的算法的类型。
  14501. * @category BaseTypes Constant
  14502. * @type {string}
  14503. * @usage
  14504. * ```
  14505. * // 浏览器
  14506. * <script type="text/javascript" src="{cdn}"></script>
  14507. * <script>
  14508. * const result = {namespace}.InterpolationAlgorithmType.KRIGING;
  14509. *
  14510. * </script>
  14511. * // ES6 Import
  14512. * import { InterpolationAlgorithmType } from '{npm}';
  14513. *
  14514. * const result = InterpolationAlgorithmType.KRIGING;
  14515. * ```
  14516. */
  14517. var InterpolationAlgorithmType = {
  14518. /** 普通克吕金插值法。 */
  14519. KRIGING: "KRIGING",
  14520. /** 简单克吕金插值法。 */
  14521. SimpleKriging: "SimpleKriging",
  14522. /** 泛克吕金插值法。 */
  14523. UniversalKriging: "UniversalKriging"
  14524. };
  14525. /**
  14526. * @enum VariogramMode
  14527. * @description 克吕金(Kriging)插值时的半变函数类型枚举。
  14528. * @category BaseTypes Constant
  14529. * @type {string}
  14530. * @usage
  14531. * ```
  14532. * // 浏览器
  14533. * <script type="text/javascript" src="{cdn}"></script>
  14534. * <script>
  14535. * const result = {namespace}.VariogramMode.EXPONENTIAL;
  14536. *
  14537. * </script>
  14538. * // ES6 Import
  14539. * import { VariogramMode } from '{npm}';
  14540. *
  14541. * const result = VariogramMode.EXPONENTIAL;
  14542. * ```
  14543. */
  14544. var VariogramMode = {
  14545. /** 指数函数。 */
  14546. EXPONENTIAL: "EXPONENTIAL",
  14547. /** 高斯函数。 */
  14548. GAUSSIAN: "GAUSSIAN",
  14549. /** 球型函数。 */
  14550. SPHERICAL: "SPHERICAL"
  14551. };
  14552. /**
  14553. * @enum Exponent
  14554. * @description 定义了泛克吕金(UniversalKriging)插值时样点数据中趋势面方程的阶数。
  14555. * @category BaseTypes Constant
  14556. * @type {string}
  14557. * @usage
  14558. * ```
  14559. * // 浏览器
  14560. * <script type="text/javascript" src="{cdn}"></script>
  14561. * <script>
  14562. * const result = {namespace}.Exponent.EXP1;
  14563. *
  14564. * </script>
  14565. * // ES6 Import
  14566. * import { Exponent } from '{npm}';
  14567. *
  14568. * const result = Exponent.EXP1;
  14569. * ```
  14570. */
  14571. var Exponent = {
  14572. /** 阶数为1。 */
  14573. EXP1: "EXP1",
  14574. /** 阶数为2。 */
  14575. EXP2: "EXP2"
  14576. };
  14577. /**
  14578. * @enum ClientType
  14579. * @description token申请的客户端标识类型。
  14580. * @category BaseTypes Constant
  14581. * @type {string}
  14582. * @usage
  14583. * ```
  14584. * // 浏览器
  14585. * <script type="text/javascript" src="{cdn}"></script>
  14586. * <script>
  14587. * const result = {namespace}.ClientType.IP;
  14588. *
  14589. * </script>
  14590. * // ES6 Import
  14591. * import { ClientType } from '{npm}';
  14592. *
  14593. * const result = ClientType.IP;
  14594. * ```
  14595. */
  14596. var ClientType = {
  14597. /** 指定的 IP 地址。 */
  14598. IP: "IP",
  14599. /** 指定的 URL。 */
  14600. REFERER: "Referer",
  14601. /** 发送申请令牌请求的客户端 IP。 */
  14602. REQUESTIP: "RequestIP",
  14603. /** 不做任何验证。 */
  14604. NONE: "NONE",
  14605. /** SERVER。 */
  14606. SERVER: "SERVER",
  14607. /** WEB。 */
  14608. WEB: "WEB"
  14609. };
  14610. /**
  14611. * @enum ChartType
  14612. * @description 客户端专题图图表类型。
  14613. * @category BaseTypes Constant
  14614. * @type {string}
  14615. * @usage
  14616. * ```
  14617. * // 浏览器
  14618. * <script type="text/javascript" src="{cdn}"></script>
  14619. * <script>
  14620. * const result = {namespace}.ChartType.BAR;
  14621. *
  14622. * </script>
  14623. * // ES6 Import
  14624. * import { ChartType } from '{npm}';
  14625. *
  14626. * const result = ChartType.BAR;
  14627. * ```
  14628. */
  14629. var ChartType = {
  14630. /** 柱状图。 */
  14631. BAR: "Bar",
  14632. /** 三维柱状图。 */
  14633. BAR3D: "Bar3D",
  14634. /** 圆形图。 */
  14635. CIRCLE: "Circle",
  14636. /** 饼图。 */
  14637. PIE: "Pie",
  14638. /** 散点图。 */
  14639. POINT: "Point",
  14640. /** 折线图。 */
  14641. LINE: "Line",
  14642. /** 环状图。 */
  14643. RING: "Ring"
  14644. };
  14645. /**
  14646. * @enum ClipAnalystMode
  14647. * @description 裁剪分析模式
  14648. * @category BaseTypes Constant
  14649. * @type {string}
  14650. * @usage
  14651. * ```
  14652. * // 浏览器
  14653. * <script type="text/javascript" src="{cdn}"></script>
  14654. * <script>
  14655. * const result = {namespace}.ClipAnalystMode.CLIP;
  14656. *
  14657. * </script>
  14658. * // ES6 Import
  14659. * import { ClipAnalystMode } from '{npm}';
  14660. *
  14661. * const result = ClipAnalystMode.CLIP;
  14662. * ```
  14663. */
  14664. var ClipAnalystMode = {
  14665. /** CLIP。 */
  14666. CLIP: "clip",
  14667. /** INTERSECT。 */
  14668. INTERSECT: "intersect"
  14669. };
  14670. /**
  14671. * @enum AnalystAreaUnit
  14672. * @description 分布式分析面积单位。
  14673. * @category BaseTypes Constant
  14674. * @type {string}
  14675. * @usage
  14676. * ```
  14677. * // 浏览器
  14678. * <script type="text/javascript" src="{cdn}"></script>
  14679. * <script>
  14680. * const result = {namespace}.AnalystAreaUnit.SQUAREMETER;
  14681. *
  14682. * </script>
  14683. * // ES6 Import
  14684. * import { AnalystAreaUnit } from '{npm}';
  14685. *
  14686. * const result = AnalystAreaUnit.SQUAREMETER;
  14687. * ```
  14688. */
  14689. var AnalystAreaUnit = {
  14690. /** 平方米。 */
  14691. "SQUAREMETER": "SquareMeter",
  14692. /** 平方千米。 */
  14693. "SQUAREKILOMETER": "SquareKiloMeter",
  14694. /** 公顷。 */
  14695. "HECTARE": "Hectare",
  14696. /** 公亩。 */
  14697. "ARE": "Are",
  14698. /** 英亩。 */
  14699. "ACRE": "Acre",
  14700. /** 平方英尺。 */
  14701. "SQUAREFOOT": "SquareFoot",
  14702. /** 平方码。 */
  14703. "SQUAREYARD": "SquareYard",
  14704. /** 平方英里。 */
  14705. "SQUAREMILE": "SquareMile"
  14706. };
  14707. /**
  14708. * @enum AnalystSizeUnit
  14709. * @description 分布式分析单位。
  14710. * @category BaseTypes Constant
  14711. * @type {string}
  14712. * @usage
  14713. * ```
  14714. * // 浏览器
  14715. * <script type="text/javascript" src="{cdn}"></script>
  14716. * <script>
  14717. * const result = {namespace}.AnalystSizeUnit.METER;
  14718. *
  14719. * </script>
  14720. * // ES6 Import
  14721. * import { AnalystSizeUnit } from '{npm}';
  14722. *
  14723. * const result = AnalystSizeUnit.METER;
  14724. * ```
  14725. */
  14726. var AnalystSizeUnit = {
  14727. /** 米。 */
  14728. "METER": "Meter",
  14729. /** 千米。 */
  14730. "KILOMETER": "Kilometer",
  14731. /** 码。 */
  14732. "YARD": "Yard",
  14733. /** 英尺。 */
  14734. "FOOT": "Foot",
  14735. /** 英里。 */
  14736. "MILE": "Mile"
  14737. };
  14738. /**
  14739. * @enum StatisticAnalystMode
  14740. * @description 分布式分析统计模式。
  14741. * @category BaseTypes Constant
  14742. * @type {string}
  14743. * @usage
  14744. * ```
  14745. * // 浏览器
  14746. * <script type="text/javascript" src="{cdn}"></script>
  14747. * <script>
  14748. * const result = {namespace}.StatisticAnalystMode.MAX;
  14749. *
  14750. * </script>
  14751. * // ES6 Import
  14752. * import { StatisticAnalystMode } from '{npm}';
  14753. *
  14754. * const result = StatisticAnalystMode.MAX;
  14755. * ```
  14756. */
  14757. var StatisticAnalystMode = {
  14758. /** 统计所选字段的最大值。 */
  14759. "MAX": "max",
  14760. /** 统计所选字段的最小值。 */
  14761. "MIN": "min",
  14762. /** 统计所选字段的平均值。 */
  14763. "AVERAGE": "average",
  14764. /** 统计所选字段的总和。 */
  14765. "SUM": "sum",
  14766. /** 统计所选字段的方差。 */
  14767. "VARIANCE": "variance",
  14768. /** 统计所选字段的标准差。 */
  14769. "STDDEVIATION": "stdDeviation"
  14770. };
  14771. /**
  14772. * @enum SummaryType
  14773. * @description 分布式分析聚合类型。
  14774. * @category BaseTypes Constant
  14775. * @type {string}
  14776. * @usage
  14777. * ```
  14778. * // 浏览器
  14779. * <script type="text/javascript" src="{cdn}"></script>
  14780. * <script>
  14781. * const result = {namespace}.SummaryType.SUMMARYMESH;
  14782. *
  14783. * </script>
  14784. * // ES6 Import
  14785. * import { SummaryType } from '{npm}';
  14786. *
  14787. * const result = SummaryType.SUMMARYMESH;
  14788. * ```
  14789. */
  14790. var SummaryType = {
  14791. /** 格网聚合。 */
  14792. "SUMMARYMESH": "SUMMARYMESH",
  14793. /** 多边形聚合。 */
  14794. "SUMMARYREGION": "SUMMARYREGION"
  14795. };
  14796. /**
  14797. * @enum TopologyValidatorRule
  14798. * @description 拓扑检查模式枚举。该类定义了拓扑检查操作模式常量。
  14799. * @category BaseTypes Constant
  14800. * @type {string}
  14801. * @usage
  14802. * ```
  14803. * // 浏览器
  14804. * <script type="text/javascript" src="{cdn}"></script>
  14805. * <script>
  14806. * const result = {namespace}.TopologyValidatorRule.REGIONNOOVERLAP;
  14807. *
  14808. * </script>
  14809. * // ES6 Import
  14810. * import { TopologyValidatorRule } from '{npm}';
  14811. *
  14812. * const result = TopologyValidatorRule.REGIONNOOVERLAP;
  14813. * ```
  14814. */
  14815. var TopologyValidatorRule = {
  14816. /** 面内无重叠,用于对面数据进行拓扑检查。 */
  14817. REGIONNOOVERLAP: "REGIONNOOVERLAP",
  14818. /** 面与面无重叠,用于对面数据进行拓扑检查。 */
  14819. REGIONNOOVERLAPWITH: "REGIONNOOVERLAPWITH",
  14820. /** 面被面包含,用于对面数据进行拓扑检查。 */
  14821. REGIONCONTAINEDBYREGION: "REGIONCONTAINEDBYREGION",
  14822. /** 面被面覆盖,用于对面数据进行拓扑检查。 */
  14823. REGIONCOVEREDBYREGION: "REGIONCOVEREDBYREGION",
  14824. /** 线与线无重叠,用于对线数据进行拓扑检查。 */
  14825. LINENOOVERLAP: "LINENOOVERLAP",
  14826. /** 线内无重叠,用于对线数据进行拓扑检查。 */
  14827. LINENOOVERLAPWITH: "LINENOOVERLAPWITH",
  14828. /** 点不相同,用于对点数据进行拓扑检查。 */
  14829. POINTNOIDENTICAL: "POINTNOIDENTICAL"
  14830. };
  14831. /**
  14832. * @enum BucketAggType
  14833. * @description 格网聚合查询枚举类,该类定义了Elasticsearch数据服务中聚合查询模式常量
  14834. * @category BaseTypes Constant
  14835. * @type {string}
  14836. * @usage
  14837. * ```
  14838. * // 浏览器
  14839. * <script type="text/javascript" src="{cdn}"></script>
  14840. * <script>
  14841. * const result = {namespace}.BucketAggType.GEOHASH_GRID;
  14842. *
  14843. * </script>
  14844. * // ES6 Import
  14845. * import { BucketAggType } from '{npm}';
  14846. *
  14847. * const result = BucketAggType.GEOHASH_GRID;
  14848. * ```
  14849. */
  14850. var BucketAggType = {
  14851. /** 格网聚合类型。 */
  14852. GEOHASH_GRID: "geohash_grid"
  14853. };
  14854. /**
  14855. * @enum MetricsAggType
  14856. * @description 指标聚合类型枚举类,该类定义了Elasticsearch数据服务中聚合查询模式常量。
  14857. * @category BaseTypes Constant
  14858. * @type {string}
  14859. * @usage
  14860. * ```
  14861. * // 浏览器
  14862. * <script type="text/javascript" src="{cdn}"></script>
  14863. * <script>
  14864. * const result = {namespace}.MetricsAggType.AVG;
  14865. *
  14866. * </script>
  14867. * // ES6 Import
  14868. * import { MetricsAggType } from '{npm}';
  14869. *
  14870. * const result = MetricsAggType.AVG;
  14871. * ```
  14872. */
  14873. var MetricsAggType = {
  14874. /** 平均值聚合类型。 */
  14875. AVG:'avg',
  14876. /** 最大值聚合类型。 */
  14877. MAX:'max',
  14878. /** 最小值聚合类型。 */
  14879. MIN:'min',
  14880. /** 求和聚合类型。 */
  14881. SUM:'sum'
  14882. };
  14883. /**
  14884. * @enum GetFeatureMode
  14885. * @description feature 查询方式。
  14886. * @category BaseTypes Constant
  14887. * @type {string}
  14888. * @usage
  14889. * ```
  14890. * // 浏览器
  14891. * <script type="text/javascript" src="{cdn}"></script>
  14892. * <script>
  14893. * const result = {namespace}.GetFeatureMode.BOUNDS;
  14894. *
  14895. * </script>
  14896. * // ES6 Import
  14897. * import { GetFeatureMode } from '{npm}';
  14898. *
  14899. * const result = GetFeatureMode.BOUNDS;
  14900. * ```
  14901. */
  14902. var GetFeatureMode = {
  14903. /** 通过范围查询来获取要素。 */
  14904. BOUNDS: "BOUNDS",
  14905. /** 通过几何对象的缓冲区来获取要素。 */
  14906. BUFFER: "BUFFER",
  14907. /** 通过 ID 来获取要素。 */
  14908. ID: "ID",
  14909. /** 通过空间查询模式来获取要素。 */
  14910. SPATIAL: "SPATIAL",
  14911. /** 通过 SQL 查询来获取要素。 */
  14912. SQL: 'SQL'
  14913. }
  14914. /**
  14915. * @enum RasterFunctionType
  14916. * @description 栅格分析方法。
  14917. * @category BaseTypes Constant
  14918. * @type {string}
  14919. * @usage
  14920. * ```
  14921. * // 浏览器
  14922. * <script type="text/javascript" src="{cdn}"></script>
  14923. * <script>
  14924. * const result = {namespace}.GetFeatureMode.NDVI;
  14925. *
  14926. * </script>
  14927. * // ES6 Import
  14928. * import { GetFeatureMode } from '{npm}';
  14929. *
  14930. * const result = GetFeatureMode.NDVI;
  14931. * ```
  14932. */
  14933. var RasterFunctionType = {
  14934. /** 归一化植被指数。 */
  14935. NDVI: "NDVI",
  14936. /** 阴影面分析。 */
  14937. HILLSHADE: "HILLSHADE"
  14938. }
  14939. /**
  14940. * @enum ResourceType
  14941. * @description iportal资源类型。
  14942. * @category BaseTypes Constant
  14943. * @version 10.0.1
  14944. * @type {string}
  14945. * @usage
  14946. * ```
  14947. * // 浏览器
  14948. * <script type="text/javascript" src="{cdn}"></script>
  14949. * <script>
  14950. * const result = {namespace}.GetFeatureMode.MAP;
  14951. *
  14952. * </script>
  14953. * // ES6 Import
  14954. * import { GetFeatureMode } from '{npm}';
  14955. *
  14956. * const result = GetFeatureMode.MAP;
  14957. * ```
  14958. */
  14959. var ResourceType = {
  14960. /** 地图。 */
  14961. MAP: "MAP",
  14962. /** 服务。 */
  14963. SERVICE: "SERVICE",
  14964. /** 场景。 */
  14965. SCENE: "SCENE",
  14966. /** 数据。 */
  14967. DATA: "DATA",
  14968. /** 洞察。 */
  14969. INSIGHTS_WORKSPACE: "INSIGHTS_WORKSPACE",
  14970. /** 大屏。 */
  14971. MAP_DASHBOARD: "MAP_DASHBOARD"
  14972. }
  14973. /**
  14974. * @enum OrderBy
  14975. * @description iportal资源排序字段。
  14976. * @category BaseTypes Constant
  14977. * @version 10.0.1
  14978. * @type {string}
  14979. * @usage
  14980. * ```
  14981. * // 浏览器
  14982. * <script type="text/javascript" src="{cdn}"></script>
  14983. * <script>
  14984. * const result = {namespace}.OrderBy.UPDATETIME;
  14985. *
  14986. * </script>
  14987. * // ES6 Import
  14988. * import { OrderBy } from '{npm}';
  14989. *
  14990. * const result = OrderBy.UPDATETIME;
  14991. * ```
  14992. */
  14993. var OrderBy = {
  14994. /** 按更新时间排序。 */
  14995. UPDATETIME: "UPDATETIME",
  14996. /** 按热度(可能是访问量、下载量)排序。 */
  14997. HEATLEVEL: "HEATLEVEL",
  14998. /** 按相关性排序。 */
  14999. RELEVANCE: "RELEVANCE"
  15000. }
  15001. /**
  15002. * @enum OrderType
  15003. * @description iportal资源升序还是降序过滤。
  15004. * @category BaseTypes Constant
  15005. * @version 10.0.1
  15006. * @type {string}
  15007. * @usage
  15008. * ```
  15009. * // 浏览器
  15010. * <script type="text/javascript" src="{cdn}"></script>
  15011. * <script>
  15012. * const result = {namespace}.OrderType.ASC;
  15013. *
  15014. * </script>
  15015. * // ES6 Import
  15016. * import { OrderType } from '{npm}';
  15017. *
  15018. * const result = OrderType.ASC;
  15019. * ```
  15020. */
  15021. var OrderType = {
  15022. /** 升序。 */
  15023. ASC: "ASC",
  15024. /** 降序。 */
  15025. DESC: "DESC"
  15026. }
  15027. /**
  15028. * @enum SearchType
  15029. * @description iportal资源查询的范围进行过滤。
  15030. * @category BaseTypes Constant
  15031. * @version 10.0.1
  15032. * @type {string}
  15033. * @usage
  15034. * ```
  15035. * // 浏览器
  15036. * <script type="text/javascript" src="{cdn}"></script>
  15037. * <script>
  15038. * const result = {namespace}.SearchType.PUBLIC;
  15039. *
  15040. * </script>
  15041. * // ES6 Import
  15042. * import { SearchType } from '{npm}';
  15043. *
  15044. * const result = SearchType.PUBLIC;
  15045. * ```
  15046. */
  15047. var SearchType = {
  15048. /** 公开资源。 */
  15049. PUBLIC: "PUBLIC",
  15050. /** 我的资源。 */
  15051. MY_RES: "MY_RES",
  15052. /** 我的群组资源。 */
  15053. MYGROUP_RES: "MYGROUP_RES",
  15054. /** 我的部门资源。 */
  15055. MYDEPARTMENT_RES: "MYDEPARTMENT_RES",
  15056. /** 分享给我的资源。 */
  15057. SHARETOME_RES: "SHARETOME_RES"
  15058. }
  15059. /**
  15060. * @enum AggregationTypes
  15061. * @description iportal资源聚合查询的类型。
  15062. * @category BaseTypes Constant
  15063. * @version 10.0.1
  15064. * @type {string}
  15065. * @usage
  15066. * ```
  15067. * // 浏览器
  15068. * <script type="text/javascript" src="{cdn}"></script>
  15069. * <script>
  15070. * const result = {namespace}.AggregationTypes.TAG;
  15071. *
  15072. * </script>
  15073. * // ES6 Import
  15074. * import { AggregationTypes } from '{npm}';
  15075. *
  15076. * const result = AggregationTypes.TAG;
  15077. * ```
  15078. */
  15079. var AggregationTypes = {
  15080. /** 标签。 */
  15081. TAG: "TAG",
  15082. /** 资源类型。 */
  15083. TYPE: "TYPE"
  15084. }
  15085. /**
  15086. * @enum PermissionType
  15087. * @description iportal资源权限类型。
  15088. * @category BaseTypes Constant
  15089. * @version 10.0.1
  15090. * @type {string}
  15091. * @usage
  15092. * ```
  15093. * // 浏览器
  15094. * <script type="text/javascript" src="{cdn}"></script>
  15095. * <script>
  15096. * const result = {namespace}.PermissionType.SEARCH;
  15097. *
  15098. * </script>
  15099. * // ES6 Import
  15100. * import { PermissionType } from '{npm}';
  15101. *
  15102. * const result = PermissionType.SEARCH;
  15103. * ```
  15104. */
  15105. var PermissionType = {
  15106. /** 可检索。 */
  15107. SEARCH:"SEARCH",
  15108. /** 可查看。 */
  15109. READ: "READ",
  15110. /** 可编辑。 */
  15111. READWRITE: "READWRITE",
  15112. /** 可删除。 */
  15113. DELETE: "DELETE",
  15114. /** 可下载,包括可读、可检索。 */
  15115. DOWNLOAD:"DOWNLOAD"
  15116. }
  15117. /**
  15118. * @enum EntityType
  15119. * @description iportal资源实体类型。
  15120. * @category BaseTypes Constant
  15121. * @version 10.0.1
  15122. * @type {string}
  15123. * @usage
  15124. * ```
  15125. * // 浏览器
  15126. * <script type="text/javascript" src="{cdn}"></script>
  15127. * <script>
  15128. * const result = {namespace}.EntityType.DEPARTMENT;
  15129. *
  15130. * </script>
  15131. * // ES6 Import
  15132. * import { EntityType } from '{npm}';
  15133. *
  15134. * const result = EntityType.DEPARTMENT;
  15135. * ```
  15136. */
  15137. var EntityType = {
  15138. /** 部门。 */
  15139. DEPARTMENT: "DEPARTMENT",
  15140. /** 用户组。 */
  15141. GROUP: "GROUP",
  15142. /** 群组。 */
  15143. IPORTALGROUP: "IPORTALGROUP",
  15144. /** 角色。 */
  15145. ROLE: "ROLE",
  15146. /** 用户。 */
  15147. USER: "USER"
  15148. }
  15149. /**
  15150. * @enum DataItemType
  15151. * @description iportal数据类型。
  15152. * @category BaseTypes Constant
  15153. * @version 10.0.1
  15154. * @type {string}
  15155. * @usage
  15156. * ```
  15157. * // 浏览器
  15158. * <script type="text/javascript" src="{cdn}"></script>
  15159. * <script>
  15160. * const result = {namespace}.DataItemType.GEOJSON;
  15161. *
  15162. * </script>
  15163. * // ES6 Import
  15164. * import { DataItemType } from '{npm}';
  15165. *
  15166. * const result = DataItemType.GEOJSON;
  15167. * ```
  15168. */
  15169. var DataItemType = {
  15170. /** geojson 数据。 */
  15171. GEOJSON: "GEOJSON",
  15172. /** UGCV5_MVT。 */
  15173. UGCV5_MVT: "UGCV5_MVT",
  15174. /** json数据。 */
  15175. JSON: "JSON",
  15176. /** 音频文件。 */
  15177. AUDIO: "AUDIO",
  15178. /** Color 颜色。 */
  15179. COLOR: "COLOR",
  15180. /** ColorScheme 颜色方案。 */
  15181. COLORSCHEME: "COLORSCHEME",
  15182. /** CSV 数据。 */
  15183. CSV: "CSV",
  15184. /** EXCEL 数据。 */
  15185. EXCEL: "EXCEL",
  15186. /** FillSymbol 填充符号库。 */
  15187. FILLSYMBOL: "FILLSYMBOL",
  15188. /** 图片类型。 */
  15189. IMAGE: "IMAGE",
  15190. /** LayerTemplate 图层模板。 */
  15191. LAYERTEMPLATE: "LAYERTEMPLATE",
  15192. /** LayoutTemplate 布局模板。 */
  15193. LAYOUTTEMPLATE: "LAYOUTTEMPLATE",
  15194. /** LineSymbol 线符号库。 */
  15195. LINESYMBOL: "LINESYMBOL",
  15196. /** MapTemplate 地图模板。 */
  15197. MAPTEMPLATE: "MAPTEMPLATE",
  15198. /** MarkerSymbol 点符号库。 */
  15199. MARKERSYMBOL: "MARKERSYMBOL",
  15200. /** MBTILES。 */
  15201. MBTILES: "MBTILES",
  15202. /** 照片。 */
  15203. PHOTOS: "PHOTOS",
  15204. /** SHP 空间数据。 */
  15205. SHP: "SHP",
  15206. /** SMTILES。 */
  15207. SMTILES: "SMTILES",
  15208. /** SVTILES。 */
  15209. SVTILES: "SVTILES",
  15210. /** ThemeTemplate 专题图模板。 */
  15211. THEMETEMPLATE: "THEMETEMPLATE",
  15212. /** TPK。 */
  15213. TPK: "TPK",
  15214. /** UDB 数据源。 */
  15215. UDB: "UDB",
  15216. /** UGCV5。 */
  15217. UGCV5: "UGCV5",
  15218. /** 其他类型(普通文件)。 */
  15219. UNKNOWN: "UNKNOWN",
  15220. /** 视频文件。 */
  15221. VIDEO: "VIDEO",
  15222. /** WorkEnviroment 工作环境。 */
  15223. WORKENVIRONMENT: "WORKENVIRONMENT",
  15224. /** 工作空间。 */
  15225. WORKSPACE: "WORKSPACE"
  15226. }
  15227. /**
  15228. * @enum WebExportFormatType
  15229. * @description Web 打印输出的格式。
  15230. * @category BaseTypes Constant
  15231. * @version 10.0.1
  15232. * @type {string}
  15233. * @usage
  15234. * ```
  15235. * // 浏览器
  15236. * <script type="text/javascript" src="{cdn}"></script>
  15237. * <script>
  15238. * const result = {namespace}.WebExportFormatType.PNG;
  15239. *
  15240. * </script>
  15241. * // ES6 Import
  15242. * import { WebExportFormatType } from '{npm}';
  15243. *
  15244. * const result = WebExportFormatType.PNG;
  15245. * ```
  15246. */
  15247. var WebExportFormatType = {
  15248. /** PNG */
  15249. PNG: "PNG",
  15250. /** PDF */
  15251. PDF: "PDF"
  15252. }
  15253. /**
  15254. * @enum WebScaleOrientationType
  15255. * @description Web 比例尺的方位样式。
  15256. * @category BaseTypes Constant
  15257. * @version 10.0.1
  15258. * @type {string}
  15259. * @usage
  15260. * ```
  15261. * // 浏览器
  15262. * <script type="text/javascript" src="{cdn}"></script>
  15263. * <script>
  15264. * const result = {namespace}.WebScaleOrientationType.HORIZONTALLABELSBELOW;
  15265. *
  15266. * </script>
  15267. * // ES6 Import
  15268. * import { WebScaleOrientationType } from '{npm}';
  15269. *
  15270. * const result = WebScaleOrientationType.HORIZONTALLABELSBELOW;
  15271. * ```
  15272. */
  15273. var WebScaleOrientationType = {
  15274. /** horizontal labels below. */
  15275. HORIZONTALLABELSBELOW: "HORIZONTALLABELSBELOW",
  15276. /** horizontal labels above. */
  15277. HORIZONTALLABELSABOVE: "HORIZONTALLABELSABOVE",
  15278. /** vertical labels left. */
  15279. VERTICALLABELSLEFT: "VERTICALLABELSLEFT",
  15280. /** vertical labels right. */
  15281. VERTICALLABELSRIGHT: "VERTICALLABELSRIGHT"
  15282. }
  15283. /**
  15284. * @enum WebScaleType
  15285. * @description Web 比例尺的样式。
  15286. * @category BaseTypes Constant
  15287. * @version 10.0.1
  15288. * @type {string}
  15289. * @usage
  15290. * ```
  15291. * // 浏览器
  15292. * <script type="text/javascript" src="{cdn}"></script>
  15293. * <script>
  15294. * const result = {namespace}.WebScaleType.LINE;
  15295. *
  15296. * </script>
  15297. * // ES6 Import
  15298. * import { WebScaleType } from '{npm}';
  15299. *
  15300. * const result = WebScaleType.LINE;
  15301. * ```
  15302. */
  15303. var WebScaleType = {
  15304. /** line. */
  15305. LINE: "LINE",
  15306. /** bar. */
  15307. BAR: "BAR",
  15308. /** bar sub. */
  15309. BAR_SUB: "BAR_SUB"
  15310. }
  15311. /**
  15312. * @enum WebScaleUnit
  15313. * @description Web 比例尺的单位制。
  15314. * @category BaseTypes Constant
  15315. * @version 10.0.1
  15316. * @type {string}
  15317. * @usage
  15318. * ```
  15319. * // 浏览器
  15320. * <script type="text/javascript" src="{cdn}"></script>
  15321. * <script>
  15322. * const result = {namespace}.WebScaleUnit.METER;
  15323. *
  15324. * </script>
  15325. * // ES6 Import
  15326. * import { WebScaleUnit } from '{npm}';
  15327. *
  15328. * const result = WebScaleUnit.METER;
  15329. * ```
  15330. */
  15331. var WebScaleUnit = {
  15332. /** 米。 */
  15333. METER: "METER",
  15334. /** 英尺。 */
  15335. FOOT: "FOOT",
  15336. /** 度。 */
  15337. DEGREES: "DEGREES"
  15338. }
  15339. ;// CONCATENATED MODULE: ./src/common/iServer/ServerGeometry.js
  15340. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  15341. * This program are made available under the terms of the Apache License, Version 2.0
  15342. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15343. /**
  15344. * @class ServerGeometry
  15345. * @deprecatedclass SuperMap.ServerGeometry
  15346. * @category iServer Data Feature
  15347. * @classdesc 服务端几何对象类。该类描述几何对象(矢量)的特征数据(坐标点对、几何对象的类型等)。基于服务端的空间分析、空间关系运算、查询等 GIS 服务功能使用服务端几何对象。
  15348. * @param {Object} options - 参数。
  15349. * @param {string} options.id - 服务端几何对象唯一标识符。
  15350. * @param {Array.<number>} options.parts - 服务端几何对象中各个子对象所包含的节点个数。
  15351. * @param {Array.<GeometryPoint>} options.points - 组成几何对象的节点的坐标对数组。
  15352. * @param {GeometryType} options.type - 几何对象的类型。
  15353. * @param {ServerStyle} [options.style] - 服务端几何对象的风格。
  15354. * @usage
  15355. */
  15356. class ServerGeometry {
  15357. constructor(options) {
  15358. /**
  15359. * @member {string} ServerGeometry.prototype.id
  15360. * @description 服务端几何对象唯一标识符。
  15361. */
  15362. this.id = 0;
  15363. /**
  15364. * @member {ServerStyle} [ServerGeometry.prototype.style]
  15365. * @description 服务端几何对象的风格(ServerStyle)。
  15366. */
  15367. this.style = null;
  15368. /**
  15369. * @member {Array.<number>} ServerGeometry.prototype.parts
  15370. * @description 服务端几何对象中各个子对象所包含的节点个数。<br>
  15371. * 1.几何对象从结构上可以分为简单几何对象和复杂几何对象。
  15372. * 简单几何对象与复杂几何对象的区别:简单的几何对象一般为单一对象,
  15373. * 而复杂的几何对象由多个简单对象组成或经过一定的空间运算之后产生,
  15374. * 如:矩形为简单的区域对象,而中空的矩形为复杂的区域对象。<br>
  15375. * 2.通常情况,一个简单几何对象的子对象就是它本身,
  15376. * 因此对于简单对象来说的该字段为长度为1的整型数组,
  15377. * 该字段的值就是这个简单对象节点的个数。
  15378. * 如果一个几何对象是由几个简单对象组合而成的,
  15379. * 例如,一个岛状几何对象由 3 个简单的多边形组成而成,
  15380. * 那么这个岛状的几何对象的 Parts 字段值就是一个长度为 3 的整型数组,
  15381. * 数组中每个成员的值分别代表这三个多边形所包含的节点个数。
  15382. */
  15383. this.parts = null;
  15384. /**
  15385. * @member {Array.<GeometryPoint>} ServerGeometry.prototype.points
  15386. * @description 组成几何对象的节点的坐标对数组。<br>
  15387. * 1.所有几何对象(点、线、面)都是由一些简单的点坐标组成的,
  15388. * 该字段存放了组成几何对象的点坐标的数组。
  15389. * 对于简单的面对象,他的起点和终点的坐标点相同。<br>
  15390. * 2.对于复杂的几何对象,根据 Parts 属性来确定每一个组成复杂几何对象的简单对象所对应的节点的个数,
  15391. * 从而确定 Points 字段中坐标对的分配归属问题。
  15392. */
  15393. this.points = null;
  15394. /**
  15395. * @member {GeometryType} ServerGeometry.prototype.type
  15396. * @description 几何对象的类型(GeometryType)。
  15397. */
  15398. this.type = null;
  15399. /**
  15400. * @member {Object} ServerGeometry.prototype.prjCoordSys
  15401. * @description 投影坐标参数,现仅在缓冲区分析中有效。
  15402. */
  15403. this.prjCoordSys = null;
  15404. if (options) {
  15405. Util_Util.extend(this, options);
  15406. }
  15407. this.CLASS_NAME = 'SuperMap.ServerGeometry';
  15408. }
  15409. /**
  15410. * @function ServerGeometry.prototype.destroy
  15411. * @description 释放资源,将引用资源的属性置空。
  15412. */
  15413. destroy() {
  15414. var me = this;
  15415. me.id = null;
  15416. me.style = null;
  15417. me.parts = null;
  15418. me.partTopo = null;
  15419. me.points = null;
  15420. me.type = null;
  15421. me.prjCoordSys = null;
  15422. }
  15423. /**
  15424. * @function ServerGeometry.prototype.toGeometry
  15425. * @description 将服务端几何对象 ServerGeometry 转换为客户端几何对象 Geometry。
  15426. * @returns {Geometry} 转换后的客户端几何对象。
  15427. */
  15428. toGeometry() {
  15429. var me = this,
  15430. geoType = me.type;
  15431. switch (geoType.toUpperCase()) {
  15432. case REST_GeometryType.POINT:
  15433. return me.toGeoPoint();
  15434. case REST_GeometryType.LINE:
  15435. return me.toGeoLine();
  15436. case REST_GeometryType.LINEM:
  15437. return me.toGeoLinem();
  15438. case REST_GeometryType.REGION:
  15439. return me.toGeoRegion();
  15440. case REST_GeometryType.POINTEPS:
  15441. return me.toGeoPoint();
  15442. case REST_GeometryType.LINEEPS:
  15443. return me.toGeoLineEPS();
  15444. case REST_GeometryType.REGIONEPS:
  15445. return me.toGeoRegionEPS();
  15446. case REST_GeometryType.GEOCOMPOUND:
  15447. return me.transformGeoCompound();
  15448. }
  15449. }
  15450. /**
  15451. * @function ServerGeometry.prototype.toGeoPoint
  15452. * @description 将服务端的点几何对象转换为客户端几何对象。包括 Point、MultiPoint。
  15453. * @returns {Geometry} 转换后的客户端几何对象。
  15454. */
  15455. toGeoPoint() {
  15456. var me = this,
  15457. geoParts = me.parts || [],
  15458. geoPoints = me.points || [],
  15459. len = geoParts.length;
  15460. if (len > 0) {
  15461. if (len === 1) {
  15462. return new Point(geoPoints[0].x, geoPoints[0].y);
  15463. } else {
  15464. var pointList = [];
  15465. for (let i = 0; i < len; i++) {
  15466. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  15467. }
  15468. return new MultiPoint(pointList);
  15469. }
  15470. } else {
  15471. return null;
  15472. }
  15473. }
  15474. /**
  15475. * @function ServerGeometry.prototype.toGeoLine
  15476. * @description 将服务端的线几何对象转换为客户端几何对象。包括 GeometryLinearRing、GeometryLineString、GeometryMultiLineString。
  15477. * @returns {Geometry} 转换后的客户端几何对象。
  15478. */
  15479. toGeoLine() {
  15480. var me = this,
  15481. geoParts = me.parts || [],
  15482. geoPoints = me.points || [],
  15483. len = geoParts.length;
  15484. if (len > 0) {
  15485. if (len === 1) {
  15486. let pointList = [];
  15487. for (let i = 0; i < geoParts[0]; i++) {
  15488. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  15489. }
  15490. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  15491. if (pointList[0].equals(pointList[geoParts[0] - 1])) {
  15492. return new LinearRing_LinearRing(pointList);
  15493. } else {
  15494. return new LineString(pointList);
  15495. }
  15496. } else {
  15497. let lineList = [];
  15498. for (let i = 0; i < len; i++) {
  15499. let pointList = [];
  15500. for (let j = 0; j < geoParts[i]; j++) {
  15501. pointList.push(new Point(geoPoints[j].x, geoPoints[j].y));
  15502. }
  15503. lineList.push(new LineString(pointList));
  15504. geoPoints.splice(0, geoParts[i]);
  15505. }
  15506. return new MultiLineString(lineList);
  15507. }
  15508. } else {
  15509. return null;
  15510. }
  15511. }
  15512. /**
  15513. * @function ServerGeometry.prototype.toGeoLineEPS
  15514. * @description 将服务端的线几何对象转换为客户端几何对象。包括 GeometryLinearRing、GeometryLineString、GeometryMultiLineString。
  15515. * @returns {Geometry} 转换后的客户端几何对象。
  15516. */
  15517. toGeoLineEPS() {
  15518. var me = this,
  15519. geoParts = me.parts || [],
  15520. geoPoints = me.points || [],
  15521. i,
  15522. j,
  15523. pointList,
  15524. lineList,
  15525. lineEPS,
  15526. len = geoParts.length;
  15527. if (len > 0) {
  15528. if (len === 1) {
  15529. for (i = 0, pointList = []; i < geoParts[0]; i++) {
  15530. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y, geoPoints[i].type));
  15531. }
  15532. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  15533. if (pointList[0].equals(pointList[geoParts[0] - 1])) {
  15534. lineEPS = LineString.createLineEPS(pointList);
  15535. return new LinearRing_LinearRing(lineEPS);
  15536. } else {
  15537. lineEPS = LineString.createLineEPS(pointList);
  15538. return new LineString(lineEPS);
  15539. }
  15540. } else {
  15541. for (i = 0, lineList = []; i < len; i++) {
  15542. for (j = 0, pointList = []; j < geoParts[i]; j++) {
  15543. pointList.push(new Point(geoPoints[j].x, geoPoints[j].y));
  15544. }
  15545. lineEPS = LineString.createLineEPS(pointList);
  15546. lineList.push(new LineString(lineEPS));
  15547. geoPoints.splice(0, geoParts[i]);
  15548. }
  15549. return new MultiLineString(lineList);
  15550. }
  15551. } else {
  15552. return null;
  15553. }
  15554. }
  15555. /**
  15556. * @function ServerGeometry.prototype.toGeoLinem
  15557. * @description 将服务端的路由线几何对象转换为客户端几何对象。包括 LinearRing、LineString、MultiLineString。
  15558. * @returns {Geometry} 转换后的客户端几何对象。
  15559. */
  15560. toGeoLinem() {
  15561. var me = this;
  15562. return Route.fromJson(me);
  15563. }
  15564. /**
  15565. * @function ServerGeometry.prototype.toGeoRegion
  15566. * @description 将服务端的面几何对象转换为客户端几何对象。类型为 GeometryPolygon。
  15567. * @returns {Geometry} 转换后的客户端几何对象。
  15568. */
  15569. toGeoRegion() {
  15570. var me = this,
  15571. geoParts = me.parts || [],
  15572. geoTopo = me.partTopo || [],
  15573. geoPoints = me.points || [],
  15574. len = geoParts.length;
  15575. if (len <= 0) {
  15576. return null;
  15577. }
  15578. var polygonArray = [];
  15579. var pointList = [];
  15580. if (len == 1) {
  15581. for (let i = 0; i < geoPoints.length; i++) {
  15582. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  15583. }
  15584. polygonArray.push(new Polygon_Polygon([new LinearRing_LinearRing(pointList)]));
  15585. return new MultiPolygon(polygonArray);
  15586. }
  15587. //处理复杂面
  15588. var CCWArray = [];
  15589. var areaArray = [];
  15590. var polygonArrayTemp = [];
  15591. var polygonBounds = [];
  15592. //polyon岛洞标识数组,初始都是岛。
  15593. var CCWIdent = [];
  15594. for (let i = 0, pointIndex = 0; i < len; i++) {
  15595. for (let j = 0; j < geoParts[i]; j++) {
  15596. pointList.push(new Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
  15597. }
  15598. pointIndex += geoParts[i];
  15599. var polygon = new Polygon_Polygon([new LinearRing_LinearRing(pointList)]);
  15600. pointList = [];
  15601. polygonArrayTemp.push(polygon);
  15602. if (geoTopo.length === 0) {
  15603. polygonBounds.push(polygon.getBounds());
  15604. }
  15605. CCWIdent.push(1);
  15606. areaArray.push(polygon.getArea());
  15607. }
  15608. //iServer 9D新增字段
  15609. if (geoTopo.length === 0) {
  15610. //根据面积排序
  15611. ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
  15612. //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
  15613. // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
  15614. // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
  15615. //目标polygon索引列表 -1标示没有被任何polygon包含,
  15616. var targetArray = [];
  15617. for (let i = 1; i < polygonArrayTemp.length; i++) {
  15618. for (let j = i - 1; j >= 0; j--) {
  15619. targetArray[i] = -1;
  15620. if (polygonBounds[j].containsBounds(polygonBounds[i])) {
  15621. CCWIdent[i] = CCWIdent[j] * -1;
  15622. if (CCWIdent[i] < 0) {
  15623. targetArray[i] = j;
  15624. }
  15625. break;
  15626. }
  15627. }
  15628. }
  15629. for (let i = 0; i < polygonArrayTemp.length; i++) {
  15630. if (CCWIdent[i] > 0) {
  15631. polygonArray.push(polygonArrayTemp[i]);
  15632. } else {
  15633. polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
  15634. polygonArrayTemp[i].components
  15635. );
  15636. //占位
  15637. polygonArray.push('');
  15638. }
  15639. }
  15640. } else {
  15641. polygonArray = new Array();
  15642. for (let i = 0; i < polygonArrayTemp.length; i++) {
  15643. if (geoTopo[i] && geoTopo[i] == -1) {
  15644. CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
  15645. } else {
  15646. if (CCWArray.length > 0 && polygonArray.length > 0) {
  15647. polygonArray[polygonArray.length - 1].components =
  15648. polygonArray[polygonArray.length - 1].components.concat(CCWArray);
  15649. CCWArray = [];
  15650. }
  15651. polygonArray.push(polygonArrayTemp[i]);
  15652. }
  15653. if (i == len - 1) {
  15654. var polyLength = polygonArray.length;
  15655. if (polyLength) {
  15656. polygonArray[polyLength - 1].components =
  15657. polygonArray[polyLength - 1].components.concat(CCWArray);
  15658. } else {
  15659. for (let k = 0, length = CCWArray.length; k < length; k++) {
  15660. polygonArray.push(new Polygon_Polygon(CCWArray));
  15661. }
  15662. }
  15663. }
  15664. }
  15665. }
  15666. return new MultiPolygon(polygonArray);
  15667. }
  15668. /**
  15669. * @function ServerGeometry.prototype.toGeoRegionEPS
  15670. * @description 将服务端的面几何对象转换为客户端几何对象。类型为 Polygon。
  15671. * @returns {Geometry} 转换后的客户端几何对象。
  15672. */
  15673. toGeoRegionEPS() {
  15674. var me = this,
  15675. geoParts = me.parts || [],
  15676. geoTopo = me.partTopo || [],
  15677. geoPoints = me.points || [],
  15678. len = geoParts.length;
  15679. if (len <= 0) {
  15680. return null;
  15681. }
  15682. var polygonArray = [];
  15683. var pointList = [];
  15684. var lineEPS;
  15685. if (len == 1) {
  15686. for (var i = 0; i < geoPoints.length; i++) {
  15687. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  15688. }
  15689. lineEPS = LineString.createLineEPS(pointList);
  15690. polygonArray.push(new Polygon_Polygon([new LinearRing_LinearRing(lineEPS)]));
  15691. return new MultiPolygon(polygonArray);
  15692. }
  15693. //处理复杂面
  15694. var CCWArray = [];
  15695. var areaArray = [];
  15696. var polygonArrayTemp = [];
  15697. var polygonBounds = [];
  15698. //polyon岛洞标识数组,初始都是岛。
  15699. var CCWIdent = [];
  15700. for (let i = 0, pointIndex = 0; i < len; i++) {
  15701. for (let j = 0; j < geoParts[i]; j++) {
  15702. pointList.push(new Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
  15703. }
  15704. pointIndex += geoParts[i];
  15705. lineEPS = LineString.createLineEPS(pointList);
  15706. var polygon = new Polygon_Polygon([new LinearRing_LinearRing(lineEPS)]);
  15707. pointList = [];
  15708. polygonArrayTemp.push(polygon);
  15709. if (geoTopo.length === 0) {
  15710. polygonBounds.push(polygon.getBounds());
  15711. }
  15712. CCWIdent.push(1);
  15713. areaArray.push(polygon.getArea());
  15714. }
  15715. //iServer 9D新增字段
  15716. if (geoTopo.length === 0) {
  15717. //根据面积排序
  15718. ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
  15719. //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
  15720. // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
  15721. // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
  15722. //目标polygon索引列表 -1标示没有被任何polygon包含,
  15723. var targetArray = [];
  15724. for (let i = 1; i < polygonArrayTemp.length; i++) {
  15725. for (let j = i - 1; j >= 0; j--) {
  15726. targetArray[i] = -1;
  15727. if (polygonBounds[j].containsBounds(polygonBounds[i])) {
  15728. CCWIdent[i] = CCWIdent[j] * -1;
  15729. if (CCWIdent[i] < 0) {
  15730. targetArray[i] = j;
  15731. }
  15732. break;
  15733. }
  15734. }
  15735. }
  15736. for (let i = 0; i < polygonArrayTemp.length; i++) {
  15737. if (CCWIdent[i] > 0) {
  15738. polygonArray.push(polygonArrayTemp[i]);
  15739. } else {
  15740. polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
  15741. polygonArrayTemp[i].components
  15742. );
  15743. //占位
  15744. polygonArray.push('');
  15745. }
  15746. }
  15747. } else {
  15748. polygonArray = new Array();
  15749. for (let i = 0; i < polygonArrayTemp.length; i++) {
  15750. if (geoTopo[i] && geoTopo[i] == -1) {
  15751. CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
  15752. } else {
  15753. if (CCWArray.length > 0 && polygonArray.length > 0) {
  15754. polygonArray[polygonArray.length - 1].components =
  15755. polygonArray[polygonArray.length - 1].components.concat(CCWArray);
  15756. CCWArray = [];
  15757. }
  15758. polygonArray.push(polygonArrayTemp[i]);
  15759. }
  15760. if (i == len - 1) {
  15761. var polyLength = polygonArray.length;
  15762. if (polyLength) {
  15763. polygonArray[polyLength - 1].components =
  15764. polygonArray[polyLength - 1].components.concat(CCWArray);
  15765. } else {
  15766. for (let k = 0, length = CCWArray.length; k < length; k++) {
  15767. polygonArray.push(new Polygon_Polygon(CCWArray));
  15768. }
  15769. }
  15770. }
  15771. }
  15772. }
  15773. return new MultiPolygon(polygonArray);
  15774. }
  15775. transformGeoCompound() {
  15776. const me = this,
  15777. geoParts = me.geoParts || [],
  15778. len = geoParts.length;
  15779. if (len <= 0) {
  15780. return null;
  15781. }
  15782. const geometryList = [];
  15783. for (let index = 0; index < len; index++) {
  15784. const geometry = geoParts[index];
  15785. geometryList.push(new ServerGeometry(geometry).toGeometry());
  15786. }
  15787. return new Collection(geometryList);
  15788. }
  15789. /**
  15790. * @function ServerGeometry.prototype.fromJson
  15791. * @description 将 JSON 对象表示服务端几何对象转换为 ServerGeometry。
  15792. * @param {Object} jsonObject - 要转换的 JSON 对象。
  15793. * @returns {ServerGeometry} 转换后的 ServerGeometry 对象。
  15794. */
  15795. static fromJson(jsonObject) {
  15796. if (!jsonObject) {
  15797. return;
  15798. }
  15799. return new ServerGeometry({
  15800. id: jsonObject.id,
  15801. style: ServerStyle.fromJson(jsonObject.style),
  15802. parts: jsonObject.parts,
  15803. partTopo: jsonObject.partTopo,
  15804. points: jsonObject.points,
  15805. center: jsonObject.center,
  15806. length: jsonObject.length,
  15807. maxM: jsonObject.maxM,
  15808. minM: jsonObject.minM,
  15809. type: jsonObject.type
  15810. });
  15811. }
  15812. /**
  15813. * @function ServerGeometry.prototype.fromGeometry
  15814. * @description 将客户端 Geometry 转换成服务端 ServerGeometry。
  15815. * @param {Geometry} geometry - 要转换的客户端 Geometry 对象。
  15816. * @returns {ServerGeometry} 转换后的 ServerGeometry 对象。
  15817. */
  15818. static fromGeometry(geometry) {
  15819. if (!geometry) {
  15820. return;
  15821. }
  15822. var id = 0,
  15823. parts = [],
  15824. points = [],
  15825. type = null,
  15826. icomponents = geometry.components,
  15827. className = geometry.CLASS_NAME,
  15828. prjCoordSys = { epsgCode: geometry.SRID };
  15829. if (!isNaN(geometry.id)) {
  15830. id = geometry.id;
  15831. }
  15832. //坑爹的改法,没法,为了支持态势标绘,有时间就得全改
  15833. if (
  15834. className != 'SuperMap.Geometry.LinearRing' &&
  15835. className != 'SuperMap.Geometry.LineString' &&
  15836. (geometry instanceof MultiPoint || geometry instanceof MultiLineString)
  15837. ) {
  15838. let ilen = icomponents.length;
  15839. for (let i = 0; i < ilen; i++) {
  15840. const vertices = icomponents[i].getVertices();
  15841. let partPointsCount = vertices.length;
  15842. parts.push(partPointsCount);
  15843. for (let j = 0; j < partPointsCount; j++) {
  15844. points.push(new Point(vertices[j].x, vertices[j].y));
  15845. }
  15846. }
  15847. //这里className不是多点就全部是算线
  15848. type = className == 'SuperMap.Geometry.MultiPoint' ? REST_GeometryType.POINT : REST_GeometryType.LINE;
  15849. } else if (geometry instanceof MultiPolygon) {
  15850. let ilen = icomponents.length;
  15851. for (let i = 0; i < ilen; i++) {
  15852. let polygon = icomponents[i],
  15853. linearRingOfPolygon = polygon.components,
  15854. linearRingOfPolygonLen = linearRingOfPolygon.length;
  15855. for (let j = 0; j < linearRingOfPolygonLen; j++) {
  15856. const vertices = linearRingOfPolygon[j].getVertices();
  15857. const partPointsCount = vertices.length + 1;
  15858. parts.push(partPointsCount);
  15859. for (let k = 0; k < partPointsCount - 1; k++) {
  15860. points.push(new Point(vertices[k].x, vertices[k].y));
  15861. }
  15862. points.push(
  15863. new Point(vertices[0].x, vertices[0].y)
  15864. );
  15865. }
  15866. }
  15867. type = REST_GeometryType.REGION;
  15868. } else if (geometry instanceof Polygon_Polygon) {
  15869. let ilen = icomponents.length;
  15870. for (let i = 0; i < ilen; i++) {
  15871. const vertices = icomponents[i].getVertices();
  15872. let partPointsCount = vertices.length + 1;
  15873. parts.push(partPointsCount);
  15874. for (let j = 0; j < partPointsCount - 1; j++) {
  15875. points.push(new Point(vertices[j].x, vertices[j].y));
  15876. }
  15877. points.push(new Point(vertices[0].x, vertices[0].y));
  15878. }
  15879. type = REST_GeometryType.REGION;
  15880. } else {
  15881. const vertices = geometry.getVertices();
  15882. let geometryVerticesCount = vertices.length;
  15883. for (let j = 0; j < geometryVerticesCount; j++) {
  15884. points.push(new Point(vertices[j].x, vertices[j].y));
  15885. }
  15886. if (geometry instanceof LinearRing_LinearRing) {
  15887. points.push(new Point(vertices[0].x, vertices[0].y));
  15888. geometryVerticesCount++;
  15889. }
  15890. parts.push(geometryVerticesCount);
  15891. type = geometry instanceof Point ? REST_GeometryType.POINT : REST_GeometryType.LINE;
  15892. }
  15893. return new ServerGeometry({
  15894. id: id,
  15895. style: null,
  15896. parts: parts,
  15897. points: points,
  15898. type: type,
  15899. prjCoordSys: prjCoordSys
  15900. });
  15901. }
  15902. /**
  15903. * @function ServerGeometry.prototype.IsClockWise
  15904. * @description 判断 linearRing 中的点的顺序。返回值大于 0,逆时针;小于 0,顺时针。
  15905. * @param {Geometry} geometry - 要转换的客户端 Geometry 对象。
  15906. * @returns {number} 返回值大于 0,逆时针;小于 0,顺时针。
  15907. */
  15908. static IsClockWise(points) {
  15909. var length = points.length;
  15910. if (length < 3) {
  15911. return 0.0;
  15912. }
  15913. var s = points[0].y * (points[length - 1].x - points[1].x);
  15914. points.push(points[0]);
  15915. for (var i = 1; i < length; i++) {
  15916. s += points[i].y * (points[i - 1].x - points[i + 1].x);
  15917. }
  15918. return s * 0.5;
  15919. }
  15920. static bubbleSort(areaArray, pointList, geoTopo, polygonBounds) {
  15921. for (var i = 0; i < areaArray.length; i++) {
  15922. for (var j = 0; j < areaArray.length; j++) {
  15923. if (areaArray[i] > areaArray[j]) {
  15924. var d = areaArray[j];
  15925. areaArray[j] = areaArray[i];
  15926. areaArray[i] = d;
  15927. var b = pointList[j];
  15928. pointList[j] = pointList[i];
  15929. pointList[i] = b;
  15930. if (geoTopo && geoTopo.length > 0) {
  15931. var c = geoTopo[j];
  15932. geoTopo[j] = geoTopo[i];
  15933. geoTopo[i] = c;
  15934. }
  15935. if (polygonBounds && polygonBounds.length > 0) {
  15936. var f = polygonBounds[j];
  15937. polygonBounds[j] = polygonBounds[i];
  15938. polygonBounds[i] = f;
  15939. }
  15940. }
  15941. }
  15942. }
  15943. }
  15944. }
  15945. ;// CONCATENATED MODULE: ./src/common/format/GeoJSON.js
  15946. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  15947. * This program are made available under the terms of the Apache License, Version 2.0
  15948. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15949. /**
  15950. * @class GeoJSONFormat
  15951. * @aliasclass Format.GeoJSON
  15952. * @deprecatedclass SuperMap.Format.GeoJSON
  15953. * @classdesc GeoJSON 的读和写。使用 {@link GeoJSONObject} 构造器创建一个 GeoJSON 解析器。
  15954. * @category BaseTypes Format
  15955. * @param {Object} [options] - 可选参数。
  15956. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  15957. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  15958. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  15959. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  15960. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  15961. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  15962. * @param {boolean} [options.ignoreExtraDims=true] - 忽略维度超过 2 的几何要素。
  15963. * @extends {JSONFormat}
  15964. * @usage
  15965. */
  15966. class GeoJSON extends JSONFormat {
  15967. constructor(options) {
  15968. super(options);
  15969. /**
  15970. * @member {boolean} [GeoJSONFormat.prototype.ignoreExtraDims=true]
  15971. * @description 忽略维度超过 2 的几何要素。
  15972. */
  15973. this.ignoreExtraDims = true;
  15974. this.CLASS_NAME = "SuperMap.Format.GeoJSON";
  15975. /**
  15976. * @member {Object} GeoJSONFormat.prototype.parseCoords
  15977. * @private
  15978. * @description 一个属性名对应着 GeoJSON 对象的几何类型的对象。每个属性其实都是一个实际上做解析用的方法。
  15979. */
  15980. this.parseCoords = {
  15981. /**
  15982. * @function GeoJSONFormat.parseCoords.point
  15983. * @description 将一组坐标转成一个 {@link Geometry} 对象。
  15984. * @param {Object} array - GeoJSON 片段中的一组坐标。
  15985. * @returns {Geometry} 一个几何对象。
  15986. */
  15987. "point": function (array) {
  15988. if (this.ignoreExtraDims === false &&
  15989. array.length != 2) {
  15990. throw "Only 2D points are supported: " + array;
  15991. }
  15992. return new Point(array[0], array[1]);
  15993. },
  15994. /**
  15995. * @function GeoJSONFormat.parseCoords.multipoint
  15996. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  15997. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  15998. * @returns {Geometry} 一个几何对象。
  15999. */
  16000. "multipoint": function (array) {
  16001. var points = [];
  16002. var p = null;
  16003. for (var i = 0, len = array.length; i < len; ++i) {
  16004. try {
  16005. p = this.parseCoords["point"].apply(this, [array[i]]);
  16006. } catch (err) {
  16007. throw err;
  16008. }
  16009. points.push(p);
  16010. }
  16011. return new MultiPoint(points);
  16012. },
  16013. /**
  16014. * @function GeoJSONFormat.parseCoords.linestring
  16015. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  16016. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  16017. * @returns {Geometry} 一个几何对象。
  16018. */
  16019. "linestring": function (array) {
  16020. var points = [];
  16021. var p = null;
  16022. for (var i = 0, len = array.length; i < len; ++i) {
  16023. try {
  16024. p = this.parseCoords["point"].apply(this, [array[i]]);
  16025. } catch (err) {
  16026. throw err;
  16027. }
  16028. points.push(p);
  16029. }
  16030. return new LineString(points);
  16031. },
  16032. /**
  16033. * @function GeoJSONFormat.parseCoords.multilinestring
  16034. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  16035. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  16036. * @returns {Geometry} 一个几何对象。
  16037. */
  16038. "multilinestring": function (array) {
  16039. var lines = [];
  16040. var l = null;
  16041. for (var i = 0, len = array.length; i < len; ++i) {
  16042. try {
  16043. l = this.parseCoords["linestring"].apply(this, [array[i]]);
  16044. } catch (err) {
  16045. throw err;
  16046. }
  16047. lines.push(l);
  16048. }
  16049. return new MultiLineString(lines);
  16050. },
  16051. /**
  16052. * @function GeoJSONFormat.parseCoords.polygon
  16053. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  16054. * @returns {Geometry} 一个几何对象。
  16055. */
  16056. "polygon": function (array) {
  16057. var rings = [];
  16058. var r, l;
  16059. for (var i = 0, len = array.length; i < len; ++i) {
  16060. try {
  16061. l = this.parseCoords["linestring"].apply(this, [array[i]]);
  16062. } catch (err) {
  16063. throw err;
  16064. }
  16065. r = new LinearRing_LinearRing(l.components);
  16066. rings.push(r);
  16067. }
  16068. return new Polygon_Polygon(rings);
  16069. },
  16070. /**
  16071. * @function GeoJSONFormat.parseCoords.multipolygon
  16072. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  16073. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  16074. * @returns {Geometry} 一个几何对象。
  16075. */
  16076. "multipolygon": function (array) {
  16077. var polys = [];
  16078. var p = null;
  16079. for (var i = 0, len = array.length; i < len; ++i) {
  16080. try {
  16081. p = this.parseCoords["polygon"].apply(this, [array[i]]);
  16082. } catch (err) {
  16083. throw err;
  16084. }
  16085. polys.push(p);
  16086. }
  16087. return new MultiPolygon(polys);
  16088. },
  16089. /**
  16090. * @function GeoJSONFormat.parseCoords.box
  16091. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  16092. * @param {Array} array - GeoJSON 片段中的坐标组数组。
  16093. * @returns {Geometry} 一个几何对象。
  16094. */
  16095. "box": function (array) {
  16096. if (array.length != 2) {
  16097. throw "GeoJSON box coordinates must have 2 elements";
  16098. }
  16099. return new Polygon_Polygon([
  16100. new LinearRing_LinearRing([
  16101. new Point(array[0][0], array[0][1]),
  16102. new Point(array[1][0], array[0][1]),
  16103. new Point(array[1][0], array[1][1]),
  16104. new Point(array[0][0], array[1][1]),
  16105. new Point(array[0][0], array[0][1])
  16106. ])
  16107. ]);
  16108. }
  16109. };
  16110. /**
  16111. * @member {Object} GeoJSONFormat.prototype.extract
  16112. * @private
  16113. * @description 一个属性名对应着GeoJSON类型的对象。其值为相应的实际的解析方法。
  16114. */
  16115. this.extract = {
  16116. /**
  16117. * @function GeoJSONFormat.extract.feature
  16118. * @description 返回一个表示单个要素对象的 GeoJSON 的一部分。
  16119. * @param {SuperMap.ServerFeature} feature - iServer 要素对象。
  16120. * @returns {Object} 一个表示点的对象。
  16121. */
  16122. 'feature': function (feature) {
  16123. var geom = this.extract.geometry.apply(this, [feature.geometry]);
  16124. var json = {
  16125. "type": "Feature",
  16126. "properties": this.createAttributes(feature),
  16127. "geometry": geom
  16128. };
  16129. if (feature.geometry && feature.geometry.type === 'TEXT') {
  16130. json.properties.texts = feature.geometry.texts;
  16131. json.properties.textStyle = feature.geometry.textStyle;
  16132. }
  16133. if (feature.fid) {
  16134. json.id = feature.fid;
  16135. }
  16136. if (feature.ID) {
  16137. json.id = feature.ID;
  16138. }
  16139. return json;
  16140. },
  16141. /**
  16142. * @function GeoJSONFormat.extract.geometry
  16143. * @description 返回一个表示单个几何对象的 GeoJSON 的一部分。
  16144. * @param {Object} geometry - iServer 几何对象。
  16145. * @returns {Object} 一个表示几何体的对象。
  16146. */
  16147. 'geometry': function (geometry) {
  16148. if (geometry == null) {
  16149. return null;
  16150. }
  16151. if (!geometry.parts && geometry.points) {
  16152. geometry.parts = [geometry.points.length];
  16153. }
  16154. var geo = geometry.hasOwnProperty('geometryType')
  16155. ? geometry
  16156. : new ServerGeometry(geometry).toGeometry() || geometry;
  16157. var geometryType = geo.geometryType || geo.type;
  16158. var data;
  16159. if (geometryType === "LinearRing") {
  16160. geometryType = "LineString";
  16161. }
  16162. if (geometryType === "LINEM") {
  16163. geometryType = "MultiLineString";
  16164. }
  16165. data = this.extract[geometryType.toLowerCase()].apply(this, [geo]);
  16166. geometryType = geometryType === 'TEXT' ? 'Point' : geometryType;
  16167. var json;
  16168. if (geometryType === "Collection") {
  16169. json = {
  16170. "type": "GeometryCollection",
  16171. "geometries": data
  16172. };
  16173. } else {
  16174. json = {
  16175. "type": geometryType,
  16176. "coordinates": data
  16177. };
  16178. }
  16179. return json;
  16180. },
  16181. /**
  16182. * @function GeoJSONFormat.extract.point
  16183. * @description 从一个点对象中返回一个坐标组。
  16184. * @param {GeometryPoint} point - 一个点对象。
  16185. * @returns {Array} 一个表示一个点的坐标组。
  16186. */
  16187. 'point': function (point) {
  16188. var p = [point.x, point.y];
  16189. for (var name in point) {
  16190. if (name !== "x" && name !== "y" && point[name] !== null && !isNaN(point[name])) {
  16191. p.push(point[name]);
  16192. }
  16193. }
  16194. return p;
  16195. },
  16196. /**
  16197. * @function GeoJSONFormat.extract.point
  16198. * @description 从一个文本对象中返回一个坐标组。
  16199. * @param {Object} geo - 一个文本对象。
  16200. * @returns {Array} 一个表示一个点的坐标组。
  16201. */
  16202. 'text': function (geo) {
  16203. return [geo.points[0].x, geo.points[0].y];
  16204. },
  16205. /**
  16206. * @function GeoJSONFormat.extract.multipoint
  16207. * @description 从一个多点对象中返一个坐标组数组。
  16208. * @param {GeometryMultiPoint} multipoint - 多点对象。
  16209. * @returns {Array} 一个表示多点的坐标组数组。
  16210. */
  16211. 'multipoint': function (multipoint) {
  16212. var array = [];
  16213. for (var i = 0, len = multipoint.components.length; i < len; ++i) {
  16214. array.push(this.extract.point.apply(this, [multipoint.components[i]]));
  16215. }
  16216. return array;
  16217. },
  16218. /**
  16219. * @function GeoJSONFormat.extract.linestring
  16220. * @description 从一个线对象中返回一个坐标组数组。
  16221. * @param {Linestring} linestring - 线对象。
  16222. * @returns {Array} 一个表示线对象的坐标组数组。
  16223. */
  16224. 'linestring': function (linestring) {
  16225. var array = [];
  16226. for (var i = 0, len = linestring.components.length; i < len; ++i) {
  16227. array.push(this.extract.point.apply(this, [linestring.components[i]]));
  16228. }
  16229. return array;
  16230. },
  16231. /**
  16232. * @function GeoJSONFormat.extract.multilinestring
  16233. * @description 从一个多线对象中返回一个线数组。
  16234. * @param {GeometryMultiLineString} multilinestring - 多线对象。
  16235. *
  16236. * @returns {Array} 一个表示多线的线数组。
  16237. */
  16238. 'multilinestring': function (multilinestring) {
  16239. var array = [];
  16240. for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
  16241. array.push(this.extract.linestring.apply(this, [multilinestring.components[i]]));
  16242. }
  16243. return array;
  16244. },
  16245. /**
  16246. * @function GeoJSONFormat.extract.polygon
  16247. * @description 从一个面对象中返回一组线环。
  16248. * @param {GeometryPolygon} polygon - 面对象。
  16249. * @returns {Array} 一组表示面的线环。
  16250. */
  16251. 'polygon': function (polygon) {
  16252. var array = [];
  16253. for (var i = 0, len = polygon.components.length; i < len; ++i) {
  16254. array.push(this.extract.linestring.apply(this, [polygon.components[i]]));
  16255. }
  16256. return array;
  16257. },
  16258. /**
  16259. * @function GeoJSONFormat.extract.multipolygon
  16260. * @description 从一个多面对象中返回一组面。
  16261. * @param {GeometryMultiPolygon} multipolygon - 多面对象。
  16262. * @returns {Array} 一组表示多面的面。
  16263. */
  16264. 'multipolygon': function (multipolygon) {
  16265. var array = [];
  16266. for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
  16267. array.push(this.extract.polygon.apply(this, [multipolygon.components[i]]));
  16268. }
  16269. return array;
  16270. },
  16271. /**
  16272. * @function GeoJSONFormat.extract.collection
  16273. * @description 从一个几何要素集合中一组几何要素数组。
  16274. * @param {GeometryCollection} collection - 几何要素集合。
  16275. * @returns {Array} 一组表示几何要素集合的几何要素数组。
  16276. */
  16277. 'collection': function (collection) {
  16278. var len = collection.components.length;
  16279. var array = new Array(len);
  16280. for (var i = 0; i < len; ++i) {
  16281. array[i] = this.extract.geometry.apply(this, [collection.components[i]]);
  16282. }
  16283. return array;
  16284. }
  16285. };
  16286. }
  16287. /**
  16288. * @function GeoJSONFormat.prototype.read
  16289. * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为 SuperMap Feature 对象。
  16290. * @param {GeoJSONObject} json - GeoJSON 对象。
  16291. * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
  16292. * @param {function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
  16293. * @returns {Object} 返回值依赖于 type 参数的值。
  16294. * -如果 type 等于 "FeatureCollection",返回值将会是 {@link FeatureVector} 数组。
  16295. * -如果 type 为 "Geometry",输入的 JSON 对象必须表示一个唯一的几何体,然后返回值就会是 {@link Geometry}。
  16296. * -如果 type 为 "Feature",输入的 JSON 对象也必须表示的一个要素,这样返回值才会是 {@link FeatureVector}。
  16297. */
  16298. read(json, type, filter) {
  16299. type = (type) ? type : "FeatureCollection";
  16300. var results = null;
  16301. var obj = null;
  16302. if (typeof json == "string") {
  16303. obj = super.read(json, filter);
  16304. } else {
  16305. obj = json;
  16306. }
  16307. if (!obj) {
  16308. //console.error("Bad JSON: " + json);
  16309. } else if (typeof (obj.type) != "string") {
  16310. //console.error("Bad GeoJSON - no type: " + json);
  16311. } else if (this.isValidType(obj, type)) {
  16312. switch (type) {
  16313. case "Geometry":
  16314. try {
  16315. results = this.parseGeometry(obj);
  16316. } catch (err) {
  16317. //console.error(err);
  16318. }
  16319. break;
  16320. case "Feature":
  16321. try {
  16322. results = this.parseFeature(obj);
  16323. results.type = "Feature";
  16324. } catch (err) {
  16325. //console.error(err);
  16326. }
  16327. break;
  16328. case "FeatureCollection":
  16329. // for type FeatureCollection, we allow input to be any type
  16330. results = [];
  16331. switch (obj.type) {
  16332. case "Feature":
  16333. try {
  16334. results.push(this.parseFeature(obj));
  16335. } catch (err) {
  16336. results = null;
  16337. //console.error(err);
  16338. }
  16339. break;
  16340. case "FeatureCollection":
  16341. for (var i = 0, len = obj.features.length; i < len; ++i) {
  16342. try {
  16343. results.push(this.parseFeature(obj.features[i]));
  16344. } catch (err) {
  16345. results = null;
  16346. // console.error(err);
  16347. }
  16348. }
  16349. break;
  16350. default:
  16351. try {
  16352. var geom = this.parseGeometry(obj);
  16353. results.push(new Vector(geom));
  16354. } catch (err) {
  16355. results = null;
  16356. //console.error(err);
  16357. }
  16358. }
  16359. break;
  16360. default:
  16361. break;
  16362. }
  16363. }
  16364. return results;
  16365. }
  16366. /**
  16367. * @function GeoJSONFormat.prototype.write
  16368. * @description iServer Geometry JSON 对象 转 GeoJSON对象字符串。
  16369. * @param {Object} obj - iServer Geometry JSON 对象。
  16370. * @param {boolean} [pretty=false] - 是否使用换行和缩进来控制输出。
  16371. * @returns {GeoJSONObject} 一个 GeoJSON 字符串,它表示了输入的几何对象,要素对象,或者要素对象数组。
  16372. */
  16373. write(obj, pretty) {
  16374. return super.write(this.toGeoJSON(obj), pretty);
  16375. }
  16376. /**
  16377. * @function GeoJSONFormat.prototype.fromGeoJSON
  16378. * @version 9.1.1
  16379. * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为iServer Feature JSON。
  16380. * @param {GeoJSONObject} json - GeoJSON 对象。
  16381. * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
  16382. * @param {function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
  16383. * @returns {Object} iServer Feature JSON。
  16384. */
  16385. fromGeoJSON(json, type, filter) {
  16386. let feature = this.read(json, type, filter);
  16387. if (!Util_Util.isArray(feature)) {
  16388. return this._toiSevrerFeature(feature);
  16389. }
  16390. return feature.map((element) => {
  16391. return this._toiSevrerFeature(element);
  16392. })
  16393. }
  16394. /**
  16395. * @function GeoJSONFormat.prototype.toGeoJSON
  16396. * @version 9.1.1
  16397. * @description 将 iServer Feature JSON 对象转换为 GeoJSON 对象。
  16398. * @param {Object} obj - iServer Feature JSON。
  16399. * @returns {GeoJSONObject} GeoJSON 对象。
  16400. */
  16401. toGeoJSON(obj) {
  16402. var geojson = {
  16403. "type": null
  16404. };
  16405. if (Util_Util.isArray(obj)) {
  16406. geojson.type = "FeatureCollection";
  16407. var numFeatures = obj.length;
  16408. geojson.features = new Array(numFeatures);
  16409. for (var i = 0; i < numFeatures; ++i) {
  16410. var element = obj[i];
  16411. if (isGeometry(element)) {
  16412. let feature = {};
  16413. feature.geometry = element;
  16414. geojson.features[i] = this.extract.feature.apply(this, [feature]);
  16415. } else {
  16416. geojson.features[i] = this.extract.feature.apply(this, [element]);
  16417. }
  16418. }
  16419. } else if (isGeometry(obj)) {
  16420. let feature = {};
  16421. feature.geometry = obj;
  16422. geojson = this.extract.feature.apply(this, [feature]);
  16423. } else {
  16424. geojson = this.extract.feature.apply(this, [obj]);
  16425. }
  16426. function isGeometry(input) {
  16427. return (input.hasOwnProperty("parts") && input.hasOwnProperty("points")) || input.hasOwnProperty("geoParts");
  16428. }
  16429. return geojson;
  16430. }
  16431. /**
  16432. * @function GeoJSONFormat.prototype.isValidType
  16433. * @description 检查一个 GeoJSON 对象是否和给定的类型相符的合法的对象。
  16434. * @returns {boolean} GeoJSON 是否是给定类型的合法对象。
  16435. * @private
  16436. */
  16437. isValidType(obj, type) {
  16438. var valid = false;
  16439. switch (type) {
  16440. case "Geometry":
  16441. if (Util_Util.indexOf(
  16442. ["Point", "MultiPoint", "LineString", "MultiLineString",
  16443. "Polygon", "MultiPolygon", "Box", "GeometryCollection"
  16444. ],
  16445. obj.type) == -1) {
  16446. // unsupported geometry type
  16447. //console.error("Unsupported geometry type: " +
  16448. // obj.type);
  16449. } else {
  16450. valid = true;
  16451. }
  16452. break;
  16453. case "FeatureCollection":
  16454. // allow for any type to be converted to a feature collection
  16455. valid = true;
  16456. break;
  16457. default:
  16458. // for Feature types must match
  16459. if (obj.type == type) {
  16460. valid = true;
  16461. } else {
  16462. //console.error("Cannot convert types from " +
  16463. //obj.type + " to " + type);
  16464. }
  16465. }
  16466. return valid;
  16467. }
  16468. /**
  16469. * @function GeoJSONFormat.prototype.parseFeature
  16470. * @description 将一个 GeoJSON 中的 feature 转化成 {@link FeatureVector}> 对象。
  16471. * @private
  16472. * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
  16473. * @returns {FeatureVector} 一个要素。
  16474. */
  16475. parseFeature(obj) {
  16476. var feature, geometry, attributes, bbox;
  16477. attributes = (obj.properties) ? obj.properties : {};
  16478. bbox = (obj.geometry && obj.geometry.bbox) || obj.bbox;
  16479. try {
  16480. geometry = this.parseGeometry(obj.geometry);
  16481. } catch (err) {
  16482. // deal with bad geometries
  16483. throw err;
  16484. }
  16485. feature = new Vector(geometry, attributes);
  16486. if (bbox) {
  16487. feature.bounds = Bounds.fromArray(bbox);
  16488. }
  16489. if (obj.id) {
  16490. feature.geometry.id = obj.id;
  16491. feature.fid = obj.id;
  16492. }
  16493. return feature;
  16494. }
  16495. /**
  16496. * @function GeoJSONFormat.prototype.parseGeometry
  16497. * @description 将一个 GeoJSON 中的几何要素转化成 {@link Geometry} 对象。
  16498. * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
  16499. * @returns {Geometry} 一个几何要素。
  16500. * @private
  16501. */
  16502. parseGeometry(obj) {
  16503. if (obj == null) {
  16504. return null;
  16505. }
  16506. var geometry;
  16507. if (obj.type == "GeometryCollection") {
  16508. if (!(Util_Util.isArray(obj.geometries))) {
  16509. throw "GeometryCollection must have geometries array: " + obj;
  16510. }
  16511. var numGeom = obj.geometries.length;
  16512. var components = new Array(numGeom);
  16513. for (var i = 0; i < numGeom; ++i) {
  16514. components[i] = this.parseGeometry.apply(
  16515. this, [obj.geometries[i]]
  16516. );
  16517. }
  16518. geometry = new Collection(components);
  16519. } else {
  16520. if (!(Util_Util.isArray(obj.coordinates))) {
  16521. throw "Geometry must have coordinates array: " + obj;
  16522. }
  16523. if (!this.parseCoords[obj.type.toLowerCase()]) {
  16524. throw "Unsupported geometry type: " + obj.type;
  16525. }
  16526. try {
  16527. geometry = this.parseCoords[obj.type.toLowerCase()].apply(
  16528. this, [obj.coordinates]
  16529. );
  16530. } catch (err) {
  16531. // deal with bad coordinates
  16532. throw err;
  16533. }
  16534. }
  16535. return geometry;
  16536. }
  16537. /**
  16538. * @function GeoJSONFormat.prototype.createCRSObject
  16539. * @description 从一个要素对象中创建一个坐标参考系对象。
  16540. * @param {FeatureVector} object - 要素对象。
  16541. * @private
  16542. * @returns {GeoJSONObject} 一个可作为 GeoJSON 对象的 CRS 属性使用的对象。
  16543. */
  16544. createCRSObject(object) {
  16545. var proj = object.layer.projection.toString();
  16546. var crs = {};
  16547. if (proj.match(/epsg:/i)) {
  16548. var code = parseInt(proj.substring(proj.indexOf(":") + 1));
  16549. if (code == 4326) {
  16550. crs = {
  16551. "type": "name",
  16552. "properties": {
  16553. "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
  16554. }
  16555. };
  16556. } else {
  16557. crs = {
  16558. "type": "name",
  16559. "properties": {
  16560. "name": "EPSG:" + code
  16561. }
  16562. };
  16563. }
  16564. }
  16565. return crs;
  16566. }
  16567. _toiSevrerFeature(feature) {
  16568. const attributes = feature.attributes;
  16569. const attrNames = [];
  16570. const attrValues = [];
  16571. for (var attr in attributes) {
  16572. attrNames.push(attr);
  16573. attrValues.push(attributes[attr]);
  16574. }
  16575. const newFeature = {
  16576. fieldNames: attrNames,
  16577. fieldValues: attrValues,
  16578. geometry: ServerGeometry.fromGeometry(feature.geometry)
  16579. };
  16580. newFeature.geometry.id = feature.fid;
  16581. return newFeature;
  16582. }
  16583. createAttributes(feature) {
  16584. if (!feature) {
  16585. return null;
  16586. }
  16587. var attr = {};
  16588. processFieldsAttributes(feature, attr);
  16589. var exceptKeys = ["fieldNames", "fieldValues", "geometry", "stringID", "ID"];
  16590. for (var key in feature) {
  16591. if (exceptKeys.indexOf(key) > -1) {
  16592. continue;
  16593. }
  16594. attr[key] = feature[key];
  16595. }
  16596. function processFieldsAttributes(feature, attributes) {
  16597. if (!(feature.hasOwnProperty("fieldNames") && feature.hasOwnProperty("fieldValues"))) {
  16598. return;
  16599. }
  16600. var names = feature.fieldNames,
  16601. values = feature.fieldValues;
  16602. for (var i in names) {
  16603. attributes[names[i]] = values[i];
  16604. }
  16605. }
  16606. return attr;
  16607. }
  16608. }
  16609. ;// CONCATENATED MODULE: ./src/mapboxgl/core/Util.js
  16610. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  16611. * This program are made available under the terms of the Apache License, Version 2.0
  16612. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16613. const isArray = function (obj){
  16614. return Object.prototype.toString.call(obj) == "[object Array]";
  16615. }
  16616. const isString = function (str) {
  16617. return (typeof str === 'string') && str.constructor === String;
  16618. }
  16619. /**
  16620. * @name Util
  16621. * @namespace
  16622. * @category BaseTypes Util
  16623. * @description 工具类。
  16624. * @usage
  16625. * ```
  16626. * // 浏览器
  16627. * <script type="text/javascript" src="{cdn}"></script>
  16628. * <script>
  16629. * const result = {namespace}.Util.toSuperMapGeometry(geoJSON);
  16630. *
  16631. * </script>
  16632. * // ES6 Import
  16633. * import { Util } from '{npm}';
  16634. *
  16635. * const result = Util.toSuperMapGeometry(geoJSON);
  16636. * ```
  16637. */
  16638. const core_Util_Util = {
  16639. /**
  16640. * @function Util.toSuperMapGeometry
  16641. * @description 将 GeoJSON 对象转为 SuperMap 几何图形。
  16642. * @param {GeoJSONObject} geoJSON - GeoJSON 对象。
  16643. * @returns {Geometry}
  16644. */
  16645. toSuperMapGeometry(geoJSON) {
  16646. if (geoJSON && geoJSON.type) {
  16647. var format = new GeoJSON();
  16648. var result = format.read(geoJSON, "FeatureCollection");
  16649. return result[0].geometry;
  16650. }
  16651. },
  16652. toSuperMapBounds(bounds) {
  16653. if (isArray(bounds)) {
  16654. //左下右上
  16655. return new Bounds(bounds[0], bounds[1], bounds[2], bounds[3]);
  16656. }
  16657. return new Bounds(bounds.getWest(), bounds.getSouth(), bounds.getEast(), bounds.getNorth());
  16658. },
  16659. toSuperMapPoint(lnglat) {
  16660. //客户端可传入 geojson 对象 或者 mapboxgl lnglat 点对象,或者是点数组
  16661. if (isArray(lnglat)) {
  16662. return new Point(lnglat[0], lnglat[1]);
  16663. } else if (lnglat.lng && lnglat.lat) {
  16664. return new Point(lnglat.lng, lnglat.lat);
  16665. }
  16666. return new Point(lnglat.geometry.coordinates[0], lnglat.geometry.coordinates[1]);
  16667. },
  16668. /**
  16669. * @function Util.toSuperMapPolygon
  16670. * @description 将 Mapbox GL LngLatbounds 对象转为 SuperMap 几何图形。
  16671. * @param {mapboxgl.LngLatBounds} lnglatBounds - Mapbox GL LngLatbounds对象。
  16672. * @returns {GeometryPolygon}
  16673. */
  16674. toSuperMapPolygon(lnglatBounds) {
  16675. const west = lnglatBounds.getWest();
  16676. const east = lnglatBounds.getEast();
  16677. const sourth = lnglatBounds.getSouth();
  16678. const north = lnglatBounds.getNorth();
  16679. return new Polygon_Polygon([
  16680. new LinearRing_LinearRing([
  16681. new Point(west, sourth),
  16682. new Point(east, sourth),
  16683. new Point(east, north),
  16684. new Point(west, north)
  16685. ])
  16686. ]);
  16687. },
  16688. /**
  16689. * @function Util.isArray
  16690. * @description 判断是否为数组格式。
  16691. * @param {Object} obj - 待判断对象。
  16692. * @returns {boolean} 是否是数组。
  16693. */
  16694. isArray,
  16695. /**
  16696. * @function Util.toGeoJSON
  16697. * @description 将传入对象转为 GeoJSON 格式。
  16698. * @param {Object} smObj - 待转对象。
  16699. */
  16700. toGeoJSON(smObj) {
  16701. if (smObj) {
  16702. var format = new GeoJSON();
  16703. return format.toGeoJSON(smObj);
  16704. }
  16705. },
  16706. /**
  16707. * @function Util.toProcessingParam
  16708. * @description 将 Region 节点数组转为 Processing 服务需要的分析参数。
  16709. * @param {Array} points - Region 各个节点数组。
  16710. * @returns {Object} processing 服务裁剪、查询分析的分析参数。
  16711. */
  16712. toProcessingParam(points) {
  16713. var geometryParam = {};
  16714. if (points.length < 1) {
  16715. geometryParam = "";
  16716. } else {
  16717. var results = [];
  16718. for (var i = 0; i < points.length; i++) {
  16719. var point = {};
  16720. point.x = points[i][0];
  16721. point.y = points[i][1];
  16722. results.push(point);
  16723. }
  16724. geometryParam.type = "REGION";
  16725. geometryParam.points = results;
  16726. }
  16727. return geometryParam;
  16728. },
  16729. /**
  16730. * @function Util.extend
  16731. * @description 对象拷贝赋值。
  16732. * @param {Object} dest - 目标对象。
  16733. * @param {Object} arguments - 待拷贝的对象。
  16734. * @returns {Object} 赋值后的目标对象。
  16735. */
  16736. extend(dest) {
  16737. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  16738. var arg = Object.getOwnPropertyNames(arguments)[index];
  16739. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  16740. continue;
  16741. }
  16742. var obj = arguments[arg];
  16743. if (obj) {
  16744. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  16745. var key = Object.getOwnPropertyNames(obj)[j];
  16746. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  16747. continue;
  16748. }
  16749. dest[key] = obj[key];
  16750. }
  16751. }
  16752. }
  16753. return dest;
  16754. },
  16755. /**
  16756. * 检测数据是否为number
  16757. * @param value 值,未知数据类型
  16758. * @returns {boolean}
  16759. */
  16760. isNumber(value) {
  16761. if (value === "") {
  16762. return false;
  16763. }
  16764. let mdata = Number(value);
  16765. if (mdata === 0) {
  16766. return true;
  16767. }
  16768. return !isNaN(mdata);
  16769. },
  16770. isString: isString,
  16771. /**
  16772. * 随机生成id
  16773. * @param attr
  16774. * @returns {string}
  16775. */
  16776. newGuid(attr) {
  16777. let len = attr || 32;
  16778. let guid = "";
  16779. for (let i = 1; i < len; i++) {
  16780. let n = Math.floor(Math.random() * 16.0).toString(16);
  16781. guid += n;
  16782. }
  16783. return guid;
  16784. },
  16785. /**
  16786. * @description 十六进制转 RGBA 格式。
  16787. * @param {Object} hex - 十六进制格式。
  16788. * @param {number} opacity - 不透明度Alpha。
  16789. * @returns {string} 生成的 RGBA 格式。
  16790. */
  16791. hexToRgba(hex, opacity) {
  16792. var color = [],
  16793. rgba = [];
  16794. hex = hex.replace(/#/, "");
  16795. if (hex.length == 3) {
  16796. var tmp = [];
  16797. for (let i = 0; i < 3; i++) {
  16798. tmp.push(hex.charAt(i) + hex.charAt(i));
  16799. }
  16800. hex = tmp.join("");
  16801. }
  16802. for (let i = 0; i < 6; i += 2) {
  16803. color[i] = "0x" + hex.substr(i, 2);
  16804. rgba.push(parseInt(Number(color[i])));
  16805. }
  16806. rgba.push(opacity);
  16807. return "rgba(" + rgba.join(",") + ")";
  16808. },
  16809. /**
  16810. * @param {string} featureName 原始数据中的地名
  16811. * @param {string} fieldName 待匹配的地名
  16812. * @returns {boolean} 是否匹配
  16813. */
  16814. isMatchAdministrativeName(featureName, fieldName) {
  16815. if (isString(fieldName)) {
  16816. let shortName = featureName.substr(0, 2);
  16817. // 张家口市和张家界市 特殊处理
  16818. if (shortName === '张家') {
  16819. shortName = featureName.substr(0, 3);
  16820. }
  16821. return !!fieldName.match(new RegExp(shortName));
  16822. }
  16823. return false;
  16824. }
  16825. }
  16826. ;// CONCATENATED MODULE: ./src/mapboxgl/core/index.js
  16827. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  16828. * This program are made available under the terms of the Apache License, Version 2.0
  16829. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16830. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/GeoText.js
  16831. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  16832. * This program are made available under the terms of the Apache License, Version 2.0
  16833. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16834. /**
  16835. * @class GeometryGeoText
  16836. * @aliasclass Geometry.GeoText
  16837. * @deprecatedclass SuperMap.Geometry.GeoText
  16838. * @classdesc 文本标签类。
  16839. * @category BaseTypes Geometry
  16840. * @extends {Geometry}
  16841. * @param {number} x - x 坐标。
  16842. * @param {number} y - y 坐标。
  16843. * @param {string} text - 标签中的文本内容。
  16844. * @usage
  16845. */
  16846. class GeoText extends Geometry_Geometry {
  16847. constructor(x, y, text) {
  16848. super(x, y, text);
  16849. /**
  16850. * @member {number} GeometryGeoText.prototype.x
  16851. * @description 横坐标。
  16852. */
  16853. this.x = parseFloat(x);
  16854. /**
  16855. * @member {number} GeometryGeoText.prototype.y
  16856. * @description 纵坐标。
  16857. */
  16858. this.y = parseFloat(y);
  16859. /**
  16860. * @member {string} GeometryGeoText.prototype.text
  16861. * @description 标签中的文本内容。
  16862. */
  16863. this.text = text.toString();
  16864. /**
  16865. * @member {Object} GeometryGeoText.prototype.bsInfo
  16866. * @description 标签范围的基础信息。
  16867. * @property {number} w - bounds 的宽度。
  16868. * @property {number} h - bounds 的高度。
  16869. */
  16870. this.bsInfo = {
  16871. "h": null,
  16872. "w": null
  16873. };
  16874. this.element = document.createElement('span');
  16875. this.CLASS_NAME = "SuperMap.Geometry.GeoText";
  16876. this.geometryType = "GeoText";
  16877. }
  16878. /**
  16879. * @function GeometryGeoText.prototype.destroy
  16880. * @description 销毁文本标签类。
  16881. */
  16882. destroy() {
  16883. super.destroy();
  16884. this.x = null;
  16885. this.y = null;
  16886. this.text = null;
  16887. }
  16888. /**
  16889. * @function GeometryGeoText.prototype.getCentroid
  16890. * @description 获取标签对象的质心。
  16891. * @returns {GeometryPoint} 标签对象的质心。
  16892. */
  16893. getCentroid() {
  16894. return new Point(this.x, this.y);
  16895. }
  16896. /**
  16897. * @function GeometryGeoText.prototype.clone
  16898. * @description 克隆标签对象。
  16899. * @returns {GeometryGeoText} 克隆后的标签对象。
  16900. */
  16901. clone(obj) {
  16902. if (obj == null) {
  16903. obj = new GeoText(this.x, this.y, this.text);
  16904. }
  16905. Util_Util.applyDefaults(obj, this);
  16906. return obj;
  16907. }
  16908. /**
  16909. * @function GeometryGeoText.prototype.calculateBounds
  16910. * @description 计算标签对象的范围。
  16911. */
  16912. calculateBounds() {
  16913. this.bounds = new Bounds(this.x, this.y,
  16914. this.x, this.y);
  16915. }
  16916. /**
  16917. * @function GeometryGeoText.prototype.getLabelPxBoundsByLabel
  16918. * @description 根据绘制好的标签获取文字标签的像素范围,参数的单位是像素;此方法相对于 getLabelPxBoundsByText 效率较低,但支持所有格式的文本。
  16919. * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  16920. * @param {string} labelWidth - 标签的宽度,如:“90px”。
  16921. * @param {string} labelHeight - 标签的高度。
  16922. * @param {Object} style - 标签的 style。
  16923. * @returns {Bounds} 标签的像素范围。
  16924. */
  16925. getLabelPxBoundsByLabel(locationPixel, labelWidth, labelHeight, style) {
  16926. var labelPxBounds, left, bottom, top, right;
  16927. var locationPx = Util_Util.cloneObject(locationPixel);
  16928. //计算文本行数
  16929. var theText = style.label || this.text;
  16930. var textRows = theText.split('\n');
  16931. var laberRows = textRows.length;
  16932. //处理文字对齐
  16933. labelWidth = parseFloat(labelWidth);
  16934. labelHeight = parseFloat(labelHeight);
  16935. if (laberRows > 1) {
  16936. labelHeight = parseFloat(labelHeight) * laberRows;
  16937. }
  16938. if (style.labelAlign && style.labelAlign !== "cm") {
  16939. switch (style.labelAlign) {
  16940. case "lt":
  16941. locationPx.x += labelWidth / 2;
  16942. locationPx.y += labelHeight / 2;
  16943. break;
  16944. case "lm":
  16945. locationPx.x += labelWidth / 2;
  16946. break;
  16947. case "lb":
  16948. locationPx.x += labelWidth / 2;
  16949. locationPx.y -= labelHeight / 2;
  16950. break;
  16951. case "ct":
  16952. locationPx.y += labelHeight / 2;
  16953. break;
  16954. case "cb":
  16955. locationPx.y -= labelHeight / 2;
  16956. break;
  16957. case "rt":
  16958. locationPx.x -= labelWidth / 2;
  16959. locationPx.y += labelHeight / 2;
  16960. break;
  16961. case "rm":
  16962. locationPx.x -= labelWidth / 2;
  16963. break;
  16964. case "rb":
  16965. locationPx.x -= labelWidth / 2;
  16966. locationPx.y -= labelHeight / 2;
  16967. break;
  16968. default:
  16969. break;
  16970. }
  16971. }
  16972. this.bsInfo.h = labelHeight;
  16973. this.bsInfo.w = labelWidth;
  16974. //bounds的四边
  16975. left = locationPx.x - parseFloat(labelWidth) / 2;
  16976. bottom = locationPx.y + parseFloat(labelHeight) / 2;
  16977. right = locationPx.x + parseFloat(labelWidth) / 2;
  16978. top = locationPx.y - parseFloat(labelHeight) / 2;
  16979. labelPxBounds = new Bounds(left, bottom, right, top);
  16980. return labelPxBounds;
  16981. }
  16982. /**
  16983. * @function GeometryGeoText.prototype.getLabelPxBoundsByText
  16984. * @description 根据文本内容获取文字标签的像素范围。
  16985. * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  16986. * @param {Object} style - 标签的样式。
  16987. * @returns {Bounds} 标签的像素范围。
  16988. */
  16989. getLabelPxBoundsByText(locationPixel, style) {
  16990. var labelPxBounds, left, bottom, top, right;
  16991. var labelSize = this.getLabelPxSize(style);
  16992. var locationPx = Util_Util.cloneObject(locationPixel);
  16993. //处理文字对齐
  16994. if (style.labelAlign && style.labelAlign !== "cm") {
  16995. switch (style.labelAlign) {
  16996. case "lt":
  16997. locationPx.x += labelSize.w / 2;
  16998. locationPx.y += labelSize.h / 2;
  16999. break;
  17000. case "lm":
  17001. locationPx.x += labelSize.w / 2;
  17002. break;
  17003. case "lb":
  17004. locationPx.x += labelSize.w / 2;
  17005. locationPx.y -= labelSize.h / 2;
  17006. break;
  17007. case "ct":
  17008. locationPx.y += labelSize.h / 2;
  17009. break;
  17010. case "cb":
  17011. locationPx.y -= labelSize.h / 2;
  17012. break;
  17013. case "rt":
  17014. locationPx.x -= labelSize.w / 2;
  17015. locationPx.y += labelSize.h / 2;
  17016. break;
  17017. case "rm":
  17018. locationPx.x -= labelSize.w / 2;
  17019. break;
  17020. case "rb":
  17021. locationPx.x -= labelSize.w / 2;
  17022. locationPx.y -= labelSize.h / 2;
  17023. break;
  17024. default:
  17025. break;
  17026. }
  17027. }
  17028. this.bsInfo.h = labelSize.h;
  17029. this.bsInfo.w = labelSize.w;
  17030. left = locationPx.x - labelSize.w / 2;
  17031. bottom = locationPx.y + labelSize.h / 2;
  17032. //处理斜体字
  17033. if (style.fontStyle && style.fontStyle === "italic") {
  17034. right = locationPx.x + labelSize.w / 2 + parseInt(parseFloat(style.fontSize) / 2);
  17035. } else {
  17036. right = locationPx.x + labelSize.w / 2;
  17037. }
  17038. top = locationPx.y - labelSize.h / 2;
  17039. labelPxBounds = new Bounds(left, bottom, right, top);
  17040. return labelPxBounds;
  17041. }
  17042. /**
  17043. * @function GeometryGeoText.prototype.getLabelPxSize
  17044. * @description 获取 label 的像素大小。
  17045. * @param {Object} style - 标签样式。
  17046. * @returns {Object} 标签大小对象,属性 w 表示标签的宽度,属性 h 表示标签的高度。
  17047. */
  17048. getLabelPxSize(style) {
  17049. var text,//文本内容
  17050. fontSize,//字体大小
  17051. spacing = 1,//两个字符间的间距(单位:px)
  17052. lineSpacing = 0.2,
  17053. bgstrokeWidth = parseFloat(style.strokeWidth);//标签背景框边框的宽度
  17054. text = style.label || this.text;
  17055. if (style.fontSize) {
  17056. fontSize = parseFloat(style.fontSize);
  17057. } else {
  17058. fontSize = parseFloat("12px");
  17059. }
  17060. //标签宽高
  17061. var labelW, labelH;
  17062. var textRows = text.split('\n');
  17063. var numRows = textRows.length;
  17064. if (numRows > 1) {
  17065. labelH = fontSize * numRows + numRows + bgstrokeWidth + lineSpacing * fontSize;
  17066. } else {
  17067. labelH = fontSize + bgstrokeWidth + lineSpacing * fontSize + 1;
  17068. }
  17069. //取最大宽度
  17070. labelW = 0;
  17071. if (this.labelWTmp && labelW < this.labelWTmp) {
  17072. labelW = this.labelWTmp;
  17073. }
  17074. for (var i = 0; i < numRows; i++) {
  17075. var textCharC = this.getTextCount(textRows[i]);
  17076. var labelWTmp = this.labelWTmp = Util_Util.getTextBounds(style, textRows[i], this.element).textWidth + textCharC.textC * spacing + bgstrokeWidth;
  17077. if (labelW < labelWTmp) {
  17078. labelW = labelWTmp;
  17079. }
  17080. }
  17081. var labelSize = new Object(); //标签大小
  17082. labelSize.h = labelH;
  17083. labelSize.w = labelW;
  17084. return labelSize;
  17085. }
  17086. /**
  17087. * @function GeometryGeoText.prototype.getTextCount
  17088. * @description 获取 text 中的字符个数。
  17089. * @param {string} text - 字符串。
  17090. * @returns {Object} 字符个数统计结果,属性 cnC 表示中文字符个数,属性 enC 表示英文字符个数,属性 textC 表示字符总个数。
  17091. */
  17092. getTextCount(text) {
  17093. var textCharCount = {};
  17094. var cnCount = 0;
  17095. var enCount = 0;
  17096. for (var i = 0; i < text.length; i++) {
  17097. if (text.charCodeAt(i) > 255) { //遍历判断字符串中每个字符的Unicode码,大于255则为中文
  17098. cnCount++;
  17099. } else {
  17100. enCount++;
  17101. }
  17102. }
  17103. //中午字符个数
  17104. textCharCount.cnC = cnCount;
  17105. //英文字符个数
  17106. textCharCount.enC = enCount;
  17107. //字符总个数
  17108. textCharCount.textC = text.length;
  17109. return textCharCount;
  17110. }
  17111. }
  17112. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Theme.js
  17113. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  17114. * This program are made available under the terms of the Apache License, Version 2.0
  17115. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17116. /**
  17117. * @class FeatureTheme
  17118. * @aliasclass Feature.Theme
  17119. * @deprecatedclass SuperMap.Feature.Theme
  17120. * @category Visualization Theme
  17121. * @classdesc 专题要素基类。
  17122. * @param {Object} data - 用户数据,用于生成可视化 shape。
  17123. * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层。
  17124. * @usage
  17125. */
  17126. class Theme {
  17127. constructor(data, layer) {
  17128. if (!data) {
  17129. return;
  17130. }
  17131. // layer 必须已经添加到地图, 且已初始化渲染器
  17132. if (!layer || !layer.map || !layer.renderer) {
  17133. return;
  17134. }
  17135. /**
  17136. * @member {string} FeatureTheme.prototype.id
  17137. * @description 专题要素唯一标识。
  17138. */
  17139. this.id = Util_Util.createUniqueID(this.CLASS_NAME + "_");
  17140. /**
  17141. * @member {LonLat} FeatureTheme.prototype.lonlat
  17142. * @description 专题要素地理参考位置。子类中必须根据用户数据(或地理位置参数)对其赋值。
  17143. */
  17144. this.lonlat = null;
  17145. /**
  17146. * @member {Array.<number>} FeatureTheme.prototype.location
  17147. * @description 专题要素像素参考位置。通常由地理参考位置决定。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  17148. */
  17149. this.location = [];
  17150. /**
  17151. * @readonly
  17152. * @member {Object} FeatureTheme.prototype.data
  17153. * @description 用户数据,用于生成可视化 shape,可在子类中规定数据格式或类型,如:<{@link FeatureVector}>。
  17154. */
  17155. this.data = data;
  17156. /**
  17157. * @readonly
  17158. * @member {Array.<Object>} FeatureTheme.prototype.shapes
  17159. * @description 构成此专题要素的可视化图形对象数组,数组顺序控制渲染。
  17160. */
  17161. this.shapes = [];
  17162. /**
  17163. * @readonly
  17164. * @member {SuperMap.Layer.Theme} FeatureTheme.prototype.layer
  17165. * @description 此专题要素所在专题图层。
  17166. */
  17167. this.layer = layer;
  17168. this.CLASS_NAME = "SuperMap.Feature.Theme";
  17169. }
  17170. /**
  17171. * @function FeatureTheme.prototype.destroy
  17172. * @description 销毁专题要素。
  17173. */
  17174. destroy() {
  17175. this.data = null;
  17176. this.id = null;
  17177. this.lonlat = null;
  17178. this.location = null;
  17179. this.shapes = null;
  17180. this.layer = null;
  17181. }
  17182. /**
  17183. * @function FeatureTheme.prototype.getLocalXY
  17184. * @description 地理坐标转为像素坐标。
  17185. * @param {GeometryPoint|GeometryGeoText|LonLat} coordinate - 地理坐标点。
  17186. * @returns {Array.<number>} 长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  17187. */
  17188. getLocalXY(coordinate) {
  17189. var resolution = this.layer.map.getResolution();
  17190. var extent = this.layer.map.getExtent();
  17191. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  17192. let x = (coordinate.x / resolution + (-extent.left / resolution));
  17193. let y = ((extent.top / resolution) - coordinate.y / resolution);
  17194. return [x, y];
  17195. } else if (coordinate instanceof LonLat) {
  17196. let x = (coordinate.lon / resolution + (-extent.left / resolution));
  17197. let y = ((extent.top / resolution) - coordinate.lat / resolution);
  17198. return [x, y];
  17199. } else {
  17200. return null;
  17201. }
  17202. }
  17203. }
  17204. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/theme/ThemeFeature.js
  17205. /* Copyright© 2000 - 2023 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 ThemeFeature
  17210. * @category Visualization Theme
  17211. * @classdesc 专题图要素类。
  17212. * @param {GeoJSONObject} geometry - 专题图要素几何对象。
  17213. * @param {Object} [attributes] - 几何对象属性。
  17214. * @usage
  17215. */
  17216. class ThemeFeature {
  17217. constructor(geometry, attributes) {
  17218. this.geometry = geometry;
  17219. this.attributes = attributes;
  17220. }
  17221. /**
  17222. * @function ThemeFeature.prototype.toFeature
  17223. * @description 转为矢量要素。
  17224. */
  17225. toFeature() {
  17226. var geometry = core_Util_Util.toSuperMapGeometry(this.geometry);
  17227. var points = [];
  17228. if (this.geometry instanceof (external_mapboxgl_default()).LngLat) {
  17229. points = [this.geometry.lng, this.geometry.lat];
  17230. } else if (this.geometry instanceof (external_mapboxgl_default()).Point) {
  17231. points = [this.geometry.x, this.geometry.y];
  17232. } else if (this.geometry.length === 3) {
  17233. geometry = new GeoText(this.geometry[0], this.geometry[1], this.geometry[2]);
  17234. }
  17235. if (points.length > 1) {
  17236. geometry = new Point(points[0], points[1]);
  17237. }
  17238. return new Vector(geometry, this.attributes);
  17239. }
  17240. }
  17241. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Util.js
  17242. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  17243. * This program are made available under the terms of the Apache License, Version 2.0
  17244. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17245. /**
  17246. * @private
  17247. * @class LevelRenderer.Tool.Util
  17248. * @category Visualization Theme
  17249. * LevelRenderer 基础工具类
  17250. *
  17251. */
  17252. class levelRenderer_Util_Util {
  17253. constructor() {
  17254. /**
  17255. * @member {Object} LevelRenderer.Tool.Util.prototype.BUILTIN_OBJECT
  17256. * @description 用于处理merge时无法遍历Date等对象的问题
  17257. */
  17258. this.BUILTIN_OBJECT = {
  17259. '[object Function]': 1,
  17260. '[object RegExp]': 1,
  17261. '[object Date]': 1,
  17262. '[object Error]': 1,
  17263. '[object CanvasGradient]': 1
  17264. };
  17265. /**
  17266. * @member {Object} LevelRenderer.Tool.Util.prototype._ctx
  17267. */
  17268. this._ctx = null;
  17269. /**
  17270. * Property: _canvas
  17271. * {Object}
  17272. */
  17273. this._canvas = null;
  17274. /**
  17275. * Property: _pixelCtx
  17276. * {Object}
  17277. */
  17278. this._pixelCtx = null;
  17279. /**
  17280. * Property: _width
  17281. * {Object}
  17282. */
  17283. this._width = null;
  17284. /**
  17285. * Property: _height
  17286. * {Object}
  17287. */
  17288. this._height = null;
  17289. /**
  17290. * Property: _offsetX
  17291. * {Object}
  17292. */
  17293. this._offsetX = 0;
  17294. /**
  17295. * Property: _offsetY
  17296. * {Object}
  17297. */
  17298. this._offsetY = 0;
  17299. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Util";
  17300. }
  17301. /**
  17302. * @function LevelRenderer.Tool.Util.prototype.clone
  17303. * @description 对一个object进行深度拷贝。
  17304. *
  17305. * @param {Object} source - 需要进行拷贝的对象。
  17306. * @return {Object} 拷贝后的新对象。
  17307. */
  17308. clone(source) {
  17309. var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
  17310. if (typeof source == 'object' && source !== null) {
  17311. var result = source;
  17312. if (source instanceof Array) {
  17313. result = [];
  17314. for (var i = 0, len = source.length; i < len; i++) {
  17315. result[i] = this.clone(source[i]);
  17316. }
  17317. } else if (!BUILTIN_OBJECT[Object.prototype.toString.call(source)]) {
  17318. result = {};
  17319. for (var key in source) {
  17320. if (source.hasOwnProperty(key)) {
  17321. result[key] = this.clone(source[key]);
  17322. }
  17323. }
  17324. }
  17325. return result;
  17326. }
  17327. return source;
  17328. }
  17329. /**
  17330. * @function LevelRenderer.Tool.Util.prototype.mergeItem
  17331. * @description 合并源对象的单个属性到目标对象。
  17332. *
  17333. * @param {Object} target - 目标对象。
  17334. * @param {Object} source - 源对象。
  17335. * @param {string} key - 键。
  17336. * @param {boolean} overwrite - 是否覆盖。
  17337. * @return {Object} 目标对象
  17338. */
  17339. mergeItem(target, source, key, overwrite) {
  17340. var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
  17341. if (source.hasOwnProperty(key)) {
  17342. if (typeof target[key] == 'object'
  17343. && !BUILTIN_OBJECT[Object.prototype.toString.call(target[key])]
  17344. ) {
  17345. // 如果需要递归覆盖,就递归调用merge
  17346. this.merge(
  17347. target[key],
  17348. source[key],
  17349. overwrite
  17350. );
  17351. } else if (overwrite || !(key in target)) {
  17352. // 否则只处理overwrite为true,或者在目标对象中没有此属性的情况
  17353. target[key] = source[key];
  17354. }
  17355. }
  17356. }
  17357. /**
  17358. * @function LevelRenderer.Tool.Util.prototype.merge
  17359. * @description 合并源对象的属性到目标对象。
  17360. *
  17361. * @param {Object} target - 目标对象。
  17362. * @param {Object} source - 源对象。
  17363. * @param {boolean} overwrite - 是否覆盖。
  17364. * @return {Object} 目标对象。
  17365. */
  17366. merge(target, source, overwrite) {
  17367. for (var i in source) {
  17368. this.mergeItem(target, source, i, overwrite);
  17369. }
  17370. return target;
  17371. }
  17372. /**
  17373. * @function LevelRenderer.Tool.Util.prototype.getContext
  17374. * @description 获取 Canvas 上下文。
  17375. * @return {Object} 上下文。
  17376. */
  17377. getContext() {
  17378. if (!this._ctx) {
  17379. this._ctx = document.createElement('canvas').getContext('2d');
  17380. }
  17381. return this._ctx;
  17382. }
  17383. /**
  17384. * @function LevelRenderer.Tool.Util.prototype.getPixelContext
  17385. * @description 获取像素拾取专用的上下文。
  17386. * @return {Object} 像素拾取专用的上下文。
  17387. */
  17388. getPixelContext() {
  17389. if (!this._pixelCtx) {
  17390. this._canvas = document.createElement('canvas');
  17391. this._width = this._canvas.width;
  17392. this._height = this._canvas.height;
  17393. this._pixelCtx = this._canvas.getContext('2d');
  17394. }
  17395. return this._pixelCtx;
  17396. }
  17397. /**
  17398. * @function LevelRenderer.Tool.Util.prototype.adjustCanvasSize
  17399. * @description 如果坐标处在_canvas外部,改变_canvas的大小,修改canvas的大小 需要重新设置translate
  17400. *
  17401. * @param {number} x - 横坐标。
  17402. * @param {number} y - 纵坐标。
  17403. *
  17404. */
  17405. adjustCanvasSize(x, y) {
  17406. var _canvas = this._canvas;
  17407. var _pixelCtx = this._pixelCtx;
  17408. var _width = this._width;
  17409. var _height = this._height;
  17410. var _offsetX = this._offsetX;
  17411. var _offsetY = this._offsetY;
  17412. // 每次加的长度
  17413. var _v = 100;
  17414. var _flag;
  17415. if (x + _offsetX > _width) {
  17416. _width = x + _offsetX + _v;
  17417. _canvas.width = _width;
  17418. _flag = true;
  17419. }
  17420. if (y + _offsetY > _height) {
  17421. _height = y + _offsetY + _v;
  17422. _canvas.height = _height;
  17423. _flag = true;
  17424. }
  17425. if (x < -_offsetX) {
  17426. _offsetX = Math.ceil(-x / _v) * _v;
  17427. _width += _offsetX;
  17428. _canvas.width = _width;
  17429. _flag = true;
  17430. }
  17431. if (y < -_offsetY) {
  17432. _offsetY = Math.ceil(-y / _v) * _v;
  17433. _height += _offsetY;
  17434. _canvas.height = _height;
  17435. _flag = true;
  17436. }
  17437. if (_flag) {
  17438. _pixelCtx.translate(_offsetX, _offsetY);
  17439. }
  17440. }
  17441. /**
  17442. * @function LevelRenderer.Tool.Util.prototype.getPixelOffset
  17443. * @description 获取像素canvas的偏移量。
  17444. * @return {Object} 偏移量。
  17445. */
  17446. getPixelOffset() {
  17447. return {
  17448. x: this._offsetX,
  17449. y: this._offsetY
  17450. };
  17451. }
  17452. /**
  17453. * @function LevelRenderer.Tool.Util.prototype.indexOf
  17454. * @description 查询数组中元素的index
  17455. * @return {Object} 偏移量。
  17456. */
  17457. indexOf(array, value) {
  17458. if (array.indexOf) {
  17459. return array.indexOf(value);
  17460. }
  17461. for (var i = 0, len = array.length; i < len; i++) {
  17462. if (array[i] === value) {
  17463. return i;
  17464. }
  17465. }
  17466. return -1;
  17467. }
  17468. /**
  17469. * @function LevelRenderer.Tool.Util.prototype.inherits
  17470. * @description 构造类继承关系
  17471. *
  17472. * @param {function} clazz - 源类。
  17473. * @param {function} baseClazz - 基类。
  17474. * @return {Object} 偏移量。
  17475. */
  17476. inherits(clazz, baseClazz) {
  17477. var clazzPrototype = clazz.prototype;
  17478. function F() {
  17479. }
  17480. F.prototype = baseClazz.prototype;
  17481. clazz.prototype = new F();
  17482. for (var prop in clazzPrototype) {
  17483. clazz.prototype[prop] = clazzPrototype[prop];
  17484. }
  17485. clazz.constructor = clazz;
  17486. }
  17487. }
  17488. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Eventful.js
  17489. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  17490. * This program are made available under the terms of the Apache License, Version 2.0
  17491. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17492. /**
  17493. * @class LevelRenderer.Eventful
  17494. * @category Visualization Theme
  17495. * @classdesc 事件分发器超类,所有支持事件处理的类均是此类的子类。
  17496. * 此类不可实例化。
  17497. * 支持的事件:
  17498. * Symbolizer properties:
  17499. * onclick - {function} 默认值:null。
  17500. * onmouseover - {function} 默认值:null。
  17501. * onmouseout - {function} 默认值:null。
  17502. * onmousemove - {function} 默认值:null。
  17503. * onmousewheel - {function} 默认值:null。
  17504. * onmousedown - {function} 默认值:null。
  17505. * onmouseup - {function} 默认值:null。
  17506. * ondragstart - {function} 默认值:null。
  17507. * ondragend - {function} 默认值:null。
  17508. * ondragenter - {function} 默认值:null。
  17509. * ondragleave - {function} 默认值:null。
  17510. * ondragover - {function} 默认值:null。
  17511. * ondrop - {function} 默认值:null。
  17512. * @private
  17513. */
  17514. class Eventful {
  17515. constructor() {
  17516. /**
  17517. * @member {Object} LevelRenderer.Eventful.prototype._handlers
  17518. * @description 事件处理对象(事件分发器)。
  17519. */
  17520. this._handlers = {};
  17521. this.CLASS_NAME = "SuperMap.LevelRenderer.Eventful";
  17522. }
  17523. /**
  17524. * @function {Object} LevelRenderer.Eventful.prototype.destroy
  17525. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  17526. */
  17527. destroy() {
  17528. this._handlers = null;
  17529. }
  17530. /**
  17531. * @function LevelRenderer.Eventful.prototype.one
  17532. * @description 单次触发绑定,dispatch后销毁。
  17533. * @param {string} event - 事件名。
  17534. * @param {boolean} handler - 响应函数。
  17535. * @param {Object} context - context。
  17536. * @returns {LevelRenderer.Eventful} this
  17537. */
  17538. one(event, handler, context) {
  17539. var _h = this._handlers;
  17540. if (!handler || !event) {
  17541. return this;
  17542. }
  17543. if (!_h[event]) {
  17544. _h[event] = [];
  17545. }
  17546. _h[event].push({
  17547. h: handler,
  17548. one: true,
  17549. ctx: context || this
  17550. });
  17551. return this;
  17552. }
  17553. /**
  17554. * @function LevelRenderer.Eventful.prototype.bind
  17555. * @description 绑定事件。
  17556. * @param {string} event - 事件名。
  17557. * @param {boolean} handler - 响应函数。
  17558. * @param {Object} context - context。
  17559. * @returns {LevelRenderer.Eventful} this
  17560. */
  17561. bind(event, handler, context) {
  17562. var _h = this._handlers;
  17563. if (!handler || !event) {
  17564. return this;
  17565. }
  17566. if (!_h[event]) {
  17567. _h[event] = [];
  17568. }
  17569. _h[event].push({
  17570. h: handler,
  17571. one: false,
  17572. ctx: context || this
  17573. });
  17574. return this;
  17575. }
  17576. /**
  17577. * @function LevelRenderer.Eventful.prototype.unbind
  17578. * @description 解绑事件。
  17579. * @param {string} event - 事件名。
  17580. * @param {boolean} handler - 响应函数。
  17581. * @returns {LevelRenderer.Eventful} this
  17582. */
  17583. unbind(event, handler) {
  17584. var _h = this._handlers;
  17585. if (!event) {
  17586. this._handlers = {};
  17587. return this;
  17588. }
  17589. if (handler) {
  17590. if (_h[event]) {
  17591. var newList = [];
  17592. for (var i = 0, l = _h[event].length; i < l; i++) {
  17593. if (_h[event][i]['h'] != handler) {
  17594. newList.push(_h[event][i]);
  17595. }
  17596. }
  17597. _h[event] = newList;
  17598. }
  17599. if (_h[event] && _h[event].length === 0) {
  17600. delete _h[event];
  17601. }
  17602. } else {
  17603. delete _h[event];
  17604. }
  17605. return this;
  17606. }
  17607. /**
  17608. * @function LevelRenderer.Eventful.prototype.dispatch
  17609. * @description 事件分发。
  17610. * @param {string} type - 事件类型。
  17611. * @returns {LevelRenderer.Eventful} this
  17612. */
  17613. dispatch(type) {
  17614. if (this._handlers[type]) {
  17615. var args = arguments;
  17616. var argLen = args.length;
  17617. if (argLen > 3) {
  17618. args = Array.prototype.slice.call(args, 1);
  17619. }
  17620. var _h = this._handlers[type];
  17621. var len = _h.length;
  17622. for (var i = 0; i < len;) {
  17623. // Optimize advise from backbone
  17624. switch (argLen) {
  17625. case 1:
  17626. _h[i]['h'].call(_h[i]['ctx']);
  17627. break;
  17628. case 2:
  17629. _h[i]['h'].call(_h[i]['ctx'], args[1]);
  17630. break;
  17631. case 3:
  17632. _h[i]['h'].call(_h[i]['ctx'], args[1], args[2]);
  17633. break;
  17634. default:
  17635. // have more than 2 given arguments
  17636. _h[i]['h'].apply(_h[i]['ctx'], args);
  17637. break;
  17638. }
  17639. if (_h[i]['one']) {
  17640. _h.splice(i, 1);
  17641. len--;
  17642. } else {
  17643. i++;
  17644. }
  17645. }
  17646. }
  17647. return this;
  17648. }
  17649. /**
  17650. * @function LevelRenderer.Eventful.prototype.dispatchWithContext
  17651. * @description 带有context的事件分发,最后一个参数是事件回调的 context。
  17652. * @param {string} type - 事件类型。
  17653. * @returns {LevelRenderer.Eventful} this
  17654. */
  17655. dispatchWithContext(type) {
  17656. if (this._handlers[type]) {
  17657. var args = arguments;
  17658. var argLen = args.length;
  17659. if (argLen > 4) {
  17660. args = Array.prototype.slice.call(args, 1, args.length - 1);
  17661. }
  17662. var ctx = args[args.length - 1];
  17663. var _h = this._handlers[type];
  17664. var len = _h.length;
  17665. for (var i = 0; i < len;) {
  17666. // Optimize advise from backbone
  17667. switch (argLen) {
  17668. case 1:
  17669. _h[i]['h'].call(ctx);
  17670. break;
  17671. case 2:
  17672. _h[i]['h'].call(ctx, args[1]);
  17673. break;
  17674. case 3:
  17675. _h[i]['h'].call(ctx, args[1], args[2]);
  17676. break;
  17677. default:
  17678. // have more than 2 given arguments
  17679. _h[i]['h'].apply(ctx, args);
  17680. break;
  17681. }
  17682. if (_h[i]['one']) {
  17683. _h.splice(i, 1);
  17684. len--;
  17685. } else {
  17686. i++;
  17687. }
  17688. }
  17689. }
  17690. return this;
  17691. }
  17692. }
  17693. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Vector.js
  17694. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  17695. * This program are made available under the terms of the Apache License, Version 2.0
  17696. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17697. /**
  17698. * @private
  17699. * @class LevelRenderer.Tool.Vector
  17700. * @category Visualization Theme
  17701. * @classdesc LevelRenderer 二维向量类
  17702. *
  17703. */
  17704. class Vector_Vector {
  17705. constructor() {
  17706. this.ArrayCtor = typeof Float32Array === 'undefined'
  17707. ? Array
  17708. : Float32Array;
  17709. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Vector";
  17710. }
  17711. /**
  17712. * @function LevelRenderer.Tool.Vector.prototype.create
  17713. * @description 创建一个向量。
  17714. *
  17715. * @param {number} x - x坐标
  17716. * @param {number} y - Y坐标
  17717. * @return {Vector2} 向量。
  17718. */
  17719. create(x, y) {
  17720. var ArrayCtor = this.ArrayCtor;
  17721. var out = new ArrayCtor(2);
  17722. out[0] = x || 0;
  17723. out[1] = y || 0;
  17724. return out;
  17725. }
  17726. /**
  17727. * @function LevelRenderer.Tool.Vector.prototype.copy
  17728. * @description 复制一个向量。
  17729. *
  17730. * @param {Vector2} out - 基础向量。
  17731. * @param {Vector2} v - 向量。
  17732. * @return {Vector2} 克隆向量。
  17733. */
  17734. copy(out, v) {
  17735. out[0] = v[0];
  17736. out[1] = v[1];
  17737. return out;
  17738. }
  17739. /**
  17740. * @function LevelRenderer.Tool.Vector.prototype.set
  17741. * @description 设置向量的两个项。
  17742. *
  17743. * @param {Vector2} out - 基础向量。
  17744. * @param {number} a - 项 a。
  17745. * @param {number} b - 项 b。
  17746. * @return {Vector2} 结果。
  17747. */
  17748. set(out, a, b) {
  17749. out[0] = a;
  17750. out[1] = b;
  17751. return out;
  17752. }
  17753. /**
  17754. * @function LevelRenderer.Tool.Vector.prototype.add
  17755. * @description 向量相加。
  17756. *
  17757. * @param {Vector2} out - 基础向量。
  17758. * @param {Vector2} v1 - 向量 v1。
  17759. * @param {Vector2} v2 - 向量 v2。
  17760. * @return {Vector2} 结果。
  17761. */
  17762. add(out, v1, v2) {
  17763. out[0] = v1[0] + v2[0];
  17764. out[1] = v1[1] + v2[1];
  17765. return out;
  17766. }
  17767. /**
  17768. * @function LevelRenderer.Tool.Vector.prototype.scaleAndAdd
  17769. * @description 向量缩放后相加。
  17770. * @param {Vector2} out - 基础向量。
  17771. * @param {Vector2} v1 - 向量 v1。
  17772. * @param {Vector2} v2 - 向量 v2(缩放向量)。
  17773. * @param {number} a - 缩放参数。
  17774. * @return {Vector2} 结果。
  17775. */
  17776. scaleAndAdd(out, v1, v2, a) {
  17777. out[0] = v1[0] + v2[0] * a;
  17778. out[1] = v1[1] + v2[1] * a;
  17779. return out;
  17780. }
  17781. /**
  17782. * @function LevelRenderer.Tool.Vector.prototype.sub
  17783. * @description 向量相减。
  17784. * @param {Vector2} out - 基础向量。
  17785. * @param {Vector2} v1 - 向量 v1。
  17786. * @param {Vector2} v2 - 向量 v2。
  17787. * @return {Vector2} 结果。
  17788. */
  17789. sub(out, v1, v2) {
  17790. out[0] = v1[0] - v2[0];
  17791. out[1] = v1[1] - v2[1];
  17792. return out;
  17793. }
  17794. /**
  17795. * @function LevelRenderer.Tool.Vector.prototype.len
  17796. * @description 向量长度。
  17797. * @param {Vector2} v - 向量。
  17798. * @return {number} 向量长度。
  17799. */
  17800. len(v) {
  17801. return Math.sqrt(this.lenSquare(v));
  17802. }
  17803. /**
  17804. * @function LevelRenderer.Tool.Vector.prototype.lenSquare
  17805. * @description 向量长度平方。
  17806. * @param {Vector2} v - 向量。
  17807. * @return {number} 向量长度平方。
  17808. */
  17809. lenSquare(v) {
  17810. return v[0] * v[0] + v[1] * v[1];
  17811. }
  17812. /**
  17813. * @function LevelRenderer.Tool.Vector.prototype.mul
  17814. * @description 向量乘法。
  17815. * @param {Vector2} out - 基础向量。
  17816. * @param {Vector2} v1 - 向量 v1。
  17817. * @param {Vector2} v2 - 向量 v2。
  17818. * @return {Vector2} 结果。
  17819. */
  17820. mul(out, v1, v2) {
  17821. out[0] = v1[0] * v2[0];
  17822. out[1] = v1[1] * v2[1];
  17823. return out;
  17824. }
  17825. /**
  17826. * @function LevelRenderer.Tool.Vector.prototype.div
  17827. * @description 向量除法。
  17828. *
  17829. * @param {Vector2} out - 基础向量。
  17830. * @param {Vector2} v1 - 向量 v1。
  17831. * @param {Vector2} v2 - 向量 v2。
  17832. * @return {Vector2} 结果。
  17833. */
  17834. div(out, v1, v2) {
  17835. out[0] = v1[0] / v2[0];
  17836. out[1] = v1[1] / v2[1];
  17837. return out;
  17838. }
  17839. /**
  17840. * @function LevelRenderer.Tool.Vector.prototype.dot
  17841. * @description 向量点乘。
  17842. *
  17843. * @param {Vector2} v1 - 向量 v1。
  17844. * @param {Vector2} v2 - 向量 v2。
  17845. * @return {number} 向量点乘。
  17846. */
  17847. dot(v1, v2) {
  17848. return v1[0] * v2[0] + v1[1] * v2[1];
  17849. }
  17850. /**
  17851. * @function LevelRenderer.Tool.Vector.prototype.scale
  17852. * @description 向量缩放。
  17853. *
  17854. * @param {Vector2} out - 基础向量。
  17855. * @param {Vector2} v - 向量v。
  17856. * @param {number} s -缩放参数。
  17857. * @return {Vector2} 结果。
  17858. */
  17859. scale(out, v, s) {
  17860. out[0] = v[0] * s;
  17861. out[1] = v[1] * s;
  17862. return out;
  17863. }
  17864. /**
  17865. * @function LevelRenderer.Tool.Vector.prototype.normalize
  17866. * @description 向量归一化。
  17867. *
  17868. * @param {Vector2} out - 基础向量。
  17869. * @param {Vector2} v - 向量 v。
  17870. * @return {Vector2} 结果。
  17871. */
  17872. normalize(out, v) {
  17873. var d = this.len(v);
  17874. if (d === 0) {
  17875. out[0] = 0;
  17876. out[1] = 0;
  17877. } else {
  17878. out[0] = v[0] / d;
  17879. out[1] = v[1] / d;
  17880. }
  17881. return out;
  17882. }
  17883. /**
  17884. * @function LevelRenderer.Tool.Vector.prototype.distance
  17885. * @description 计算向量间距离。
  17886. *
  17887. * @param {Vector2} v1 - 向量 v1。
  17888. * @param {Vector2} v2 - 向量 v2。
  17889. * @return {number} 向量间距离。
  17890. */
  17891. distance(v1, v2) {
  17892. return Math.sqrt(
  17893. (v1[0] - v2[0]) * (v1[0] - v2[0])
  17894. + (v1[1] - v2[1]) * (v1[1] - v2[1])
  17895. );
  17896. }
  17897. /**
  17898. * @function LevelRenderer.Tool.Vector.prototype.distanceSquare
  17899. * @description 向量距离平方。
  17900. *
  17901. * @param {Vector2} v1 - 向量 v1。
  17902. * @param {Vector2} v2 - 向量 v2。
  17903. * @return {number} 向量距离平方。
  17904. */
  17905. distanceSquare(v1, v2) {
  17906. return (v1[0] - v2[0]) * (v1[0] - v2[0])
  17907. + (v1[1] - v2[1]) * (v1[1] - v2[1]);
  17908. }
  17909. /**
  17910. * @function LevelRenderer.Tool.Vector.prototype.negate
  17911. * @description 求负向量。
  17912. *
  17913. * @param {Vector2} out - 基础向量。
  17914. * @param {Vector2} v - 向量 v。
  17915. * @return {Vector2} 负向量。
  17916. */
  17917. negate(out, v) {
  17918. out[0] = -v[0];
  17919. out[1] = -v[1];
  17920. return out;
  17921. }
  17922. /**
  17923. * @function LevelRenderer.Tool.Vector.prototype.lerp
  17924. * @description 两点之间线性插值。
  17925. *
  17926. * @param {Vector2} out - 基础向量。
  17927. * @param {Vector2} v1 - 向量 v1。
  17928. * @param {Vector2} v2 - 向量 v2。
  17929. * @param {number} t
  17930. * @return {Vector2} 结果。
  17931. */
  17932. lerp(out, v1, v2, t) {
  17933. out[0] = v1[0] + t * (v2[0] - v1[0]);
  17934. out[1] = v1[1] + t * (v2[1] - v1[1]);
  17935. return out;
  17936. }
  17937. /**
  17938. * @function LevelRenderer.Tool.Vector.prototype.applyTransform
  17939. * @description 矩阵左乘向量。
  17940. *
  17941. * @param {Vector2} out - 基础向量。
  17942. * @param {Vector2} v1 - 向量 v1。
  17943. * @param {Vector2} v2 - 向量 v2。
  17944. * @return {Vector2} 结果。
  17945. */
  17946. applyTransform(out, v, m) {
  17947. var x = v[0];
  17948. var y = v[1];
  17949. out[0] = m[0] * x + m[2] * y + m[4];
  17950. out[1] = m[1] * x + m[3] * y + m[5];
  17951. return out;
  17952. }
  17953. /**
  17954. * @function LevelRenderer.Tool.Vector.prototype.min
  17955. * @description 求两个向量最小值。
  17956. * @param {Vector2} out - 基础向量。
  17957. * @param {Vector2} v1 - 向量 v1。
  17958. * @param {Vector2} v2 - 向量 v2。
  17959. * @return {Vector2} 结果。
  17960. */
  17961. min(out, v1, v2) {
  17962. out[0] = Math.min(v1[0], v2[0]);
  17963. out[1] = Math.min(v1[1], v2[1]);
  17964. return out;
  17965. }
  17966. /**
  17967. * @function LevelRenderer.Tool.Vector.prototype.max
  17968. * @description 求两个向量最大值。
  17969. *
  17970. * @param {Vector2} out - 基础向量。
  17971. * @param {Vector2} v1 - 向量 v1。
  17972. * @param {Vector2} v2 - 向量 v2。
  17973. * @return {Vector2} 结果。
  17974. */
  17975. max(out, v1, v2) {
  17976. out[0] = Math.max(v1[0], v2[0]);
  17977. out[1] = Math.max(v1[1], v2[1]);
  17978. return out;
  17979. }
  17980. /**
  17981. * @function LevelRenderer.Tool.Vector.prototype.length
  17982. * @description 向量长度。
  17983. *
  17984. * @param {Vector2} v - 向量。
  17985. * @return {number} 向量长度。
  17986. */
  17987. length(v) {
  17988. return this.len(v);
  17989. }
  17990. /**
  17991. * @function LevelRenderer.Tool.Vector.prototype.lengthSquare
  17992. * @description 向量长度平方。
  17993. *
  17994. * @param {Vector2} v - 向量。
  17995. * @return {number} 向量长度平方。
  17996. */
  17997. lengthSquare(v) {
  17998. return this.lenSquare(v);
  17999. }
  18000. /**
  18001. * @function LevelRenderer.Tool.Vector.prototype.dist
  18002. * @description 计算向量间距离。
  18003. *
  18004. * @param {Vector2} v1 - 向量 v1。
  18005. * @param {Vector2} v2 - 向量 v2。
  18006. * @return {number} 向量间距离。
  18007. */
  18008. dist(v1, v2) {
  18009. return this.distance(v1, v2);
  18010. }
  18011. /**
  18012. * @function LevelRenderer.Tool.Vector.prototype.distSquare
  18013. * @description 向量距离平方。
  18014. *
  18015. * @param {Vector2} v1 - 向量 v1。
  18016. * @param {Vector2} v2 - 向量 v2。
  18017. * @return {number} 向量距离平方
  18018. */
  18019. distSquare(v1, v2) {
  18020. return this.distanceSquare(v1, v2);
  18021. }
  18022. }
  18023. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Curve.js
  18024. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  18025. * This program are made available under the terms of the Apache License, Version 2.0
  18026. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18027. /**
  18028. * @class LevelRenderer.Tool.Curve
  18029. * @category Visualization Theme
  18030. * @classdesc LevelRenderer 工具-曲线
  18031. * @private
  18032. */
  18033. class Curve_Curve {
  18034. constructor() {
  18035. /**
  18036. * @member {LevelRenderer.Tool.Vector} LevelRenderer.Tool.Curve.prototype.vector
  18037. * @description 矢量工具。
  18038. */
  18039. this.vector = new Vector_Vector();
  18040. /**
  18041. * @member {number} LevelRenderer.Tool.Curve.prototype.EPSILON
  18042. * @description e。
  18043. */
  18044. this.EPSILON = 1e-4;
  18045. /**
  18046. * @member {number} LevelRenderer.Tool.Curve.prototype.THREE_SQRT
  18047. * @description 3 的平方根。
  18048. */
  18049. this.THREE_SQRT = Math.sqrt(3);
  18050. /**
  18051. * @member {number} LevelRenderer.Tool.Curve.prototype.ONE_THIRD
  18052. * @description 1/3。
  18053. */
  18054. this.ONE_THIRD = 1 / 3;
  18055. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Curve";
  18056. }
  18057. /*
  18058. * Method: evalCubicCoeff
  18059. *
  18060. * Parameters:
  18061. * a - {number} 值。
  18062. * b - {number} 值。
  18063. * c - {number} 值。
  18064. * d - {number} 值。
  18065. * t - {number} 值。
  18066. *
  18067. * Returns:
  18068. * {number}
  18069. */
  18070. /*
  18071. evalCubicCoeff: function(a, b, c, d, t){
  18072. return ((a * t + b) * t + c) * t + d;
  18073. },
  18074. */
  18075. /**
  18076. * @function LevelRenderer.Tool.Curve.prototype.isAroundZero
  18077. * @description 判断一个值是否趋于0,判断参考值:1e-4。
  18078. * @param {number} val - 值。
  18079. * @returns {boolean} 值是否趋于0。
  18080. */
  18081. isAroundZero(val) {
  18082. return val > -this.EPSILON && val < this.EPSILON;
  18083. }
  18084. /**
  18085. * @function LevelRenderer.Tool.Curve.prototype.isNotAroundZero
  18086. * @description 判断一个值是否不趋于0,判断参考值:1e-4。
  18087. * @param {number} val - 值。
  18088. * @returns {boolean} 值是否不趋于0。
  18089. */
  18090. isNotAroundZero(val) {
  18091. return val > this.EPSILON || val < -this.EPSILON;
  18092. }
  18093. /**
  18094. * @function LevelRenderer.Tool.Curve.prototype.cubicAt
  18095. * @description 计算三次贝塞尔值
  18096. * @param {number} p0 - 点p0。
  18097. * @param {number} p1 - 点p1。
  18098. * @param {number} p2 - 点p2。
  18099. * @param {number} p3 - 点p3。
  18100. * @param {number} t - t值。
  18101. * @returns {number} 三次贝塞尔值。
  18102. */
  18103. cubicAt(p0, p1, p2, p3, t) {
  18104. var onet = 1 - t;
  18105. return onet * onet * (onet * p0 + 3 * t * p1)
  18106. + t * t * (t * p3 + 3 * onet * p2);
  18107. }
  18108. /**
  18109. * @function LevelRenderer.Tool.Curve.prototype.cubicDerivativeAt
  18110. * @description 计算三次贝塞尔导数值
  18111. * @param {number} p0 - 点p0。
  18112. * @param {number} p1 - 点p1。
  18113. * @param {number} p2 - 点p2。
  18114. * @param {number} p3 - 点p3。
  18115. * @param {number} t - t值。
  18116. * @returns {number} 三次贝塞尔导数值。
  18117. */
  18118. cubicDerivativeAt(p0, p1, p2, p3, t) {
  18119. var onet = 1 - t;
  18120. return 3 * (
  18121. ((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet
  18122. + (p3 - p2) * t * t
  18123. );
  18124. }
  18125. /**
  18126. * @function LevelRenderer.Tool.Curve.prototype.cubicRootAt
  18127. * @description 计算三次贝塞尔方程根,使用盛金公式
  18128. * @param {number} p0 - 点p0。
  18129. * @param {number} p1 - 点p1。
  18130. * @param {number} p2 - 点p2。
  18131. * @param {number} p3 - 点p3。
  18132. * @param {number} val - 值。
  18133. * @param {Array.<number>} roots - 有效根数目。
  18134. * @returns {number} 有效根。
  18135. */
  18136. cubicRootAt(p0, p1, p2, p3, val, roots) {
  18137. // Evaluate roots of cubic functions
  18138. var a = p3 + 3 * (p1 - p2) - p0;
  18139. var b = 3 * (p2 - p1 * 2 + p0);
  18140. var c = 3 * (p1 - p0);
  18141. var d = p0 - val;
  18142. var A = b * b - 3 * a * c;
  18143. var B = b * c - 9 * a * d;
  18144. var C = c * c - 3 * b * d;
  18145. var n = 0;
  18146. if (this.isAroundZero(A) && this.isAroundZero(B)) {
  18147. if (this.isAroundZero(b)) {
  18148. roots[0] = 0;
  18149. } else {
  18150. let t1 = -c / b; //t1, t2, t3, b is not zero
  18151. if (t1 >= 0 && t1 <= 1) {
  18152. roots[n++] = t1;
  18153. }
  18154. }
  18155. } else {
  18156. var disc = B * B - 4 * A * C;
  18157. if (this.isAroundZero(disc)) {
  18158. var K = B / A;
  18159. let t1 = -b / a + K; // t1, a is not zero
  18160. let t2 = -K / 2; // t2, t3
  18161. if (t1 >= 0 && t1 <= 1) {
  18162. roots[n++] = t1;
  18163. }
  18164. if (t2 >= 0 && t2 <= 1) {
  18165. roots[n++] = t2;
  18166. }
  18167. } else if (disc > 0) {
  18168. let discSqrt = Math.sqrt(disc);
  18169. let Y1 = A * b + 1.5 * a * (-B + discSqrt);
  18170. let Y2 = A * b + 1.5 * a * (-B - discSqrt);
  18171. if (Y1 < 0) {
  18172. Y1 = -Math.pow(-Y1, this.ONE_THIRD);
  18173. } else {
  18174. Y1 = Math.pow(Y1, this.ONE_THIRD);
  18175. }
  18176. if (Y2 < 0) {
  18177. Y2 = -Math.pow(-Y2, this.ONE_THIRD);
  18178. } else {
  18179. Y2 = Math.pow(Y2, this.ONE_THIRD);
  18180. }
  18181. let t1 = (-b - (Y1 + Y2)) / (3 * a);
  18182. if (t1 >= 0 && t1 <= 1) {
  18183. roots[n++] = t1;
  18184. }
  18185. } else {
  18186. var T = (2 * A * b - 3 * a * B) / (2 * Math.sqrt(A * A * A));
  18187. var theta = Math.acos(T) / 3;
  18188. var ASqrt = Math.sqrt(A);
  18189. var tmp = Math.cos(theta);
  18190. let t1 = (-b - 2 * ASqrt * tmp) / (3 * a);
  18191. let t2 = (-b + ASqrt * (tmp + this.THREE_SQRT * Math.sin(theta))) / (3 * a);
  18192. let t3 = (-b + ASqrt * (tmp - this.THREE_SQRT * Math.sin(theta))) / (3 * a);
  18193. if (t1 >= 0 && t1 <= 1) {
  18194. roots[n++] = t1;
  18195. }
  18196. if (t2 >= 0 && t2 <= 1) {
  18197. roots[n++] = t2;
  18198. }
  18199. if (t3 >= 0 && t3 <= 1) {
  18200. roots[n++] = t3;
  18201. }
  18202. }
  18203. }
  18204. return n;
  18205. }
  18206. /**
  18207. * @function LevelRenderer.Tool.Curve.prototype.cubicRootAt
  18208. * @description 计算三次贝塞尔方程极限值的位置
  18209. * @param {number} p0 - 点p0。
  18210. * @param {number} p1 - 点p1。
  18211. * @param {number} p2 - 点p2。
  18212. * @param {number} p3 - 点p3。
  18213. * @param {Array.<number>} extrema - 值。
  18214. * @returns {number} 有效数目。
  18215. */
  18216. cubicExtrema(p0, p1, p2, p3, extrema) {
  18217. var b = 6 * p2 - 12 * p1 + 6 * p0;
  18218. var a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2;
  18219. var c = 3 * p1 - 3 * p0;
  18220. var n = 0;
  18221. if (this.isAroundZero(a)) {
  18222. if (this.isNotAroundZero(b)) {
  18223. let t1 = -c / b;
  18224. if (t1 >= 0 && t1 <= 1) {
  18225. extrema[n++] = t1;
  18226. }
  18227. }
  18228. } else {
  18229. var disc = b * b - 4 * a * c;
  18230. if (this.isAroundZero(disc)) {
  18231. extrema[0] = -b / (2 * a);
  18232. } else if (disc > 0) {
  18233. let discSqrt = Math.sqrt(disc);
  18234. let t1 = (-b + discSqrt) / (2 * a);
  18235. let t2 = (-b - discSqrt) / (2 * a);
  18236. if (t1 >= 0 && t1 <= 1) {
  18237. extrema[n++] = t1;
  18238. }
  18239. if (t2 >= 0 && t2 <= 1) {
  18240. extrema[n++] = t2;
  18241. }
  18242. }
  18243. }
  18244. return n;
  18245. }
  18246. /**
  18247. * @function LevelRenderer.Tool.Curve.prototype.cubicSubdivide
  18248. * @description 细分三次贝塞尔曲线
  18249. * @param {number} p0 - 点p0。
  18250. * @param {number} p1 - 点p1。
  18251. * @param {number} p2 - 点p2。
  18252. * @param {number} p3 - 点p3。
  18253. * @param {number} t - t值。
  18254. * @param {Array.<number>} out - 投射点。
  18255. * @returns {number} 投射点。
  18256. */
  18257. cubicSubdivide(p0, p1, p2, p3, t, out) {
  18258. var p01 = (p1 - p0) * t + p0;
  18259. var p12 = (p2 - p1) * t + p1;
  18260. var p23 = (p3 - p2) * t + p2;
  18261. var p012 = (p12 - p01) * t + p01;
  18262. var p123 = (p23 - p12) * t + p12;
  18263. var p0123 = (p123 - p012) * t + p012;
  18264. // Seg0
  18265. out[0] = p0;
  18266. out[1] = p01;
  18267. out[2] = p012;
  18268. out[3] = p0123;
  18269. // Seg1
  18270. out[4] = p0123;
  18271. out[5] = p123;
  18272. out[6] = p23;
  18273. out[7] = p3;
  18274. }
  18275. /**
  18276. * @function LevelRenderer.Tool.Curve.prototype.cubicProjectPoint
  18277. * @description 投射点到三次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
  18278. * @param {number} x0 - 点p0横坐标。
  18279. * @param {number} y0 - 点p0纵坐标。
  18280. * @param {number} x1 - 点p1横坐标。
  18281. * @param {number} y1 - 点p1纵坐标。
  18282. * @param {number} x2 - 点p2横坐标。
  18283. * @param {number} y2 - 点p2纵坐标。
  18284. * @param {number} x3 - 点p3横坐标。
  18285. * @param {number} y3 - 点p3纵坐标。
  18286. * @param {number} x - 点p横坐标。
  18287. * @param {number} y - 点p纵坐标。
  18288. * @param {Array.<number>} out - 投射点。
  18289. * @returns {number} 投射点。
  18290. */
  18291. cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, out) {
  18292. // 临时变量
  18293. var _v0 = this.vector.create();
  18294. var _v1 = this.vector.create();
  18295. var _v2 = this.vector.create();
  18296. // var _v3 = vector.create();
  18297. // http://pomax.github.io/bezierinfo/#projections
  18298. var t;
  18299. var interval = 0.005;
  18300. var d = Infinity;
  18301. _v0[0] = x;
  18302. _v0[1] = y;
  18303. // 先粗略估计一下可能的最小距离的 t 值
  18304. // PENDING
  18305. for (let _t = 0; _t < 1; _t += 0.05) {
  18306. _v1[0] = this.cubicAt(x0, x1, x2, x3, _t);
  18307. _v1[1] = this.cubicAt(y0, y1, y2, y3, _t);
  18308. let d1 = this.vector.distSquare(_v0, _v1);
  18309. if (d1 < d) {
  18310. t = _t;
  18311. d = d1;
  18312. }
  18313. }
  18314. d = Infinity;
  18315. // At most 32 iteration
  18316. for (let i = 0; i < 32; i++) {
  18317. if (interval < this.EPSILON) {
  18318. break;
  18319. }
  18320. let prev = t - interval;
  18321. let next = t + interval;
  18322. // t - interval
  18323. _v1[0] = this.cubicAt(x0, x1, x2, x3, prev);
  18324. _v1[1] = this.cubicAt(y0, y1, y2, y3, prev);
  18325. let d1 = this.vector.distSquare(_v1, _v0);
  18326. if (prev >= 0 && d1 < d) {
  18327. t = prev;
  18328. d = d1;
  18329. } else {
  18330. // t + interval
  18331. _v2[0] = this.cubicAt(x0, x1, x2, x3, next);
  18332. _v2[1] = this.cubicAt(y0, y1, y2, y3, next);
  18333. let d2 = this.vector.distSquare(_v2, _v0);
  18334. if (next <= 1 && d2 < d) {
  18335. t = next;
  18336. d = d2;
  18337. } else {
  18338. interval *= 0.5;
  18339. }
  18340. }
  18341. }
  18342. // t
  18343. if (out) {
  18344. out[0] = this.cubicAt(x0, x1, x2, x3, t);
  18345. out[1] = this.cubicAt(y0, y1, y2, y3, t);
  18346. }
  18347. // console.log(interval, i);
  18348. return Math.sqrt(d);
  18349. }
  18350. /**
  18351. * @function LevelRenderer.Tool.Curve.prototype.quadraticAt
  18352. * @description 计算二次方贝塞尔值。
  18353. * @param {number} p0 - 点p0。
  18354. * @param {number} p1 - 点p1。
  18355. * @param {number} p2 - 点p2。
  18356. * @param {number} t - t值。
  18357. * @returns {number} 二次方贝塞尔值。
  18358. */
  18359. quadraticAt(p0, p1, p2, t) {
  18360. var onet = 1 - t;
  18361. return onet * (onet * p0 + 2 * t * p1) + t * t * p2;
  18362. }
  18363. /**
  18364. * @function LevelRenderer.Tool.Curve.prototype.quadraticAt
  18365. * @description 计算二次方贝塞尔导数值。
  18366. * @param {number} p0 - 点p0。
  18367. * @param {number} p1 - 点p1。
  18368. * @param {number} p2 - 点p2。
  18369. * @param {number} t - t值。
  18370. * @returns {number} 二次方贝塞尔导数值。
  18371. */
  18372. quadraticDerivativeAt(p0, p1, p2, t) {
  18373. return 2 * ((1 - t) * (p1 - p0) + t * (p2 - p1));
  18374. }
  18375. /**
  18376. * @function LevelRenderer.Tool.Curve.prototype.quadraticRootAt
  18377. * @description 计算二次方贝塞尔方程根
  18378. * @param {number} p0 - 点p0。
  18379. * @param {number} p1 - 点p1。
  18380. * @param {number} p2 - 点p2。
  18381. * @param {number} val - 值。
  18382. * @param {Array.<number>} roots - 有效根数目。
  18383. * @returns {number} 有效根数目。
  18384. */
  18385. quadraticRootAt(p0, p1, p2, val, roots) {
  18386. var a = p0 - 2 * p1 + p2;
  18387. var b = 2 * (p1 - p0);
  18388. var c = p0 - val;
  18389. var n = 0;
  18390. if (this.isAroundZero(a)) {
  18391. if (this.isNotAroundZero(b)) {
  18392. var t1 = -c / b;
  18393. if (t1 >= 0 && t1 <= 1) {
  18394. roots[n++] = t1;
  18395. }
  18396. }
  18397. } else {
  18398. var disc = b * b - 4 * a * c;
  18399. if (this.isAroundZero(disc)) {
  18400. let t1 = -b / (2 * a);
  18401. if (t1 >= 0 && t1 <= 1) {
  18402. roots[n++] = t1;
  18403. }
  18404. } else if (disc > 0) {
  18405. let discSqrt = Math.sqrt(disc);
  18406. let t1 = (-b + discSqrt) / (2 * a);
  18407. let t2 = (-b - discSqrt) / (2 * a);
  18408. if (t1 >= 0 && t1 <= 1) {
  18409. roots[n++] = t1;
  18410. }
  18411. if (t2 >= 0 && t2 <= 1) {
  18412. roots[n++] = t2;
  18413. }
  18414. }
  18415. }
  18416. return n;
  18417. }
  18418. /**
  18419. * @function LevelRenderer.Tool.Curve.prototype.quadraticExtremum
  18420. * @description 计算二次贝塞尔方程极限值
  18421. * @param {number} p0 - 点p0。
  18422. * @param {number} p1 - 点p1。
  18423. * @param {number} p2 - 点p2。
  18424. * @returns {number} 二次贝塞尔方程极限值。
  18425. */
  18426. quadraticExtremum(p0, p1, p2) {
  18427. var divider = p0 + p2 - 2 * p1;
  18428. if (divider === 0) {
  18429. // p1 is center of p0 and p2
  18430. return 0.5;
  18431. } else {
  18432. return (p0 - p1) / divider;
  18433. }
  18434. }
  18435. /**
  18436. * @function LevelRenderer.Tool.Curve.prototype.quadraticProjectPoint
  18437. * @description 投射点到二次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
  18438. * @param {number} x0 - 点p0横坐标。
  18439. * @param {number} y0 - 点p0纵坐标。
  18440. * @param {number} x1 - 点p1横坐标。
  18441. * @param {number} y1 - 点p1纵坐标。
  18442. * @param {number} x2 - 点p2横坐标。
  18443. * @param {number} y2 - 点p2纵坐标。
  18444. * @param {number} x - 点p横坐标。
  18445. * @param {number} y - 点p纵坐标。
  18446. * @param {Array.<number>} out - 投射点。
  18447. * @returns {number} 投射距离。
  18448. */
  18449. quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, out) {
  18450. // 临时变量
  18451. var _v0 = this.vector.create();
  18452. var _v1 = this.vector.create();
  18453. var _v2 = this.vector.create();
  18454. // http://pomax.github.io/bezierinfo/#projections
  18455. var t;
  18456. var interval = 0.005;
  18457. var d = Infinity;
  18458. _v0[0] = x;
  18459. _v0[1] = y;
  18460. // 先粗略估计一下可能的最小距离的 t 值
  18461. // PENDING
  18462. for (let _t = 0; _t < 1; _t += 0.05) {
  18463. _v1[0] = this.quadraticAt(x0, x1, x2, _t);
  18464. _v1[1] = this.quadraticAt(y0, y1, y2, _t);
  18465. let d1 = this.vector.distSquare(_v0, _v1);
  18466. if (d1 < d) {
  18467. t = _t;
  18468. d = d1;
  18469. }
  18470. }
  18471. d = Infinity;
  18472. // At most 32 iteration
  18473. for (let i = 0; i < 32; i++) {
  18474. if (interval < this.EPSILON) {
  18475. break;
  18476. }
  18477. let prev = t - interval;
  18478. let next = t + interval;
  18479. // t - interval
  18480. _v1[0] = this.quadraticAt(x0, x1, x2, prev);
  18481. _v1[1] = this.quadraticAt(y0, y1, y2, prev);
  18482. let d1 = this.vector.distSquare(_v1, _v0);
  18483. if (prev >= 0 && d1 < d) {
  18484. t = prev;
  18485. d = d1;
  18486. } else {
  18487. // t + interval
  18488. _v2[0] = this.quadraticAt(x0, x1, x2, next);
  18489. _v2[1] = this.quadraticAt(y0, y1, y2, next);
  18490. let d2 = this.vector.distSquare(_v2, _v0);
  18491. if (next <= 1 && d2 < d) {
  18492. t = next;
  18493. d = d2;
  18494. } else {
  18495. interval *= 0.5;
  18496. }
  18497. }
  18498. }
  18499. // t
  18500. if (out) {
  18501. out[0] = this.quadraticAt(x0, x1, x2, t);
  18502. out[1] = this.quadraticAt(y0, y1, y2, t);
  18503. }
  18504. // console.log(interval, i);
  18505. return Math.sqrt(d);
  18506. }
  18507. }
  18508. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Area.js
  18509. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  18510. * This program are made available under the terms of the Apache License, Version 2.0
  18511. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18512. /**
  18513. * @class LevelRenderer.Tool.Area
  18514. * @category Visualization Theme
  18515. * @classdesc LevelRenderer 工具-图形范围判断
  18516. * @private
  18517. */
  18518. class Area {
  18519. constructor() {
  18520. /**
  18521. * @member {LevelRenderer.Tool.Util} LevelRenderer.Tool.Areal.prototype.util
  18522. * @description 基础工具对象。
  18523. */
  18524. this.util = new levelRenderer_Util_Util();
  18525. /**
  18526. * @member {LevelRenderer.Tool.Curve} LevelRenderer.Tool.Areal.prototype.curve
  18527. * @description 曲线工具对象
  18528. */
  18529. this.curve = new Curve_Curve();
  18530. /**
  18531. * @member {Object} LevelRenderer.Tool.Areal.prototype._ctx
  18532. * @description Cavans2D 渲染上下文
  18533. */
  18534. this._ctx = null;
  18535. /**
  18536. * @member {Object} LevelRenderer.Tool.Areal.prototype._textWidthCache
  18537. * @description 文本宽度缓存
  18538. */
  18539. this._textWidthCache = {};
  18540. /**
  18541. * @member {Object} LevelRenderer.Tool.Areal.prototype._textHeightCache
  18542. * @description 文本高度缓存
  18543. */
  18544. this._textHeightCache = {};
  18545. /**
  18546. * @member {number} LevelRenderer.Tool.Areal.prototype._textWidthCacheCounter
  18547. * @description 文本宽度缓存数量
  18548. */
  18549. this._textWidthCacheCounter = 0;
  18550. /**
  18551. * @member {number} LevelRenderer.Tool.Areal.prototype._textHeightCacheCounter
  18552. * @description 文本高度缓存数量
  18553. */
  18554. this._textHeightCacheCounter = 0;
  18555. /**
  18556. * @member {number} LevelRenderer.Tool.Areal.prototype.TEXT_CACHE_MAX
  18557. * @description 文本最大缓存数量
  18558. */
  18559. this.TEXT_CACHE_MAX = 5000;
  18560. /**
  18561. * @member {number} LevelRenderer.Tool.Areal.prototype.PI2
  18562. * @description 2*PI 的值
  18563. */
  18564. this.PI2 = Math.PI * 2;
  18565. /**
  18566. * @member {Array.<number>} LevelRenderer.Tool.Areal.prototype.roots
  18567. * @description 临时数组
  18568. */
  18569. this.roots = [-1, -1, -1];
  18570. /**
  18571. * @member {Array.<number>} LevelRenderer.Tool.Areal.prototype.extrema
  18572. * @description 临时数组
  18573. */
  18574. this.extrema = [-1, -1];
  18575. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Area";
  18576. }
  18577. /**
  18578. * @function LevelRenderer.Tool.Areal.prototype.normalizeRadian
  18579. * @description 弧度标准化函数。
  18580. * @param {number} angle - 弧度值。
  18581. * @returns {number} 标准化后的弧度值。
  18582. */
  18583. normalizeRadian(angle) {
  18584. angle %= this.PI2;
  18585. if (angle < 0) {
  18586. angle += this.PI2;
  18587. }
  18588. return angle;
  18589. }
  18590. /**
  18591. * @function LevelRenderer.Tool.Areal.prototype.isInside
  18592. * @description 包含判断。
  18593. * @param {Object} shape - 图形。
  18594. * @param {number} area - 目标区域。
  18595. * @param {number} x - 横坐标。
  18596. * @param {number} y - 纵坐标。
  18597. * @returns {boolean} 图形是否包含鼠标位置。
  18598. */
  18599. isInside(shape, area, x, y) {
  18600. if (!area || !shape) {
  18601. // 无参数或不支持类型
  18602. return false;
  18603. }
  18604. var zoneType = shape.type;
  18605. this._ctx = this._ctx || this.util.getContext();
  18606. // 未实现或不可用时则数学运算,主要是line,brokenLine,ring
  18607. var _mathReturn = this._mathMethod(shape, area, x, y);
  18608. if (typeof _mathReturn != 'undefined') {
  18609. return _mathReturn;
  18610. }
  18611. if (shape.buildPath && this._ctx.isPointInPath) {
  18612. return this._buildPathMethod(shape, this._ctx, area, x, y);
  18613. }
  18614. // 上面的方法都行不通时
  18615. switch (zoneType) {
  18616. case 'ellipse': // Todo,不精确
  18617. case 'smicellipse': // Todo,不精确
  18618. return true;
  18619. // 旋轮曲线 不准确
  18620. case 'trochoid':
  18621. var _r = area.location == 'out'
  18622. ? area.r1 + area.r2 + area.d
  18623. : area.r1 - area.r2 + area.d;
  18624. return this.isInsideCircle(area, x, y, _r);
  18625. // 玫瑰线 不准确
  18626. case 'rose' :
  18627. return this.isInsideCircle(area, x, y, area.maxr);
  18628. // 路径,椭圆,曲线等-----------------13
  18629. default:
  18630. return false; // Todo,暂不支持
  18631. }
  18632. }
  18633. /**
  18634. * @function LevelRenderer.Tool.Areal.prototype._mathMethod
  18635. * @description 包含判断。用数学方法判断,三个方法中最快,但是支持的shape少。
  18636. * @param {Object} shape - 图形。
  18637. * @param {number} area - 目标区域。
  18638. * @param {number} x - 横坐标。
  18639. * @param {number} y - 纵坐标。
  18640. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
  18641. */
  18642. _mathMethod(shape, area, x, y) {
  18643. var zoneType = shape.type;
  18644. // 在矩形内则部分图形需要进一步判断
  18645. switch (zoneType) {
  18646. // 贝塞尔曲线
  18647. case 'bezier-curve':
  18648. if (typeof(area.cpX2) === 'undefined') {
  18649. return this.isInsideQuadraticStroke(
  18650. area.xStart, area.yStart,
  18651. area.cpX1, area.cpY1,
  18652. area.xEnd, area.yEnd,
  18653. area.lineWidth, x, y
  18654. );
  18655. }
  18656. return this.isInsideCubicStroke(
  18657. area.xStart, area.yStart,
  18658. area.cpX1, area.cpY1,
  18659. area.cpX2, area.cpY2,
  18660. area.xEnd, area.yEnd,
  18661. area.lineWidth, x, y
  18662. );
  18663. // 线
  18664. case 'line':
  18665. return this.isInsideLine(
  18666. area.xStart, area.yStart,
  18667. area.xEnd, area.yEnd,
  18668. area.lineWidth, x, y
  18669. );
  18670. // 折线
  18671. case 'broken-line':
  18672. return this.isInsideBrokenLine(
  18673. area.pointList, area.lineWidth, x, y
  18674. );
  18675. // 扩展折线
  18676. case 'smicbroken-line': {
  18677. // SMIC-修改 - start
  18678. let icX = x;
  18679. let icY = y;
  18680. if (shape.refOriginalPosition) {
  18681. icX = x - shape.refOriginalPosition[0];
  18682. icY = y - shape.refOriginalPosition[1];
  18683. }
  18684. return this.isInsideBrokenLine(
  18685. area.pointList, area.lineWidth, icX, icY
  18686. );
  18687. }
  18688. //初始代码:
  18689. // return isInsideBrokenLine(
  18690. // area.pointList, area.lineWidth, x, y
  18691. // );
  18692. // SMIC-修改 - end
  18693. // 圆环
  18694. case 'ring':
  18695. return this.isInsideRing(
  18696. area.x, area.y, area.r0, area.r, x, y
  18697. );
  18698. case 'smicring': {
  18699. let areaX = area.x;
  18700. let areaY = area.y;
  18701. if (shape.refOriginalPosition) {
  18702. areaX = area.x + shape.refOriginalPosition[0];
  18703. areaY = area.y + shape.refOriginalPosition[1];
  18704. }
  18705. return this.isInsideRing(
  18706. areaX, areaY, area.r0, area.r, x, y
  18707. );
  18708. }
  18709. // 圆形
  18710. case 'circle':
  18711. return this.isInsideCircle(
  18712. area.x, area.y, area.r, x, y
  18713. );
  18714. // 扩展-点
  18715. case 'smicpoint': {
  18716. // SMIC-修改 - start
  18717. let icX = x;
  18718. let icY = y;
  18719. if (shape.refOriginalPosition) {
  18720. icX = x - shape.refOriginalPosition[0];
  18721. icY = y - shape.refOriginalPosition[1];
  18722. }
  18723. return this.isInsideCircle(
  18724. area.x, area.y, area.r, icX, icY
  18725. );
  18726. }
  18727. //初始代码:
  18728. // 无
  18729. // SMIC-修改 - end
  18730. // 扇形
  18731. case 'sector': {
  18732. let startAngle = area.startAngle * Math.PI / 180;
  18733. let endAngle = area.endAngle * Math.PI / 180;
  18734. if (!area.clockWise) {
  18735. startAngle = -startAngle;
  18736. endAngle = -endAngle;
  18737. }
  18738. return this.isInsideSector(
  18739. area.x, area.y, area.r0, area.r,
  18740. startAngle, endAngle,
  18741. !area.clockWise,
  18742. x, y
  18743. );
  18744. }
  18745. //初始代码:
  18746. // 无
  18747. // SMIC-增加 - end
  18748. // 扇形
  18749. case 'smicsector': {
  18750. let startAngle = area.startAngle * Math.PI / 180;
  18751. let endAngle = area.endAngle * Math.PI / 180;
  18752. if (!area.clockWise) {
  18753. startAngle = -startAngle;
  18754. endAngle = -endAngle;
  18755. }
  18756. let areaX = area.x;
  18757. let areaY = area.y;
  18758. if (shape.refOriginalPosition) {
  18759. areaX = area.x + shape.refOriginalPosition[0];
  18760. areaY = area.y + shape.refOriginalPosition[1];
  18761. }
  18762. return this.isInsideSector(
  18763. areaX, areaY, area.r0, area.r,
  18764. startAngle, endAngle,
  18765. !area.clockWise,
  18766. x, y
  18767. );
  18768. }
  18769. // 多边形
  18770. case 'path':
  18771. return this.isInsidePath(
  18772. area.pathArray, Math.max(area.lineWidth, 5),
  18773. area.brushType, x, y
  18774. );
  18775. case 'polygon':
  18776. case 'star':
  18777. case 'smicstar':
  18778. case 'isogon':
  18779. case 'smicisogon':
  18780. return this.isInsidePolygon(area.pointList, x, y);
  18781. // 扩展多边形
  18782. case 'smicpolygon': {
  18783. // SMIC-修改 - start
  18784. let icX = x;
  18785. let icY = y;
  18786. if (shape.refOriginalPosition) {
  18787. icX = x - shape.refOriginalPosition[0];
  18788. icY = y - shape.refOriginalPosition[1];
  18789. }
  18790. //岛洞面
  18791. if (shape.holePolygonPointLists && shape.holePolygonPointLists.length > 0) {
  18792. var isOnBase = this.isInsidePolygon(area.pointList, icX, icY);
  18793. // 遍历岛洞子面
  18794. var holePLS = shape.holePolygonPointLists;
  18795. var isOnHole = false;
  18796. for (var i = 0, holePLSen = holePLS.length; i < holePLSen; i++) {
  18797. var holePL = holePLS[i];
  18798. var isOnSubHole = this.isInsidePolygon(holePL, icX, icY);
  18799. if (isOnSubHole === true) {
  18800. isOnHole = true;
  18801. }
  18802. }
  18803. // 捕获判断
  18804. return isOnBase === true && isOnHole === false;
  18805. } else {
  18806. return this.isInsidePolygon(area.pointList, icX, icY);
  18807. }
  18808. }
  18809. // 初始代码:
  18810. // 无
  18811. // SMIC-修改 - end
  18812. // 文本
  18813. case 'text':
  18814. var rect = area.__rect || shape.getRect(area);
  18815. return this.isInsideRect(
  18816. rect.x, rect.y, rect.width, rect.height, x, y
  18817. );
  18818. // 扩展文本
  18819. case 'smictext':
  18820. //用文本背景矩形判断
  18821. var textBg = shape.getTextBackground(area);
  18822. return this.isInsidePolygon(textBg, x, y);
  18823. //初始代码:
  18824. // 无
  18825. // SMIC-修改 - end
  18826. // 矩形
  18827. case 'rectangle':
  18828. case 'image':
  18829. // 图片
  18830. return this.isInsideRect(
  18831. area.x, area.y, area.width, area.height, x, y
  18832. );
  18833. case 'smicimage': {
  18834. let areaX = area.x;
  18835. let areaY = area.y;
  18836. if (shape.refOriginalPosition) {
  18837. areaX = area.x + shape.refOriginalPosition[0];
  18838. areaY = area.y + shape.refOriginalPosition[1];
  18839. }
  18840. return this.isInsideRect(
  18841. areaX, areaY, area.width, area.height, x, y
  18842. );
  18843. }
  18844. //// 扩展矩形
  18845. //case 'smicpolygon':
  18846. // // SMIC-修改 - start
  18847. // var icX = x;
  18848. // var icY = y;
  18849. // if(shape.refOriginalPosition) {
  18850. // icX = x - shape.refOriginalPosition[0];
  18851. // icY = y - shape.refOriginalPosition[1];
  18852. // }
  18853. // return this.isInsideRect(
  18854. // area.x, area.y, area.width, area.height, icX, icY
  18855. // );
  18856. //初始代码:
  18857. // 无
  18858. // SMIC-修改 - end
  18859. }
  18860. }
  18861. /**
  18862. * @function LevelRenderer.Tool.Areal.prototype._buildPathMethod
  18863. * @description 包含判断。通过buildPath方法来判断,三个方法中较快,但是不支持线条类型的 shape。
  18864. * @param {Object} shape - 图形。
  18865. * @param {Object} context - 上下文。
  18866. * @param {number} area - 目标区域。
  18867. * @param {number} x - 横坐标。
  18868. * @param {number} y - 纵坐标。
  18869. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
  18870. */
  18871. _buildPathMethod(shape, context, area, x, y) {
  18872. // 图形类实现路径创建了则用类的path
  18873. context.beginPath();
  18874. shape.buildPath(context, area);
  18875. context.closePath();
  18876. return context.isPointInPath(x, y);
  18877. }
  18878. /**
  18879. * @function LevelRenderer.Tool.Areal.prototype.isOutside
  18880. * @description 图形是否不包含鼠标位置。
  18881. * @param {Object} shape - 图形。
  18882. * @param {number} area - 目标区域。
  18883. * @param {number} x - 横坐标。
  18884. * @param {number} y - 纵坐标。
  18885. * @returns {boolean} 图形是否不包含鼠标位置, true表示坐标处在图形外。
  18886. */
  18887. isOutside(shape, area, x, y) {
  18888. return !this.isInside(shape, area, x, y);
  18889. }
  18890. /**
  18891. * @function LevelRenderer.Tool.Areal.prototype.isInsideLine
  18892. * @description 线段包含判断。
  18893. * @param {number} x0 - 线起始点横坐标。
  18894. * @param {number} y0 - 线起始点纵坐标。
  18895. * @param {number} x1 - 线终点横坐标。
  18896. * @param {number} y1 - 线终点纵坐标。
  18897. * @param {number} lineWidth - 线宽。
  18898. * @param {number} x - 鼠标位置横坐标。
  18899. * @param {number} y - 鼠标位置纵坐标。
  18900. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形内。
  18901. */
  18902. isInsideLine(x0, y0, x1, y1, lineWidth, x, y) {
  18903. if (lineWidth === 0) {
  18904. return false;
  18905. }
  18906. var _l = Math.max(lineWidth, 5);
  18907. var _a = 0;
  18908. var _b = 0;
  18909. // Quick reject
  18910. if (
  18911. (y > y0 + _l && y > y1 + _l)
  18912. || (y < y0 - _l && y < y1 - _l)
  18913. || (x > x0 + _l && x > x1 + _l)
  18914. || (x < x0 - _l && x < x1 - _l)
  18915. ) {
  18916. return false;
  18917. }
  18918. if (x0 !== x1) {
  18919. _a = (y0 - y1) / (x0 - x1);
  18920. _b = (x0 * y1 - x1 * y0) / (x0 - x1);
  18921. } else {
  18922. return Math.abs(x - x0) <= _l / 2;
  18923. }
  18924. var tmp = _a * x - y + _b;
  18925. var _s = tmp * tmp / (_a * _a + 1);
  18926. return _s <= _l / 2 * _l / 2;
  18927. }
  18928. /**
  18929. * @function LevelRenderer.Tool.Areal.prototype.isInsideCubicStroke
  18930. * @description 三次贝塞尔曲线描边包含判断。
  18931. * @param {number} x0 - 点1横坐标。
  18932. * @param {number} y0 - 点1纵坐标。
  18933. * @param {number} x1 - 点2横坐标。
  18934. * @param {number} y1 - 点2纵坐标。
  18935. * @param {number} x2 - 点3纵坐标。
  18936. * @param {number} y2 - 点3纵坐标。
  18937. * @param {number} lineWidth - 线宽。
  18938. * @param {number} x - 鼠标位置横坐标。
  18939. * @param {number} y - 鼠标位置纵坐标。
  18940. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  18941. */
  18942. isInsideCubicStroke(x0, y0, x1, y1, x2, y2, x3, y3, lineWidth, x, y) {
  18943. if (lineWidth === 0) {
  18944. return false;
  18945. }
  18946. var _l = Math.max(lineWidth, 5);
  18947. // Quick reject
  18948. if (
  18949. (y > y0 + _l && y > y1 + _l && y > y2 + _l && y > y3 + _l)
  18950. || (y < y0 - _l && y < y1 - _l && y < y2 - _l && y < y3 - _l)
  18951. || (x > x0 + _l && x > x1 + _l && x > x2 + _l && x > x3 + _l)
  18952. || (x < x0 - _l && x < x1 - _l && x < x2 - _l && x < x3 - _l)
  18953. ) {
  18954. return false;
  18955. }
  18956. var d = this.curve.cubicProjectPoint(
  18957. x0, y0, x1, y1, x2, y2, x3, y3,
  18958. x, y, null
  18959. );
  18960. return d <= _l / 2;
  18961. }
  18962. /**
  18963. * @function LevelRenderer.Tool.Areal.prototype.isInsideQuadraticStroke
  18964. * @description 二次贝塞尔曲线描边包含判断。
  18965. * @param {number} x0 - 点1横坐标。
  18966. * @param {number} y0 - 点1纵坐标。
  18967. * @param {number} x1 - 点2横坐标。
  18968. * @param {number} y1 - 点2纵坐标。
  18969. * @param {number} x2 - 点3纵坐标。
  18970. * @param {number} y2 - 点3纵坐标。
  18971. * @param {number} lineWidth - 线宽。
  18972. * @param {number} x - 鼠标位置横坐标。
  18973. * @param {number} y - 鼠标位置纵坐标。
  18974. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  18975. */
  18976. isInsideQuadraticStroke(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {
  18977. if (lineWidth === 0) {
  18978. return false;
  18979. }
  18980. var _l = Math.max(lineWidth, 5);
  18981. // Quick reject
  18982. if (
  18983. (y > y0 + _l && y > y1 + _l && y > y2 + _l)
  18984. || (y < y0 - _l && y < y1 - _l && y < y2 - _l)
  18985. || (x > x0 + _l && x > x1 + _l && x > x2 + _l)
  18986. || (x < x0 - _l && x < x1 - _l && x < x2 - _l)
  18987. ) {
  18988. return false;
  18989. }
  18990. var d = this.curve.quadraticProjectPoint(
  18991. x0, y0, x1, y1, x2, y2,
  18992. x, y, null
  18993. );
  18994. return d <= _l / 2;
  18995. }
  18996. /**
  18997. * @function LevelRenderer.Tool.Areal.prototype.isInsideArcStroke
  18998. * @description 圆弧描边包含判断。
  18999. * @param {number} cx - 圆心横坐标。
  19000. * @param {number} cy - 圆心纵坐标。
  19001. * @param {number} r - 圆半径。
  19002. * @param {number} startAngle - 起始角度。
  19003. * @param {number} endAngle - 终止角度。
  19004. * @param {number} anticlockwise - 顺时针还是逆时针。
  19005. * @param {number} lineWidth - 线宽。
  19006. * @param {number} x - 鼠标位置横坐标。
  19007. * @param {number} y - 鼠标位置纵坐标。
  19008. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  19009. */
  19010. isInsideArcStroke(cx, cy, r, startAngle, endAngle, anticlockwise, lineWidth, x, y) {
  19011. var PI2 = this.PI2;
  19012. if (lineWidth === 0) {
  19013. return false;
  19014. }
  19015. var _l = Math.max(lineWidth, 5);
  19016. x -= cx;
  19017. y -= cy;
  19018. var d = Math.sqrt(x * x + y * y);
  19019. if ((d - _l > r) || (d + _l < r)) {
  19020. return false;
  19021. }
  19022. if (Math.abs(startAngle - endAngle) >= PI2) {
  19023. // Is a circle
  19024. return true;
  19025. }
  19026. if (anticlockwise) {
  19027. var tmp = startAngle;
  19028. startAngle = this.normalizeRadian(endAngle);
  19029. endAngle = this.normalizeRadian(tmp);
  19030. } else {
  19031. startAngle = this.normalizeRadian(startAngle);
  19032. endAngle = this.normalizeRadian(endAngle);
  19033. }
  19034. if (startAngle > endAngle) {
  19035. endAngle += PI2;
  19036. }
  19037. var angle = Math.atan2(y, x);
  19038. if (angle < 0) {
  19039. angle += PI2;
  19040. }
  19041. return (angle >= startAngle && angle <= endAngle)
  19042. || (angle + PI2 >= startAngle && angle + PI2 <= endAngle);
  19043. }
  19044. /**
  19045. * @function LevelRenderer.Tool.Areal.prototype.isInsideBrokenLine
  19046. * @description 图形 BrokenLine 是否包含鼠标位置, true表示坐标处在图形内。
  19047. * @param {Array} points - 曲线点对象。
  19048. * @param {number} lineWidth - 线宽。
  19049. * @param {number} x - 鼠标位置横坐标。
  19050. * @param {number} y - 鼠标位置纵坐标。
  19051. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  19052. */
  19053. isInsideBrokenLine(points, lineWidth, x, y) {
  19054. var _lineWidth = Math.max(lineWidth, 10);
  19055. for (var i = 0, l = points.length - 1; i < l; i++) {
  19056. var x0 = points[i][0];
  19057. var y0 = points[i][1];
  19058. var x1 = points[i + 1][0];
  19059. var y1 = points[i + 1][1];
  19060. if (this.isInsideLine(x0, y0, x1, y1, _lineWidth, x, y)) {
  19061. return true;
  19062. }
  19063. }
  19064. return false;
  19065. }
  19066. /**
  19067. * @function LevelRenderer.Tool.Areal.prototype.isInsideRing
  19068. * @description 图形 Ring 是否包含鼠标位置, true表示坐标处在图形内。
  19069. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  19070. */
  19071. isInsideRing(cx, cy, r0, r, x, y) {
  19072. var d = (x - cx) * (x - cx) + (y - cy) * (y - cy);
  19073. return (d < r * r) && (d > r0 * r0);
  19074. }
  19075. /**
  19076. * @function LevelRenderer.Tool.Areal.prototype.isInsideRect
  19077. * @description 图形 Rect 是否包含鼠标位置, true表示坐标处在图形内。
  19078. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  19079. */
  19080. isInsideRect(x0, y0, width, height, x, y) {
  19081. return x >= x0 && x <= (x0 + width) && y >= y0 && y <= (y0 + height);
  19082. }
  19083. /**
  19084. * @function LevelRenderer.Tool.Areal.prototype.isInsideCircle
  19085. * @description 图形 Circle 是否包含鼠标位置, true表示坐标处在图形内。
  19086. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  19087. */
  19088. isInsideCircle(x0, y0, r, x, y) {
  19089. return (x - x0) * (x - x0) + (y - y0) * (y - y0) < r * r;
  19090. }
  19091. /**
  19092. * @function LevelRenderer.Tool.Areal.prototype.isInsideSector
  19093. * @description 图形 Sector 是否包含鼠标位置, true表示坐标处在图形内。
  19094. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  19095. */
  19096. isInsideSector(cx, cy, r0, r, startAngle, endAngle, anticlockwise, x, y) {
  19097. return this.isInsideArcStroke(cx, cy, (r0 + r) / 2, startAngle, endAngle, anticlockwise, r - r0, x, y);
  19098. }
  19099. /**
  19100. * @function LevelRenderer.Tool.Areal.prototype.isInsidePolygon
  19101. * @description 图形 Polygon 是否包含鼠标位置, true表示坐标处在图形内。与 canvas 一样采用 non-zero winding rule
  19102. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  19103. */
  19104. isInsidePolygon(points, x, y) {
  19105. var N = points.length;
  19106. var w = 0;
  19107. for (var i = 0, j = N - 1; i < N; i++) {
  19108. var x0 = points[j][0];
  19109. var y0 = points[j][1];
  19110. var x1 = points[i][0];
  19111. var y1 = points[i][1];
  19112. w += this.windingLine(x0, y0, x1, y1, x, y);
  19113. j = i;
  19114. }
  19115. return w !== 0;
  19116. }
  19117. /**
  19118. * @function LevelRenderer.Tool.Areal.prototype.windingLine
  19119. */
  19120. windingLine(x0, y0, x1, y1, x, y) {
  19121. if ((y > y0 && y > y1) || (y < y0 && y < y1)) {
  19122. return 0;
  19123. }
  19124. if (y1 == y0) {
  19125. return 0;
  19126. }
  19127. var dir = y1 < y0 ? 1 : -1;
  19128. var t = (y - y0) / (y1 - y0);
  19129. var x_ = t * (x1 - x0) + x0;
  19130. return x_ > x ? dir : 0;
  19131. }
  19132. /**
  19133. * @function LevelRenderer.Tool.Areal.prototype.swapExtrema
  19134. */
  19135. swapExtrema() {
  19136. var tmp = this.extrema[0];
  19137. this.extrema[0] = this.extrema[1];
  19138. this.extrema[1] = tmp;
  19139. }
  19140. /**
  19141. * @function LevelRenderer.Tool.Areal.prototype.windingCubic
  19142. */
  19143. windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {
  19144. var curve = this.curve;
  19145. var roots = this.roots;
  19146. var extrema = this.extrema;
  19147. // Quick reject
  19148. if (
  19149. (y > y0 && y > y1 && y > y2 && y > y3)
  19150. || (y < y0 && y < y1 && y < y2 && y < y3)
  19151. ) {
  19152. return 0;
  19153. }
  19154. var nRoots = curve.cubicRootAt(y0, y1, y2, y3, y, roots);
  19155. if (nRoots === 0) {
  19156. return 0;
  19157. } else {
  19158. var w = 0;
  19159. var nExtrema = -1;
  19160. var y0_, y1_;
  19161. for (var i = 0; i < nRoots; i++) {
  19162. var t = roots[i];
  19163. var x_ = curve.cubicAt(x0, x1, x2, x3, t);
  19164. if (x_ < x) { // Quick reject
  19165. continue;
  19166. }
  19167. if (nExtrema < 0) {
  19168. nExtrema = curve.cubicExtrema(y0, y1, y2, y3, extrema);
  19169. if (extrema[1] < extrema[0] && nExtrema > 1) {
  19170. this.swapExtrema();
  19171. }
  19172. y0_ = curve.cubicAt(y0, y1, y2, y3, extrema[0]);
  19173. if (nExtrema > 1) {
  19174. y1_ = curve.cubicAt(y0, y1, y2, y3, extrema[1]);
  19175. }
  19176. }
  19177. if (nExtrema == 2) {
  19178. // 分成三段单调函数
  19179. if (t < extrema[0]) {
  19180. w += y0_ < y0 ? 1 : -1;
  19181. } else if (t < extrema[1]) {
  19182. w += y1_ < y0_ ? 1 : -1;
  19183. } else {
  19184. w += y3 < y1_ ? 1 : -1;
  19185. }
  19186. } else {
  19187. // 分成两段单调函数
  19188. if (t < extrema[0]) {
  19189. w += y0_ < y0 ? 1 : -1;
  19190. } else {
  19191. w += y3 < y0_ ? 1 : -1;
  19192. }
  19193. }
  19194. }
  19195. return w;
  19196. }
  19197. }
  19198. /**
  19199. * @function LevelRenderer.Tool.Areal.prototype.windingQuadratic
  19200. */
  19201. windingQuadratic(x0, y0, x1, y1, x2, y2, x, y) {
  19202. var curve = this.curve;
  19203. var roots = this.roots;
  19204. // Quick reject
  19205. if (
  19206. (y > y0 && y > y1 && y > y2)
  19207. || (y < y0 && y < y1 && y < y2)
  19208. ) {
  19209. return 0;
  19210. }
  19211. var nRoots = curve.quadraticRootAt(y0, y1, y2, y, roots);
  19212. if (nRoots === 0) {
  19213. return 0;
  19214. } else {
  19215. var t = curve.quadraticExtremum(y0, y1, y2);
  19216. if (t >= 0 && t <= 1) {
  19217. var w = 0;
  19218. var y_ = curve.quadraticAt(y0, y1, y2, t);
  19219. for (let i = 0; i < nRoots; i++) {
  19220. let x_ = curve.quadraticAt(x0, x1, x2, roots[i]);
  19221. if (x_ > x) {
  19222. continue;
  19223. }
  19224. if (roots[i] < t) {
  19225. w += y_ < y0 ? 1 : -1;
  19226. } else {
  19227. w += y2 < y_ ? 1 : -1;
  19228. }
  19229. }
  19230. return w;
  19231. } else {
  19232. let x_ = curve.quadraticAt(x0, x1, x2, roots[0]);
  19233. if (x_ > x) {
  19234. return 0;
  19235. }
  19236. return y2 < y0 ? 1 : -1;
  19237. }
  19238. }
  19239. }
  19240. /**
  19241. * @function LevelRenderer.Tool.Areal.prototype.windingArc
  19242. * // TODO Arc 旋转
  19243. */
  19244. windingArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y) {
  19245. var roots = this.roots;
  19246. var PI2 = this.PI2;
  19247. y -= cy;
  19248. if (y > r || y < -r) {
  19249. return 0;
  19250. }
  19251. let tmp = Math.sqrt(r * r - y * y);
  19252. roots[0] = -tmp;
  19253. roots[1] = tmp;
  19254. if (Math.abs(startAngle - endAngle) >= PI2) {
  19255. // Is a circle
  19256. startAngle = 0;
  19257. endAngle = PI2;
  19258. var dir = anticlockwise ? 1 : -1;
  19259. if (x >= roots[0] + cx && x <= roots[1] + cx) {
  19260. return dir;
  19261. } else {
  19262. return 0;
  19263. }
  19264. }
  19265. if (anticlockwise) {
  19266. let tmp = startAngle;
  19267. startAngle = this.normalizeRadian(endAngle);
  19268. endAngle = this.normalizeRadian(tmp);
  19269. } else {
  19270. startAngle = this.normalizeRadian(startAngle);
  19271. endAngle = this.normalizeRadian(endAngle);
  19272. }
  19273. if (startAngle > endAngle) {
  19274. endAngle += PI2;
  19275. }
  19276. var w = 0;
  19277. for (let i = 0; i < 2; i++) {
  19278. var x_ = roots[i];
  19279. if (x_ + cx > x) {
  19280. let angle = Math.atan2(y, x_);
  19281. let dir = anticlockwise ? 1 : -1;
  19282. if (angle < 0) {
  19283. angle = PI2 + angle;
  19284. }
  19285. if (
  19286. (angle >= startAngle && angle <= endAngle)
  19287. || (angle + PI2 >= startAngle && angle + PI2 <= endAngle)
  19288. ) {
  19289. if (angle > Math.PI / 2 && angle < Math.PI * 1.5) {
  19290. dir = -dir;
  19291. }
  19292. w += dir;
  19293. }
  19294. }
  19295. }
  19296. return w;
  19297. }
  19298. /**
  19299. * @function LevelRenderer.Tool.Areal.prototype.isInsidePath
  19300. * @description 与 canvas 一样采用 non-zero winding rule
  19301. */
  19302. isInsidePath(pathArray, lineWidth, brushType, x, y) {
  19303. var w = 0;
  19304. var xi = 0;
  19305. var yi = 0;
  19306. var x0 = 0;
  19307. var y0 = 0;
  19308. var beginSubpath = true;
  19309. var firstCmd = true;
  19310. brushType = brushType || 'fill';
  19311. var hasStroke = brushType === 'stroke' || brushType === 'both';
  19312. var hasFill = brushType === 'fill' || brushType === 'both';
  19313. // var roots = [-1, -1, -1];
  19314. for (var i = 0; i < pathArray.length; i++) {
  19315. var seg = pathArray[i];
  19316. var p = seg.points;
  19317. // Begin a new subpath
  19318. if (beginSubpath || seg.command === 'M') {
  19319. if (i > 0) {
  19320. // Close previous subpath
  19321. if (hasFill) {
  19322. w += this.windingLine(xi, yi, x0, y0, x, y);
  19323. }
  19324. if (w !== 0) {
  19325. return true;
  19326. }
  19327. }
  19328. x0 = p[p.length - 2];
  19329. y0 = p[p.length - 1];
  19330. beginSubpath = false;
  19331. if (firstCmd && seg.command !== 'A') {
  19332. // 如果第一个命令不是M, 是lineTo, bezierCurveTo
  19333. // 等绘制命令的话,是会从该绘制的起点开始算的
  19334. // Arc 会在之后做单独处理所以这里忽略
  19335. firstCmd = false;
  19336. xi = x0;
  19337. yi = y0;
  19338. }
  19339. }
  19340. switch (seg.command) {
  19341. case 'M':
  19342. xi = p[0];
  19343. yi = p[1];
  19344. break;
  19345. case 'L':
  19346. if (hasStroke) {
  19347. if (this.isInsideLine(
  19348. xi, yi, p[0], p[1], lineWidth, x, y
  19349. )) {
  19350. return true;
  19351. }
  19352. }
  19353. if (hasFill) {
  19354. w += this.windingLine(xi, yi, p[0], p[1], x, y);
  19355. }
  19356. xi = p[0];
  19357. yi = p[1];
  19358. break;
  19359. case 'C':
  19360. if (hasStroke) {
  19361. if (this.isInsideCubicStroke(
  19362. xi, yi, p[0], p[1], p[2], p[3], p[4], p[5],
  19363. lineWidth, x, y
  19364. )) {
  19365. return true;
  19366. }
  19367. }
  19368. if (hasFill) {
  19369. w += this.windingCubic(
  19370. xi, yi, p[0], p[1], p[2], p[3], p[4], p[5], x, y
  19371. );
  19372. }
  19373. xi = p[4];
  19374. yi = p[5];
  19375. break;
  19376. case 'Q':
  19377. if (hasStroke) {
  19378. if (this.isInsideQuadraticStroke(
  19379. xi, yi, p[0], p[1], p[2], p[3],
  19380. lineWidth, x, y
  19381. )) {
  19382. return true;
  19383. }
  19384. }
  19385. if (hasFill) {
  19386. w += this.windingQuadratic(
  19387. xi, yi, p[0], p[1], p[2], p[3], x, y
  19388. );
  19389. }
  19390. xi = p[2];
  19391. yi = p[3];
  19392. break;
  19393. case 'A':
  19394. // TODO Arc 旋转
  19395. // TODO Arc 判断的开销比较大
  19396. var cx = p[0];
  19397. var cy = p[1];
  19398. var rx = p[2];
  19399. var ry = p[3];
  19400. var theta = p[4];
  19401. var dTheta = p[5];
  19402. var x1 = Math.cos(theta) * rx + cx;
  19403. var y1 = Math.sin(theta) * ry + cy;
  19404. // 不是直接使用 arc 命令
  19405. if (!firstCmd) {
  19406. w += this.windingLine(xi, yi, x1, y1);
  19407. } else {
  19408. firstCmd = false;
  19409. // 第一个命令起点还未定义
  19410. x0 = x1;
  19411. y0 = y1;
  19412. }
  19413. // zr 使用scale来模拟椭圆, 这里也对x做一定的缩放
  19414. var _x = (x - cx) * ry / rx + cx;
  19415. if (hasStroke) {
  19416. if (this.isInsideArcStroke(
  19417. cx, cy, ry, theta, theta + dTheta, 1 - p[7],
  19418. lineWidth, _x, y
  19419. )) {
  19420. return true;
  19421. }
  19422. }
  19423. if (hasFill) {
  19424. w += this.windingArc(
  19425. cx, cy, ry, theta, theta + dTheta, 1 - p[7],
  19426. _x, y
  19427. );
  19428. }
  19429. xi = Math.cos(theta + dTheta) * rx + cx;
  19430. yi = Math.sin(theta + dTheta) * ry + cy;
  19431. break;
  19432. case 'z':
  19433. if (hasStroke) {
  19434. if (this.isInsideLine(
  19435. xi, yi, x0, y0, lineWidth, x, y
  19436. )) {
  19437. return true;
  19438. }
  19439. }
  19440. beginSubpath = true;
  19441. break;
  19442. }
  19443. }
  19444. if (hasFill) {
  19445. w += this.windingLine(xi, yi, x0, y0, x, y);
  19446. }
  19447. return w !== 0;
  19448. }
  19449. /**
  19450. * @function LevelRenderer.Tool.Areal.prototype.getTextWidth
  19451. * @description 测算多行文本宽度
  19452. */
  19453. getTextWidth(text, textFont) {
  19454. var key = text + ':' + textFont;
  19455. if (this._textWidthCache[key]) {
  19456. return this._textWidthCache[key];
  19457. }
  19458. this._ctx = this._ctx || this.util.getContext();
  19459. this._ctx.save();
  19460. if (textFont) {
  19461. this._ctx.font = textFont;
  19462. }
  19463. text = (text + '').split('\n');
  19464. var width = 0;
  19465. for (var i = 0, l = text.length; i < l; i++) {
  19466. width = Math.max(
  19467. this._ctx.measureText(text[i]).width,
  19468. width
  19469. );
  19470. }
  19471. this._ctx.restore();
  19472. this._textWidthCache[key] = width;
  19473. if (++this._textWidthCacheCounter > this.TEXT_CACHE_MAX) {
  19474. // 内存释放
  19475. this._textWidthCacheCounter = 0;
  19476. this._textWidthCache = {};
  19477. }
  19478. return width;
  19479. }
  19480. /**
  19481. * @function LevelRenderer.Tool.Areal.prototype.getTextHeight
  19482. * @description 测算多行文本高度
  19483. */
  19484. getTextHeight(text, textFont) {
  19485. var key = text + ':' + textFont;
  19486. if (this._textHeightCache[key]) {
  19487. return this._textHeightCache[key];
  19488. }
  19489. this._ctx = this._ctx || this.util.getContext();
  19490. this._ctx.save();
  19491. if (textFont) {
  19492. this._ctx.font = textFont;
  19493. }
  19494. text = (text + '').split('\n');
  19495. // 比较粗暴
  19496. //var height = (this._ctx.measureText('国').width + 2) * text.length; //打包不支持中文,替换掉
  19497. var height = (this._ctx.measureText('ZH').width + 2) * text.length;
  19498. this._ctx.restore();
  19499. this._textHeightCache[key] = height;
  19500. if (++this._textHeightCacheCounter > this.TEXT_CACHE_MAX) {
  19501. // 内存释放
  19502. this._textHeightCacheCounter = 0;
  19503. this._textHeightCache = {};
  19504. }
  19505. return height;
  19506. }
  19507. }
  19508. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Color.js
  19509. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  19510. * This program are made available under the terms of the Apache License, Version 2.0
  19511. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19512. /**
  19513. * @class LevelRenderer.Tool.Color
  19514. * @category Visualization Theme
  19515. * @classdesc LevelRenderer 工具-颜色辅助类
  19516. * @private
  19517. */
  19518. class Color {
  19519. constructor() {
  19520. /**
  19521. * @member {LevelRenderer.Tool.Util} LevelRenderer.Tool.Color.prototype.util
  19522. * @description LevelRenderer 基础工具对象。
  19523. */
  19524. this.util = new levelRenderer_Util_Util();
  19525. /**
  19526. * @member {Object} LevelRenderer.Tool.Color.prototype._ctx
  19527. * @description _ctx。
  19528. */
  19529. this._ctx = null;
  19530. /**
  19531. * @member {Array.<string>} LevelRenderer.Tool.Color.prototype.palette
  19532. * @description 默认色板。色板是一个包含图表默认颜色系列的数组,当色板中所有颜色被使用过后,又将从新回到色板中的第一个颜色。
  19533. */
  19534. this.palette = [
  19535. '#ff9277', ' #dddd00', ' #ffc877', ' #bbe3ff', ' #d5ffbb',
  19536. '#bbbbff', ' #ddb000', ' #b0dd00', ' #e2bbff', ' #ffbbe3',
  19537. '#ff7777', ' #ff9900', ' #83dd00', ' #77e3ff', ' #778fff',
  19538. '#c877ff', ' #ff77ab', ' #ff6600', ' #aa8800', ' #77c7ff',
  19539. '#ad77ff', ' #ff77ff', ' #dd0083', ' #777700', ' #00aa00',
  19540. '#0088aa', ' #8400dd', ' #aa0088', ' #dd0000', ' #772e00'
  19541. ];
  19542. /**
  19543. * @member {Array.<string>} LevelRenderer.Tool.Color.prototype._palette
  19544. * @description 复位色板,用于复位 palette
  19545. */
  19546. this._palette = this.palette;
  19547. /**
  19548. * @member {string} LevelRenderer.Tool.Color.prototype.highlightColor
  19549. * @description 高亮色
  19550. */
  19551. this.highlightColor = 'rgba(0,0,255,1)';
  19552. /**
  19553. * @member {string} LevelRenderer.Tool.Color.prototype._highlightColor
  19554. * @description 复位高亮色
  19555. */
  19556. this._highlightColor = this.highlightColor;
  19557. /**
  19558. * @member {string} LevelRenderer.Tool.Color.prototype.colorRegExp
  19559. * @description 颜色格式,正则表达式。
  19560. */
  19561. 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;
  19562. /**
  19563. * @member {string} LevelRenderer.Tool.Color.prototype._nameColors
  19564. * @description 颜色名。
  19565. */
  19566. this._nameColors = {
  19567. aliceblue: '#f0f8ff',
  19568. antiquewhite: '#faebd7',
  19569. aqua: '#0ff',
  19570. aquamarine: '#7fffd4',
  19571. azure: '#f0ffff',
  19572. beige: '#f5f5dc',
  19573. bisque: '#ffe4c4',
  19574. black: '#000',
  19575. blanchedalmond: '#ffebcd',
  19576. blue: '#00f',
  19577. blueviolet: '#8a2be2',
  19578. brown: '#a52a2a',
  19579. burlywood: '#deb887',
  19580. cadetblue: '#5f9ea0',
  19581. chartreuse: '#7fff00',
  19582. chocolate: '#d2691e',
  19583. coral: '#ff7f50',
  19584. cornflowerblue: '#6495ed',
  19585. cornsilk: '#fff8dc',
  19586. crimson: '#dc143c',
  19587. cyan: '#0ff',
  19588. darkblue: '#00008b',
  19589. darkcyan: '#008b8b',
  19590. darkgoldenrod: '#b8860b',
  19591. darkgray: '#a9a9a9',
  19592. darkgrey: '#a9a9a9',
  19593. darkgreen: '#006400',
  19594. darkkhaki: '#bdb76b',
  19595. darkmagenta: '#8b008b',
  19596. darkolivegreen: '#556b2f',
  19597. darkorange: '#ff8c00',
  19598. darkorchid: '#9932cc',
  19599. darkred: '#8b0000',
  19600. darksalmon: '#e9967a',
  19601. darkseagreen: '#8fbc8f',
  19602. darkslateblue: '#483d8b',
  19603. darkslategray: '#2f4f4f',
  19604. darkslategrey: '#2f4f4f',
  19605. darkturquoise: '#00ced1',
  19606. darkviolet: '#9400d3',
  19607. deeppink: '#ff1493',
  19608. deepskyblue: '#00bfff',
  19609. dimgray: '#696969',
  19610. dimgrey: '#696969',
  19611. dodgerblue: '#1e90ff',
  19612. firebrick: '#b22222',
  19613. floralwhite: '#fffaf0',
  19614. forestgreen: '#228b22',
  19615. fuchsia: '#f0f',
  19616. gainsboro: '#dcdcdc',
  19617. ghostwhite: '#f8f8ff',
  19618. gold: '#ffd700',
  19619. goldenrod: '#daa520',
  19620. gray: '#808080',
  19621. grey: '#808080',
  19622. green: '#008000',
  19623. greenyellow: '#adff2f',
  19624. honeydew: '#f0fff0',
  19625. hotpink: '#ff69b4',
  19626. indianred: '#cd5c5c',
  19627. indigo: '#4b0082',
  19628. ivory: '#fffff0',
  19629. khaki: '#f0e68c',
  19630. lavender: '#e6e6fa',
  19631. lavenderblush: '#fff0f5',
  19632. lawngreen: '#7cfc00',
  19633. lemonchiffon: '#fffacd',
  19634. lightblue: '#add8e6',
  19635. lightcoral: '#f08080',
  19636. lightcyan: '#e0ffff',
  19637. lightgoldenrodyellow: '#fafad2',
  19638. lightgray: '#d3d3d3',
  19639. lightgrey: '#d3d3d3',
  19640. lightgreen: '#90ee90',
  19641. lightpink: '#ffb6c1',
  19642. lightsalmon: '#ffa07a',
  19643. lightseagreen: '#20b2aa',
  19644. lightskyblue: '#87cefa',
  19645. lightslategray: '#789',
  19646. lightslategrey: '#789',
  19647. lightsteelblue: '#b0c4de',
  19648. lightyellow: '#ffffe0',
  19649. lime: '#0f0',
  19650. limegreen: '#32cd32',
  19651. linen: '#faf0e6',
  19652. magenta: '#f0f',
  19653. maroon: '#800000',
  19654. mediumaquamarine: '#66cdaa',
  19655. mediumblue: '#0000cd',
  19656. mediumorchid: '#ba55d3',
  19657. mediumpurple: '#9370d8',
  19658. mediumseagreen: '#3cb371',
  19659. mediumslateblue: '#7b68ee',
  19660. mediumspringgreen: '#00fa9a',
  19661. mediumturquoise: '#48d1cc',
  19662. mediumvioletred: '#c71585',
  19663. midnightblue: '#191970',
  19664. mintcream: '#f5fffa',
  19665. mistyrose: '#ffe4e1',
  19666. moccasin: '#ffe4b5',
  19667. navajowhite: '#ffdead',
  19668. navy: '#000080',
  19669. oldlace: '#fdf5e6',
  19670. olive: '#808000',
  19671. olivedrab: '#6b8e23',
  19672. orange: '#ffa500',
  19673. orangered: '#ff4500',
  19674. orchid: '#da70d6',
  19675. palegoldenrod: '#eee8aa',
  19676. palegreen: '#98fb98',
  19677. paleturquoise: '#afeeee',
  19678. palevioletred: '#d87093',
  19679. papayawhip: '#ffefd5',
  19680. peachpuff: '#ffdab9',
  19681. peru: '#cd853f',
  19682. pink: '#ffc0cb',
  19683. plum: '#dda0dd',
  19684. powderblue: '#b0e0e6',
  19685. purple: '#800080',
  19686. red: '#f00',
  19687. rosybrown: '#bc8f8f',
  19688. royalblue: '#4169e1',
  19689. saddlebrown: '#8b4513',
  19690. salmon: '#fa8072',
  19691. sandybrown: '#f4a460',
  19692. seagreen: '#2e8b57',
  19693. seashell: '#fff5ee',
  19694. sienna: '#a0522d',
  19695. silver: '#c0c0c0',
  19696. skyblue: '#87ceeb',
  19697. slateblue: '#6a5acd',
  19698. slategray: '#708090',
  19699. slategrey: '#708090',
  19700. snow: '#fffafa',
  19701. springgreen: '#00ff7f',
  19702. steelblue: '#4682b4',
  19703. tan: '#d2b48c',
  19704. teal: '#008080',
  19705. thistle: '#d8bfd8',
  19706. tomato: '#ff6347',
  19707. turquoise: '#40e0d0',
  19708. violet: '#ee82ee',
  19709. wheat: '#f5deb3',
  19710. white: '#fff',
  19711. whitesmoke: '#f5f5f5',
  19712. yellow: '#ff0',
  19713. yellowgreen: '#9acd32'
  19714. };
  19715. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Color";
  19716. }
  19717. /**
  19718. * @function LevelRenderer.Tool.Color.prototype.customPalette
  19719. * @description 自定义调色板。
  19720. * @param {Array.<string>} userPalete - 颜色板。
  19721. */
  19722. customPalette(userPalete) {
  19723. this.palette = userPalete;
  19724. }
  19725. /**
  19726. * @function LevelRenderer.Tool.Color.prototype.resetPalette
  19727. * @description 复位默认色板。
  19728. */
  19729. resetPalette() {
  19730. this.palette = this._palette;
  19731. }
  19732. /**
  19733. * @function LevelRenderer.Tool.Color.prototype.getColor
  19734. * @description 获取色板颜色。
  19735. * @param {number} idx - 色板位置。
  19736. * @param {Array.<string>} userPalete - 色板。
  19737. * @returns {string} 颜色值。
  19738. */
  19739. getColor(idx, userPalete) {
  19740. idx = idx | 0;
  19741. userPalete = userPalete || this.palette;
  19742. return userPalete[idx % userPalete.length];
  19743. }
  19744. /**
  19745. * @function LevelRenderer.Tool.Color.prototype.customHighlight
  19746. * @description 自定义默认高亮颜色。
  19747. * @param {string} userHighlightColor - 自定义高亮色。
  19748. */
  19749. customHighlight(userHighlightColor) {
  19750. this.highlightColor = userHighlightColor;
  19751. }
  19752. /**
  19753. * @function LevelRenderer.Tool.Color.prototype.resetHighlight
  19754. * @description 重置默认高亮颜色。将当前的高亮色作为默认高亮颜色
  19755. */
  19756. resetHighlight() {
  19757. this.highlightColor = this._highlightColor;
  19758. }
  19759. /**
  19760. * @function LevelRenderer.Tool.Color.prototype.getHighlightColor
  19761. * @description 获取默认高亮颜色
  19762. * @returns {string} 颜色值。
  19763. */
  19764. getHighlightColor() {
  19765. return this.highlightColor;
  19766. }
  19767. /**
  19768. * @function LevelRenderer.Tool.Color.prototype.getRadialGradient
  19769. * @description 径向渐变。
  19770. * @param {number} x0 - 渐变起点横坐标。
  19771. * @param {number} y0 - 渐变起点纵坐标。
  19772. * @param {number} r0 - 半径
  19773. * @param {number} x1 - 渐变终点横坐标。
  19774. * @param {number} y1 - 渐变终点纵坐标。
  19775. * @param {number} r1 - 半径
  19776. * @param {Array} colorList - 颜色列表。
  19777. * @returns {CanvasGradient} Cavans 渐变颜色。
  19778. */
  19779. getRadialGradient(x0, y0, r0, x1, y1, r1, colorList) {
  19780. var util = this.util;
  19781. if (!this._ctx) {
  19782. this._ctx = util.getContext();
  19783. }
  19784. var gradient = this._ctx.createRadialGradient(x0, y0, r0, x1, y1, r1);
  19785. for (var i = 0, l = colorList.length; i < l; i++) {
  19786. gradient.addColorStop(colorList[i][0], colorList[i][1]);
  19787. }
  19788. gradient.__nonRecursion = true;
  19789. return gradient;
  19790. }
  19791. /**
  19792. * @function LevelRenderer.Tool.Color.prototype.getLinearGradient
  19793. * @description 线性渐变。
  19794. * @param {number} x0 - 渐变起点横坐标。
  19795. * @param {number} y0 - 渐变起点纵坐标。
  19796. * @param {number} x1 - 渐变终点横坐标。
  19797. * @param {number} y1 - 渐变终点纵坐标。
  19798. * @param {Array} colorList - 颜色列表。
  19799. * @returns {CanvasGradient} Cavans 渐变颜色。
  19800. */
  19801. getLinearGradient(x0, y0, x1, y1, colorList) {
  19802. var util = this.util;
  19803. if (!this._ctx) {
  19804. this._ctx = util.getContext();
  19805. }
  19806. var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
  19807. for (var i = 0, l = colorList.length; i < l; i++) {
  19808. gradient.addColorStop(colorList[i][0], colorList[i][1]);
  19809. }
  19810. gradient.__nonRecursion = true;
  19811. return gradient;
  19812. }
  19813. /**
  19814. * @function LevelRenderer.Tool.Color.prototype.getStepColors
  19815. * @description 获取两种颜色之间渐变颜色数组。
  19816. * @param {Object} start - 起始颜色对象。
  19817. * @param {Object} end - 结束颜色对象。
  19818. * @param {number} step - 渐变级数。
  19819. * @returns {Array} 颜色数组。
  19820. */
  19821. getStepColors(start, end, step) {
  19822. start = this.toRGBA(start);
  19823. end = this.toRGBA(end);
  19824. start = this.getData(start);
  19825. end = this.getData(end);
  19826. var colors = [];
  19827. var stepR = (end[0] - start[0]) / step;
  19828. var stepG = (end[1] - start[1]) / step;
  19829. var stepB = (end[2] - start[2]) / step;
  19830. var stepA = (end[3] - start[3]) / step;
  19831. // 生成颜色集合
  19832. // fix by linfeng 颜色堆积
  19833. for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
  19834. colors[i] = this.toColor([
  19835. this.adjust(Math.floor(r), [0, 255]),
  19836. this.adjust(Math.floor(g), [0, 255]),
  19837. this.adjust(Math.floor(b), [0, 255]),
  19838. a.toFixed(4) - 0
  19839. ], 'rgba');
  19840. r += stepR;
  19841. g += stepG;
  19842. b += stepB;
  19843. a += stepA;
  19844. }
  19845. r = end[0];
  19846. g = end[1];
  19847. b = end[2];
  19848. a = end[3];
  19849. colors[i] = this.toColor([r, g, b, a], 'rgba');
  19850. return colors;
  19851. }
  19852. /**
  19853. * @function LevelRenderer.Tool.Color.prototype.getGradientColors
  19854. * @description 获取指定级数的渐变颜色数组。
  19855. * @param {Array.<string>} colors - 颜色数组。
  19856. * @param {number} [step=20] - 渐变级数。
  19857. * @returns {Array.<string>} 颜色数组。
  19858. */
  19859. getGradientColors(colors, step) {
  19860. var ret = [];
  19861. var len = colors.length;
  19862. if (step === undefined) {
  19863. step = 20;
  19864. }
  19865. if (len === 1) {
  19866. ret = this.getStepColors(colors[0], colors[0], step);
  19867. } else if (len > 1) {
  19868. for (var i = 0, n = len - 1; i < n; i++) {
  19869. var steps = this.getStepColors(colors[i], colors[i + 1], step);
  19870. if (i < n - 1) {
  19871. steps.pop();
  19872. }
  19873. ret = ret.concat(steps);
  19874. }
  19875. }
  19876. return ret;
  19877. }
  19878. /**
  19879. * @function LevelRenderer.Tool.Color.prototype.toColor
  19880. * @description 颜色值数组转为指定格式颜色。
  19881. * @param {Array} data - 颜色值数组。
  19882. * @param {string} format - 格式,默认'rgb'
  19883. * @returns {string} 颜色。
  19884. */
  19885. toColor(data, format) {
  19886. format = format || 'rgb';
  19887. if (data && (data.length === 3 || data.length === 4)) {
  19888. data = this.map(data,
  19889. function (c) {
  19890. return c > 1 ? Math.ceil(c) : c;
  19891. }
  19892. );
  19893. if (format.indexOf('hex') > -1) {
  19894. return '#' + ((1 << 24) + (data[0] << 16) + (data[1] << 8) + (+data[2])).toString(16).slice(1);
  19895. } else if (format.indexOf('hs') > -1) {
  19896. var sx = this.map(data.slice(1, 3),
  19897. function (c) {
  19898. return c + '%';
  19899. }
  19900. );
  19901. data[1] = sx[0];
  19902. data[2] = sx[1];
  19903. }
  19904. if (format.indexOf('a') > -1) {
  19905. if (data.length === 3) {
  19906. data.push(1);
  19907. }
  19908. data[3] = this.adjust(data[3], [0, 1]);
  19909. return format + '(' + data.slice(0, 4).join(',') + ')';
  19910. }
  19911. return format + '(' + data.slice(0, 3).join(',') + ')';
  19912. }
  19913. }
  19914. /**
  19915. * @function LevelRenderer.Tool.Color.prototype.toArray
  19916. * @description 颜色字符串转换为rgba数组。
  19917. * @param {string} color - 颜色。
  19918. * @returns {Array.<number>} 颜色值数组。
  19919. */
  19920. toArray(color) {
  19921. color = this.trim(color);
  19922. if (color.indexOf('rgba') < 0) {
  19923. color = this.toRGBA(color);
  19924. }
  19925. var data = [];
  19926. var i = 0;
  19927. color.replace(/[\d.]+/g, function (n) {
  19928. if (i < 3) {
  19929. n = n | 0;
  19930. } else {
  19931. // Alpha
  19932. n = +n;
  19933. }
  19934. data[i++] = n;
  19935. });
  19936. return data;
  19937. }
  19938. /**
  19939. * @function LevelRenderer.Tool.Color.prototype.convert
  19940. * @description 颜色格式转化。
  19941. * @param {Array} data - 颜色值数组。
  19942. * @param {string} format - 格式,默认'rgb'
  19943. * @returns {string} 颜色。
  19944. */
  19945. convert(color, format) {
  19946. if (!this.isCalculableColor(color)) {
  19947. return color;
  19948. }
  19949. var data = this.getData(color);
  19950. var alpha = data[3];
  19951. if (typeof alpha === 'undefined') {
  19952. alpha = 1;
  19953. }
  19954. if (color.indexOf('hsb') > -1) {
  19955. data = this._HSV_2_RGB(data);
  19956. } else if (color.indexOf('hsl') > -1) {
  19957. data = this._HSL_2_RGB(data);
  19958. }
  19959. if (format.indexOf('hsb') > -1 || format.indexOf('hsv') > -1) {
  19960. data = this._RGB_2_HSB(data);
  19961. } else if (format.indexOf('hsl') > -1) {
  19962. data = this._RGB_2_HSL(data);
  19963. }
  19964. data[3] = alpha;
  19965. return this.toColor(data, format);
  19966. }
  19967. /**
  19968. * @function LevelRenderer.Tool.Color.prototype.toRGBA
  19969. * @description 转换为rgba格式的颜色。
  19970. * @param {string} color - 颜色。
  19971. * @returns {string} 颜色。
  19972. */
  19973. toRGBA(color) {
  19974. return this.convert(color, 'rgba');
  19975. }
  19976. /**
  19977. * @function LevelRenderer.Tool.Color.prototype.toRGB
  19978. * @description 转换为rgb数字格式的颜色。
  19979. * @param {string} color - 颜色。
  19980. * @returns {string} 颜色。
  19981. */
  19982. toRGB(color) {
  19983. return this.convert(color, 'rgb');
  19984. }
  19985. /**
  19986. * @function LevelRenderer.Tool.Color.prototype.toHex
  19987. * @description 转换为16进制颜色。
  19988. * @param {string} color - 颜色。
  19989. * @returns {string} 16进制颜色,#rrggbb格式
  19990. */
  19991. toHex(color) {
  19992. return this.convert(color, 'hex');
  19993. }
  19994. /**
  19995. * @function LevelRenderer.Tool.Color.prototype.toHSVA
  19996. * @description 转换为HSV颜色。
  19997. * @param {string} color - 颜色。
  19998. * @returns {string} HSVA颜色,hsva(h,s,v,a)
  19999. */
  20000. toHSVA(color) {
  20001. return this.convert(color, 'hsva');
  20002. }
  20003. /**
  20004. * @function LevelRenderer.Tool.Color.prototype.toHSV
  20005. * @description 转换为HSV颜色。
  20006. * @param {string} color - 颜色。
  20007. * @returns {string} HSV颜色,hsv(h,s,v)
  20008. */
  20009. toHSV(color) {
  20010. return this.convert(color, 'hsv');
  20011. }
  20012. /**
  20013. * @function LevelRenderer.Tool.Color.prototype.toHSBA
  20014. * @description 转换为HSBA颜色。
  20015. * @param {string} color - 颜色。
  20016. * @returns {string} HSBA颜色,hsba(h,s,b,a)
  20017. */
  20018. toHSBA(color) {
  20019. return this.convert(color, 'hsba');
  20020. }
  20021. /**
  20022. * @function LevelRenderer.Tool.Color.prototype.toHSB
  20023. * @description 转换为HSB颜色。
  20024. * @param {string} color - 颜色。
  20025. * @returns {string} HSB颜色,hsb(h,s,b)
  20026. */
  20027. toHSB(color) {
  20028. return this.convert(color, 'hsb');
  20029. }
  20030. /**
  20031. * @function LevelRenderer.Tool.Color.prototype.toHSLA
  20032. * @description 转换为HSLA颜色。
  20033. * @param {string} color - 颜色。
  20034. * @returns {string} HSLA颜色,hsla(h,s,l,a)
  20035. */
  20036. toHSLA(color) {
  20037. return this.convert(color, 'hsla');
  20038. }
  20039. /**
  20040. * @function LevelRenderer.Tool.Color.prototype.toHSL
  20041. * @description 转换为HSL颜色。
  20042. * @param {string} color - 颜色。
  20043. * @returns {string} HSL颜色,hsl(h,s,l)
  20044. */
  20045. toHSL(color) {
  20046. return this.convert(color, 'hsl');
  20047. }
  20048. /**
  20049. * @function LevelRenderer.Tool.Color.prototype.toName
  20050. * @description 转换颜色名。
  20051. * @param {string} color - 颜色。
  20052. * @returns {string} 颜色名
  20053. */
  20054. toName(color) {
  20055. for (var key in this._nameColors) {
  20056. if (this.toHex(this._nameColors[key]) === this.toHex(color)) {
  20057. return key;
  20058. }
  20059. }
  20060. return null;
  20061. }
  20062. /**
  20063. * @function LevelRenderer.Tool.Color.prototype.trim
  20064. * @description 移除颜色中多余空格。
  20065. * @param {string} color - 颜色。
  20066. * @returns {string} 无空格颜色
  20067. */
  20068. trim(color) {
  20069. return String(color).replace(/\s+/g, '');
  20070. }
  20071. /**
  20072. * @function LevelRenderer.Tool.Color.prototype.normalize
  20073. * @description 颜色规范化。
  20074. * @param {string} color - 颜色。
  20075. * @returns {string} 规范化后的颜色
  20076. */
  20077. normalize(color) {
  20078. // 颜色名
  20079. if (this._nameColors[color]) {
  20080. color = this._nameColors[color];
  20081. }
  20082. // 去掉空格
  20083. color = this.trim(color);
  20084. // hsv与hsb等价
  20085. color = color.replace(/hsv/i, 'hsb');
  20086. // rgb转为rrggbb
  20087. if (/^#[\da-f]{3}$/i.test(color)) {
  20088. color = parseInt(color.slice(1), 16);
  20089. var r = (color & 0xf00) << 8;
  20090. var g = (color & 0xf0) << 4;
  20091. var b = color & 0xf;
  20092. color = '#' + ((1 << 24) + (r << 4) + r + (g << 4) + g + (b << 4) + b).toString(16).slice(1);
  20093. }
  20094. // 或者使用以下正则替换,不过 chrome 下性能相对差点
  20095. // color = color.replace(/^#([\da-f])([\da-f])([\da-f])$/i, '#$1$1$2$2$3$3');
  20096. return color;
  20097. }
  20098. /**
  20099. * @function LevelRenderer.Tool.Color.prototype.lift
  20100. * @description 颜色加深或减淡,当level>0加深,当level<0减淡。
  20101. * @param {string} color - 颜色。
  20102. * @param {number} level - 升降程度,取值区间[-1,1]。
  20103. * @returns {string} 加深或减淡后颜色值
  20104. */
  20105. lift(color, level) {
  20106. if (!this.isCalculableColor(color)) {
  20107. return color;
  20108. }
  20109. var direct = level > 0 ? 1 : -1;
  20110. if (typeof level === 'undefined') {
  20111. level = 0;
  20112. }
  20113. level = Math.abs(level) > 1 ? 1 : Math.abs(level);
  20114. color = this.toRGB(color);
  20115. var data = this.getData(color);
  20116. for (var i = 0; i < 3; i++) {
  20117. if (direct === 1) {
  20118. data[i] = data[i] * (1 - level) | 0;
  20119. } else {
  20120. data[i] = ((255 - data[i]) * level + data[i]) | 0;
  20121. }
  20122. }
  20123. return 'rgb(' + data.join(',') + ')';
  20124. }
  20125. /**
  20126. * @function LevelRenderer.Tool.Color.prototype.reverse
  20127. * @description 颜色翻转。[255-r,255-g,255-b,1-a]
  20128. * @param {string} color - 颜色。
  20129. * @returns {string} 翻转颜色
  20130. */
  20131. reverse(color) {
  20132. if (!this.isCalculableColor(color)) {
  20133. return color;
  20134. }
  20135. var data = this.getData(this.toRGBA(color));
  20136. data = this.map(data,
  20137. function (c) {
  20138. return 255 - c;
  20139. }
  20140. );
  20141. return this.toColor(data, 'rgb');
  20142. }
  20143. /**
  20144. * @function LevelRenderer.Tool.Color.prototype.mix
  20145. * @description 简单两种颜色混合
  20146. * @param {string} color1 - 第一种颜色。
  20147. * @param {string} color2 - 第二种颜色。
  20148. * @param {number} weight - 混合权重[0-1]。
  20149. * @returns {string} 结果色。rgb(r,g,b)或rgba(r,g,b,a)
  20150. */
  20151. mix(color1, color2, weight) {
  20152. if (!this.isCalculableColor(color1) || !this.isCalculableColor(color2)) {
  20153. return color1;
  20154. }
  20155. if (typeof weight === 'undefined') {
  20156. weight = 0.5;
  20157. }
  20158. weight = 1 - this.adjust(weight, [0, 1]);
  20159. var w = weight * 2 - 1;
  20160. var data1 = this.getData(this.toRGBA(color1));
  20161. var data2 = this.getData(this.toRGBA(color2));
  20162. var d = data1[3] - data2[3];
  20163. var weight1 = (((w * d === -1) ? w : (w + d) / (1 + w * d)) + 1) / 2;
  20164. var weight2 = 1 - weight1;
  20165. var data = [];
  20166. for (var i = 0; i < 3; i++) {
  20167. data[i] = data1[i] * weight1 + data2[i] * weight2;
  20168. }
  20169. var alpha = data1[3] * weight + data2[3] * (1 - weight);
  20170. alpha = Math.max(0, Math.min(1, alpha));
  20171. if (data1[3] === 1 && data2[3] === 1) {// 不考虑透明度
  20172. return this.toColor(data, 'rgb');
  20173. }
  20174. data[3] = alpha;
  20175. return this.toColor(data, 'rgba');
  20176. }
  20177. /**
  20178. * @function LevelRenderer.Tool.Color.prototype.random
  20179. * @description 随机颜色
  20180. * @returns {string} 颜色值,#rrggbb格式
  20181. */
  20182. random() {
  20183. return '#' + Math.random().toString(16).slice(2, 8);
  20184. }
  20185. /**
  20186. * @function LevelRenderer.Tool.Color.prototype.getData
  20187. * @description 获取颜色值数组,返回值范围。
  20188. * RGB 范围[0-255]
  20189. * HSL/HSV/HSB 范围[0-1]
  20190. * A透明度范围[0-1]
  20191. * 支持格式:
  20192. * #rgb
  20193. * #rrggbb
  20194. * rgb(r,g,b)
  20195. * rgb(r%,g%,b%)
  20196. * rgba(r,g,b,a)
  20197. * hsb(h,s,b) // hsv与hsb等价
  20198. * hsb(h%,s%,b%)
  20199. * hsba(h,s,b,a)
  20200. * hsl(h,s,l)
  20201. * hsl(h%,s%,l%)
  20202. * hsla(h,s,l,a)
  20203. * @param {string} color - 颜色。
  20204. * @returns {Array.<number>} 颜色值数组或null
  20205. */
  20206. getData(color) {
  20207. color = this.normalize(color);
  20208. var r = color.match(this.colorRegExp);
  20209. if (r === null) {
  20210. throw new Error('The color format error'); // 颜色格式错误
  20211. }
  20212. var d;
  20213. var a;
  20214. var data = [];
  20215. var rgb;
  20216. if (r[2]) {
  20217. // #rrggbb
  20218. d = r[2].replace('#', '').split('');
  20219. rgb = [d[0] + d[1], d[2] + d[3], d[4] + d[5]];
  20220. data = this.map(rgb,
  20221. function (c) {
  20222. return Color.prototype.adjust.call(this, parseInt(c, 16), [0, 255]);
  20223. }
  20224. );
  20225. } else if (r[4]) {
  20226. // rgb rgba
  20227. var rgba = (r[4]).split(',');
  20228. a = rgba[3];
  20229. rgb = rgba.slice(0, 3);
  20230. data = this.map(
  20231. rgb,
  20232. function (c) {
  20233. c = Math.floor(
  20234. c.indexOf('%') > 0 ? parseInt(c, 0) * 2.55 : c
  20235. );
  20236. return Color.prototype.adjust.call(this, c, [0, 255]);
  20237. }
  20238. );
  20239. if (typeof a !== 'undefined') {
  20240. data.push(this.adjust(parseFloat(a), [0, 1]));
  20241. }
  20242. } else if (r[5] || r[6]) {
  20243. // hsb hsba hsl hsla
  20244. var hsxa = (r[5] || r[6]).split(',');
  20245. var h = parseInt(hsxa[0], 0) / 360;
  20246. var s = hsxa[1];
  20247. var x = hsxa[2];
  20248. a = hsxa[3];
  20249. data = this.map([s, x],
  20250. function (c) {
  20251. return Color.prototype.adjust.call(this, parseFloat(c) / 100, [0, 1]);
  20252. }
  20253. );
  20254. data.unshift(h);
  20255. if (typeof a !== 'undefined') {
  20256. data.push(this.adjust(parseFloat(a), [0, 1]));
  20257. }
  20258. }
  20259. return data;
  20260. }
  20261. /**
  20262. * @function LevelRenderer.Tool.Color.prototype.alpha
  20263. * @description 设置颜色透明度
  20264. * @param {string} color - 颜色。
  20265. * @param {number} a - 透明度,区间[0,1]。
  20266. * @returns {string} rgba颜色值
  20267. */
  20268. alpha(color, a) {
  20269. if (!this.isCalculableColor(color)) {
  20270. return color;
  20271. }
  20272. if (a === null) {
  20273. a = 1;
  20274. }
  20275. var data = this.getData(this.toRGBA(color));
  20276. data[3] = this.adjust(Number(a).toFixed(4), [0, 1]);
  20277. return this.toColor(data, 'rgba');
  20278. }
  20279. /**
  20280. * @function LevelRenderer.Tool.Color.prototype.map
  20281. * @description 数组映射
  20282. * @param {Array} array - 数组。
  20283. * @param {function} fun - 函数。
  20284. * @returns {string} 数组映射结果
  20285. */
  20286. map(array, fun) {
  20287. if (typeof fun !== 'function') {
  20288. throw new TypeError();
  20289. }
  20290. var len = array ? array.length : 0;
  20291. for (var i = 0; i < len; i++) {
  20292. array[i] = fun(array[i]);
  20293. }
  20294. return array;
  20295. }
  20296. /**
  20297. * @function LevelRenderer.Tool.Color.prototype.adjust
  20298. * @description 调整值区间
  20299. * @param {Array.<number>} value - 数组。
  20300. * @param {Array.<number>} region - 区间。
  20301. * @returns {number} 调整后的值
  20302. */
  20303. adjust(value, region) {
  20304. // < to <= & > to >=
  20305. // modify by linzhifeng 2014-05-25 because -0 == 0
  20306. if (value <= region[0]) {
  20307. value = region[0];
  20308. } else if (value >= region[1]) {
  20309. value = region[1];
  20310. }
  20311. return value;
  20312. }
  20313. /**
  20314. * @function LevelRenderer.Tool.Color.prototype.isCalculableColor
  20315. * @description 判断是否是可计算的颜色
  20316. * @param {string} color - 颜色。
  20317. * @returns {boolean} 是否是可计算的颜色
  20318. */
  20319. isCalculableColor(color) {
  20320. return color instanceof Array || typeof color === 'string';
  20321. }
  20322. /**
  20323. * @function LevelRenderer.Tool.Color.prototype._HSV_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  20324. */
  20325. _HSV_2_RGB(data) {
  20326. var H = data[0];
  20327. var S = data[1];
  20328. var V = data[2];
  20329. // HSV from 0 to 1
  20330. var R;
  20331. var G;
  20332. var B;
  20333. if (S === 0) {
  20334. R = V * 255;
  20335. G = V * 255;
  20336. B = V * 255;
  20337. } else {
  20338. var h = H * 6;
  20339. if (h === 6) {
  20340. h = 0;
  20341. }
  20342. var i = h | 0;
  20343. var v1 = V * (1 - S);
  20344. var v2 = V * (1 - S * (h - i));
  20345. var v3 = V * (1 - S * (1 - (h - i)));
  20346. var r = 0;
  20347. var g = 0;
  20348. var b = 0;
  20349. if (i === 0) {
  20350. r = V;
  20351. g = v3;
  20352. b = v1;
  20353. } else if (i === 1) {
  20354. r = v2;
  20355. g = V;
  20356. b = v1;
  20357. } else if (i === 2) {
  20358. r = v1;
  20359. g = V;
  20360. b = v3;
  20361. } else if (i === 3) {
  20362. r = v1;
  20363. g = v2;
  20364. b = V;
  20365. } else if (i === 4) {
  20366. r = v3;
  20367. g = v1;
  20368. b = V;
  20369. } else {
  20370. r = V;
  20371. g = v1;
  20372. b = v2;
  20373. }
  20374. // RGB results from 0 to 255
  20375. R = r * 255;
  20376. G = g * 255;
  20377. B = b * 255;
  20378. }
  20379. return [R, G, B];
  20380. }
  20381. /**
  20382. * @function LevelRenderer.Tool.Color.prototype._HSL_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  20383. */
  20384. _HSL_2_RGB(data) {
  20385. var H = data[0];
  20386. var S = data[1];
  20387. var L = data[2];
  20388. // HSL from 0 to 1
  20389. var R;
  20390. var G;
  20391. var B;
  20392. if (S === 0) {
  20393. R = L * 255;
  20394. G = L * 255;
  20395. B = L * 255;
  20396. } else {
  20397. var v2;
  20398. if (L < 0.5) {
  20399. v2 = L * (1 + S);
  20400. } else {
  20401. v2 = (L + S) - (S * L);
  20402. }
  20403. var v1 = 2 * L - v2;
  20404. R = 255 * this._HUE_2_RGB(v1, v2, H + (1 / 3));
  20405. G = 255 * this._HUE_2_RGB(v1, v2, H);
  20406. B = 255 * this._HUE_2_RGB(v1, v2, H - (1 / 3));
  20407. }
  20408. return [R, G, B];
  20409. }
  20410. /**
  20411. * @function LevelRenderer.Tool.Color.prototype._HUE_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  20412. */
  20413. _HUE_2_RGB(v1, v2, vH) {
  20414. if (vH < 0) {
  20415. vH += 1;
  20416. }
  20417. if (vH > 1) {
  20418. vH -= 1;
  20419. }
  20420. if ((6 * vH) < 1) {
  20421. return (v1 + (v2 - v1) * 6 * vH);
  20422. }
  20423. if ((2 * vH) < 1) {
  20424. return (v2);
  20425. }
  20426. if ((3 * vH) < 2) {
  20427. return (v1 + (v2 - v1) * ((2 / 3) - vH) * 6);
  20428. }
  20429. return v1;
  20430. }
  20431. /**
  20432. * @function LevelRenderer.Tool.Color.prototype._RGB_2_HSB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  20433. */
  20434. _RGB_2_HSB(data) {
  20435. // RGB from 0 to 255
  20436. var R = (data[0] / 255);
  20437. var G = (data[1] / 255);
  20438. var B = (data[2] / 255);
  20439. var vMin = Math.min(R, G, B); // Min. value of RGB
  20440. var vMax = Math.max(R, G, B); // Max. value of RGB
  20441. var delta = vMax - vMin; // Delta RGB value
  20442. var V = vMax;
  20443. var H;
  20444. var S;
  20445. // HSV results from 0 to 1
  20446. if (delta === 0) {
  20447. H = 0;
  20448. S = 0;
  20449. } else {
  20450. S = delta / vMax;
  20451. var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
  20452. var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
  20453. var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
  20454. if (R === vMax) {
  20455. H = deltaB - deltaG;
  20456. } else if (G === vMax) {
  20457. H = (1 / 3) + deltaR - deltaB;
  20458. } else if (B === vMax) {
  20459. H = (2 / 3) + deltaG - deltaR;
  20460. }
  20461. if (H < 0) {
  20462. H += 1;
  20463. }
  20464. if (H > 1) {
  20465. H -= 1;
  20466. }
  20467. }
  20468. H = H * 360;
  20469. S = S * 100;
  20470. V = V * 100;
  20471. return [H, S, V];
  20472. }
  20473. /**
  20474. * @function LevelRenderer.Tool.Color.prototype._RGB_2_HSL。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  20475. */
  20476. _RGB_2_HSL(data) {
  20477. // RGB from 0 to 255
  20478. var R = (data[0] / 255);
  20479. var G = (data[1] / 255);
  20480. var B = (data[2] / 255);
  20481. var vMin = Math.min(R, G, B); // Min. value of RGB
  20482. var vMax = Math.max(R, G, B); // Max. value of RGB
  20483. var delta = vMax - vMin; // Delta RGB value
  20484. var L = (vMax + vMin) / 2;
  20485. var H;
  20486. var S;
  20487. // HSL results from 0 to 1
  20488. if (delta === 0) {
  20489. H = 0;
  20490. S = 0;
  20491. } else {
  20492. if (L < 0.5) {
  20493. S = delta / (vMax + vMin);
  20494. } else {
  20495. S = delta / (2 - vMax - vMin);
  20496. }
  20497. var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
  20498. var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
  20499. var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
  20500. if (R === vMax) {
  20501. H = deltaB - deltaG;
  20502. } else if (G === vMax) {
  20503. H = (1 / 3) + deltaR - deltaB;
  20504. } else if (B === vMax) {
  20505. H = (2 / 3) + deltaG - deltaR;
  20506. }
  20507. if (H < 0) {
  20508. H += 1;
  20509. }
  20510. if (H > 1) {
  20511. H -= 1;
  20512. }
  20513. }
  20514. H = H * 360;
  20515. S = S * 100;
  20516. L = L * 100;
  20517. return [H, S, L];
  20518. }
  20519. }
  20520. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/ComputeBoundingBox.js
  20521. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20522. * This program are made available under the terms of the Apache License, Version 2.0
  20523. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20524. /**
  20525. * @class LevelRenderer.Tool.ComputeBoundingBox
  20526. * @category Visualization Theme
  20527. * @classdesc LevelRenderer 工具-图形 Bounds 计算
  20528. * @private
  20529. */
  20530. class ComputeBoundingBox {
  20531. constructor() {
  20532. if (arguments.length === 3) {
  20533. this.computeBoundingBox(arguments);
  20534. }
  20535. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.ComputeBoundingBox";
  20536. }
  20537. /**
  20538. * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.computeBoundingBox
  20539. * @description 从顶点数组中计算出最小包围盒,写入'min'和'max'中。
  20540. * @param {Array.<Object>} points - 顶点数组。
  20541. * @param {Array.<number>} min - 最小
  20542. * @param {Array.<number>} max - 最大
  20543. */
  20544. computeBoundingBox(points, min, max) {
  20545. if (points.length === 0) {
  20546. return;
  20547. }
  20548. var left = points[0][0];
  20549. var right = points[0][0];
  20550. var top = points[0][1];
  20551. var bottom = points[0][1];
  20552. for (var i = 1; i < points.length; i++) {
  20553. var p = points[i];
  20554. if (p[0] < left) {
  20555. left = p[0];
  20556. }
  20557. if (p[0] > right) {
  20558. right = p[0];
  20559. }
  20560. if (p[1] < top) {
  20561. top = p[1];
  20562. }
  20563. if (p[1] > bottom) {
  20564. bottom = p[1];
  20565. }
  20566. }
  20567. min[0] = left;
  20568. min[1] = top;
  20569. max[0] = right;
  20570. max[1] = bottom;
  20571. }
  20572. /**
  20573. * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.cubeBezier
  20574. * @description 从三阶贝塞尔曲线(p0, p1, p2, p3)中计算出最小包围盒,写入'min'和'max'中。原:computeCubeBezierBoundingBox。
  20575. * @param {Array.<number>} p0 - 三阶贝塞尔曲线p0点
  20576. * @param {Array.<number>} p1 - 三阶贝塞尔曲线p1点
  20577. * @param {Array.<number>} p2 - 三阶贝塞尔曲线p2点
  20578. * @param {Array.<number>} p3 - 三阶贝塞尔曲线p3点
  20579. * @param {Array.<number>} min - 最小
  20580. * @param {Array.<number>} max - 最大
  20581. */
  20582. cubeBezier(p0, p1, p2, p3, min, max) {
  20583. var curve = new Curve_Curve();
  20584. var xDim = [];
  20585. curve.cubicExtrema(p0[0], p1[0], p2[0], p3[0], xDim);
  20586. for (let i = 0; i < xDim.length; i++) {
  20587. xDim[i] = curve.cubicAt(p0[0], p1[0], p2[0], p3[0], xDim[i]);
  20588. }
  20589. var yDim = [];
  20590. curve.cubicExtrema(p0[1], p1[1], p2[1], p3[1], yDim);
  20591. for (let i = 0; i < yDim.length; i++) {
  20592. yDim[i] = curve.cubicAt(p0[1], p1[1], p2[1], p3[1], yDim[i]);
  20593. }
  20594. xDim.push(p0[0], p3[0]);
  20595. yDim.push(p0[1], p3[1]);
  20596. var left = Math.min.apply(null, xDim);
  20597. var right = Math.max.apply(null, xDim);
  20598. var top = Math.min.apply(null, yDim);
  20599. var bottom = Math.max.apply(null, yDim);
  20600. min[0] = left;
  20601. min[1] = top;
  20602. max[0] = right;
  20603. max[1] = bottom;
  20604. }
  20605. /**
  20606. * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.quadraticBezier
  20607. * @description 从二阶贝塞尔曲线(p0, p1, p2)中计算出最小包围盒,写入'min'和'max'中。原:computeQuadraticBezierBoundingBox。
  20608. * @param {Array.<number>} p0 - 二阶贝塞尔曲线p0点
  20609. * @param {Array.<number>} p1 - 二阶贝塞尔曲线p1点
  20610. * @param {Array.<number>} p2 - 二阶贝塞尔曲线p2点
  20611. * @param {Array.<number>} min - 最小
  20612. * @param {Array.<number>} max - 最大
  20613. */
  20614. quadraticBezier(p0, p1, p2, min, max) {
  20615. var curve = new Curve_Curve();
  20616. // Find extremities, where derivative in x dim or y dim is zero
  20617. var t1 = curve.quadraticExtremum(p0[0], p1[0], p2[0]);
  20618. var t2 = curve.quadraticExtremum(p0[1], p1[1], p2[1]);
  20619. t1 = Math.max(Math.min(t1, 1), 0);
  20620. t2 = Math.max(Math.min(t2, 1), 0);
  20621. var ct1 = 1 - t1;
  20622. var ct2 = 1 - t2;
  20623. var x1 = ct1 * ct1 * p0[0]
  20624. + 2 * ct1 * t1 * p1[0]
  20625. + t1 * t1 * p2[0];
  20626. var y1 = ct1 * ct1 * p0[1]
  20627. + 2 * ct1 * t1 * p1[1]
  20628. + t1 * t1 * p2[1];
  20629. var x2 = ct2 * ct2 * p0[0]
  20630. + 2 * ct2 * t2 * p1[0]
  20631. + t2 * t2 * p2[0];
  20632. var y2 = ct2 * ct2 * p0[1]
  20633. + 2 * ct2 * t2 * p1[1]
  20634. + t2 * t2 * p2[1];
  20635. min[0] = Math.min(p0[0], p2[0], x1, x2);
  20636. min[1] = Math.min(p0[1], p2[1], y1, y2);
  20637. max[0] = Math.max(p0[0], p2[0], x1, x2);
  20638. max[1] = Math.max(p0[1], p2[1], y1, y2);
  20639. }
  20640. /**
  20641. * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.arc
  20642. * @description 从圆弧中计算出最小包围盒,写入'min'和'max'中。原:computeArcBoundingBox。
  20643. * @param {number} x - 圆弧中心点 x
  20644. * @param {number} y - 圆弧中心点 y
  20645. * @param {number} r - 圆弧半径
  20646. * @param {number} startAngle - 圆弧开始角度
  20647. * @param {number} endAngle - 圆弧结束角度
  20648. * @param {number} anticlockwise - 是否是顺时针
  20649. * @param {number} min - 最小
  20650. * @param {number} max - 最大
  20651. */
  20652. arc(x, y, r, startAngle, endAngle, anticlockwise, min, max) {
  20653. var vec2 = new Vector_Vector();
  20654. var start = vec2.create();
  20655. var end = vec2.create();
  20656. var extremity = vec2.create();
  20657. start[0] = Math.cos(startAngle) * r + x;
  20658. start[1] = Math.sin(startAngle) * r + y;
  20659. end[0] = Math.cos(endAngle) * r + x;
  20660. end[1] = Math.sin(endAngle) * r + y;
  20661. vec2.min(min, start, end);
  20662. vec2.max(max, start, end);
  20663. // Thresh to [0, Math.PI * 2]
  20664. startAngle = startAngle % (Math.PI * 2);
  20665. if (startAngle < 0) {
  20666. startAngle = startAngle + Math.PI * 2;
  20667. }
  20668. endAngle = endAngle % (Math.PI * 2);
  20669. if (endAngle < 0) {
  20670. endAngle = endAngle + Math.PI * 2;
  20671. }
  20672. if (startAngle > endAngle && !anticlockwise) {
  20673. endAngle += Math.PI * 2;
  20674. } else if (startAngle < endAngle && anticlockwise) {
  20675. startAngle += Math.PI * 2;
  20676. }
  20677. if (anticlockwise) {
  20678. var tmp = endAngle;
  20679. endAngle = startAngle;
  20680. startAngle = tmp;
  20681. }
  20682. // var number = 0;
  20683. // var step = (anticlockwise ? -Math.PI : Math.PI) / 2;
  20684. for (var angle = 0; angle < endAngle; angle += Math.PI / 2) {
  20685. if (angle > startAngle) {
  20686. extremity[0] = Math.cos(angle) * r + x;
  20687. extremity[1] = Math.sin(angle) * r + y;
  20688. vec2.min(min, extremity, min);
  20689. vec2.max(max, extremity, max);
  20690. }
  20691. }
  20692. }
  20693. }
  20694. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Env.js
  20695. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20696. * This program are made available under the terms of the Apache License, Version 2.0
  20697. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20698. /**
  20699. * @class LevelRenderer.Tool.Env
  20700. * @category Visualization Theme
  20701. * @classdesc 环境识别
  20702. * @private
  20703. */
  20704. class Env {
  20705. constructor() {
  20706. // Zepto.js
  20707. // (c) 2010-2013 Thomas Fuchs
  20708. // Zepto.js may be freely distributed under the MIT license.
  20709. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Env";
  20710. var me = this;
  20711. function detect(ua) {
  20712. var os = me.os = {};
  20713. var browser = me.browser = {};
  20714. var webkit = ua.match(/Web[kK]it[\/]{0,1}([\d.]+)/);
  20715. var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
  20716. var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
  20717. var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
  20718. var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
  20719. var webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/);
  20720. var touchpad = webos && ua.match(/TouchPad/);
  20721. var kindle = ua.match(/Kindle\/([\d.]+)/);
  20722. var silk = ua.match(/Silk\/([\d._]+)/);
  20723. var blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/);
  20724. var bb10 = ua.match(/(BB10).*Version\/([\d.]+)/);
  20725. var rimtabletos = ua.match(/(RIM\sTablet\sOS)\s([\d.]+)/);
  20726. var playbook = ua.match(/PlayBook/);
  20727. var chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/);
  20728. var firefox = ua.match(/Firefox\/([\d.]+)/);
  20729. var ie = ua.match(/MSIE ([\d.]+)/);
  20730. var safari = webkit && ua.match(/Mobile\//) && !chrome;
  20731. var webview = ua.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/) && !chrome;
  20732. // Todo: clean this up with a better OS/browser seperation:
  20733. // - discern (more) between multiple browsers on android
  20734. // - decide if kindle fire in silk mode is android or not
  20735. // - Firefox on Android doesn't specify the Android version
  20736. // - possibly devide in os, device and browser hashes
  20737. /*eslint-disable*/
  20738. if (browser.webkit = !!webkit) {
  20739. browser.version = webkit[1];
  20740. }
  20741. if (android) {
  20742. os.android = true;
  20743. os.version = android[2];
  20744. }
  20745. if (iphone && !ipod) {
  20746. os.ios = os.iphone = true;
  20747. os.version = iphone[2].replace(/_/g, '.');
  20748. }
  20749. if (ipad) {
  20750. os.ios = os.ipad = true;
  20751. os.version = ipad[2].replace(/_/g, '.');
  20752. }
  20753. if (ipod) {
  20754. os.ios = os.ipod = true;
  20755. os.version = ipod[3] ? ipod[3].replace(/_/g, '.') : null;
  20756. }
  20757. if (webos) {
  20758. os.webos = true;
  20759. os.version = webos[2];
  20760. }
  20761. if (touchpad) {
  20762. os.touchpad = true;
  20763. }
  20764. if (blackberry) {
  20765. os.blackberry = true;
  20766. os.version = blackberry[2];
  20767. }
  20768. if (bb10) {
  20769. os.bb10 = true;
  20770. os.version = bb10[2];
  20771. }
  20772. if (rimtabletos) {
  20773. os.rimtabletos = true;
  20774. os.version = rimtabletos[2];
  20775. }
  20776. if (playbook) {
  20777. browser.playbook = true;
  20778. }
  20779. if (kindle) {
  20780. os.kindle = true;
  20781. os.version = kindle[1];
  20782. }
  20783. if (silk) {
  20784. browser.silk = true;
  20785. browser.version = silk[1];
  20786. }
  20787. if (!silk && os.android && ua.match(/Kindle Fire/)) {
  20788. browser.silk = true;
  20789. }
  20790. if (chrome) {
  20791. browser.chrome = true;
  20792. browser.version = chrome[1];
  20793. }
  20794. if (firefox) {
  20795. browser.firefox = true;
  20796. browser.version = firefox[1];
  20797. }
  20798. if (ie) {
  20799. browser.ie = true;
  20800. browser.version = ie[1];
  20801. }
  20802. if (safari && (ua.match(/Safari/) || !!os.ios)) {
  20803. browser.safari = true;
  20804. }
  20805. if (webview) {
  20806. browser.webview = true;
  20807. }
  20808. if (ie) {
  20809. browser.ie = true;
  20810. browser.version = ie[1];
  20811. }
  20812. os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) ||
  20813. (firefox && ua.match(/Tablet/)) || (ie && !ua.match(/Phone/) && ua.match(/Touch/)));
  20814. os.phone = !!(!os.tablet && !os.ipod && (android || iphone || webos || blackberry || bb10 ||
  20815. (chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\/([\d.]+)/)) ||
  20816. (firefox && ua.match(/Mobile/)) || (ie && ua.match(/Touch/))));
  20817. return {
  20818. browser: browser,
  20819. os: os,
  20820. // 原生canvas支持
  20821. canvasSupported: document.createElement('canvas').getContext ? true : false
  20822. };
  20823. }
  20824. return detect(navigator.userAgent);
  20825. }
  20826. destory() {
  20827. return true;
  20828. }
  20829. }
  20830. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Event.js
  20831. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20832. * This program are made available under the terms of the Apache License, Version 2.0
  20833. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20834. /**
  20835. * @class LevelRenderer.Tool.Event
  20836. * @category Visualization Theme
  20837. * @classdesc LevelRenderer 工具-事件辅助类
  20838. * @private
  20839. */
  20840. class Event {
  20841. constructor() {
  20842. /**
  20843. * @member {function} LevelRenderer.Tool.Event.prototype.stop
  20844. * @description 停止冒泡和阻止默认行为
  20845. */
  20846. this.stop = typeof window.addEventListener === 'function'
  20847. ? function (e) {
  20848. e.preventDefault();
  20849. e.stopPropagation();
  20850. e.cancelBubble = true;
  20851. }
  20852. : function (e) {
  20853. e.returnValue = false;
  20854. e.cancelBubble = true;
  20855. };
  20856. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Event";
  20857. }
  20858. /**
  20859. * @function LevelRenderer.Tool.Event.prototype.getX
  20860. * @description 提取鼠标(手指)x坐标。
  20861. * @param {Event} e - 事件。
  20862. * @returns {number} 鼠标(手指)x坐标。
  20863. */
  20864. getX(e) {
  20865. return typeof e.zrenderX != 'undefined' && e.zrenderX
  20866. || typeof e.offsetX != 'undefined' && e.offsetX
  20867. || typeof e.layerX != 'undefined' && e.layerX
  20868. || typeof e.clientX != 'undefined' && e.clientX;
  20869. }
  20870. /**
  20871. * @function LevelRenderer.Tool.Event.prototype.getY
  20872. * @description 提取鼠标(手指)y坐标。
  20873. * @param {Event} e - 事件。
  20874. * @returns {number} 鼠标(手指)y坐标。
  20875. */
  20876. getY(e) {
  20877. return typeof e.zrenderY != 'undefined' && e.zrenderY
  20878. || typeof e.offsetY != 'undefined' && e.offsetY
  20879. || typeof e.layerY != 'undefined' && e.layerY
  20880. || typeof e.clientY != 'undefined' && e.clientY;
  20881. }
  20882. /**
  20883. * @function LevelRenderer.Tool.Event.prototype.getDelta
  20884. * @description 提取鼠标滚轮变化。
  20885. * @param {Event} e - 事件。
  20886. * @returns {number} 滚轮变化,正值说明滚轮是向上滚动,如果是负值说明滚轮是向下滚动。
  20887. */
  20888. getDelta(e) {
  20889. return typeof e.zrenderDelta != 'undefined' && e.zrenderDelta
  20890. || typeof e.wheelDelta != 'undefined' && e.wheelDelta
  20891. || typeof e.detail != 'undefined' && -e.detail;
  20892. }
  20893. }
  20894. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Http.js
  20895. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20896. * This program are made available under the terms of the Apache License, Version 2.0
  20897. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20898. /**
  20899. * @private
  20900. * @class LevelRenderer.Tool.Http
  20901. * @category Visualization Theme
  20902. * @classdesc LevelRenderer 工具-Http
  20903. */
  20904. class Http {
  20905. constructor() {
  20906. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Http"
  20907. }
  20908. /**
  20909. * @function LevelRenderer.Tool.Http.prototype.get
  20910. * @description get请求。
  20911. * @param {(string|IHTTPGetOption)} url - 请求url
  20912. * @param {function} onsuccess - 请求成功函数
  20913. * @param {function} onerror - 请求失败函数
  20914. * @param {Object} opts - 额外参数
  20915. * @returns {number} cos值
  20916. */
  20917. get(url, onsuccess, onerror) {
  20918. if (typeof(url) === 'object') {
  20919. var obj = url;
  20920. url = obj.url;
  20921. onsuccess = obj.onsuccess;
  20922. onerror = obj.onerror;
  20923. }
  20924. var xhr = window.XMLHttpRequest
  20925. ? new XMLHttpRequest()
  20926. : new window.ActiveXObject('Microsoft.XMLHTTP');
  20927. xhr.open('GET', url, true);
  20928. xhr.onreadystatechange = function () {
  20929. if (xhr.readyState == 4) {
  20930. if (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
  20931. onsuccess && onsuccess(xhr.responseText);
  20932. } else {
  20933. onerror && onerror();
  20934. }
  20935. xhr.onreadystatechange = new Function();
  20936. xhr = null;
  20937. }
  20938. };
  20939. xhr.send(null);
  20940. }
  20941. }
  20942. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Config.js
  20943. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20944. * This program are made available under the terms of the Apache License, Version 2.0
  20945. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20946. class Config {
  20947. }
  20948. /**
  20949. * @enum EVENT
  20950. * @description 事件
  20951. * @type {Object}
  20952. * @private
  20953. */
  20954. Config.EVENT = {
  20955. //窗口大小变化
  20956. RESIZE: 'resize',
  20957. //鼠标按钮被(手指)按下,事件对象是:目标图形元素或空
  20958. CLICK: 'click',
  20959. //双击事件
  20960. DBLCLICK: 'dblclick',
  20961. //鼠标滚轮变化,事件对象是:目标图形元素或空
  20962. MOUSEWHEEL: 'mousewheel',
  20963. //鼠标(手指)被移动,事件对象是:目标图形元素或空
  20964. MOUSEMOVE: 'mousemove',
  20965. //鼠标移到某图形元素之上,事件对象是:目标图形元素
  20966. MOUSEOVER: 'mouseover',
  20967. //鼠标从某图形元素移开,事件对象是:目标图形元素
  20968. MOUSEOUT: 'mouseout',
  20969. //鼠标按钮(手指)被按下,事件对象是:目标图形元素或空
  20970. MOUSEDOWN: 'mousedown',
  20971. //鼠标按键(手指)被松开,事件对象是:目标图形元素或空
  20972. MOUSEUP: 'mouseup',
  20973. //全局离开,MOUSEOUT触发比较频繁,一次离开优化绑定
  20974. GLOBALOUT: 'globalout',
  20975. // 一次成功元素拖拽的行为事件过程是:
  20976. // dragstart > dragenter > dragover [> dragleave] > drop > dragend
  20977. //开始拖拽时触发,事件对象是:被拖拽图形元素
  20978. DRAGSTART: 'dragstart',
  20979. //拖拽完毕时触发(在drop之后触发),事件对象是:被拖拽图形元素
  20980. DRAGEND: 'dragend',
  20981. //拖拽图形元素进入目标图形元素时触发,事件对象是:目标图形元素
  20982. DRAGENTER: 'dragenter',
  20983. //拖拽图形元素在目标图形元素上移动时触发,事件对象是:目标图形元素
  20984. DRAGOVER: 'dragover',
  20985. //拖拽图形元素离开目标图形元素时触发,事件对象是:目标图形元素
  20986. DRAGLEAVE: 'dragleave',
  20987. //拖拽图形元素放在目标图形元素内时触发,事件对象是:目标图形元素
  20988. DROP: 'drop',
  20989. //touch end - start < delay is click
  20990. touchClickDelay: 300
  20991. };
  20992. /**
  20993. * @enum catchBrushException
  20994. * @description 是否异常捕获
  20995. * @type {boolean}
  20996. * @private
  20997. */
  20998. Config.catchBrushException = false;
  20999. /**
  21000. * @enum debugMode
  21001. * @description debug 日志选项:catchBrushException 为 true 下有效。
  21002. * 0 : 不生成debug数据,发布用
  21003. * 1 : 异常抛出,调试用
  21004. * 2 : 控制台输出,调试用
  21005. * @type {boolean}
  21006. * @private
  21007. */
  21008. Config.debugMode = 0;
  21009. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Log.js
  21010. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21011. * This program are made available under the terms of the Apache License, Version 2.0
  21012. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21013. /**
  21014. * @private
  21015. * @class LevelRenderer.Tool.Log
  21016. * @category Visualization Theme
  21017. * @classdesc LevelRenderer 工具-日志
  21018. */
  21019. class Log {
  21020. constructor() {
  21021. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Log";
  21022. return function () {
  21023. if (+Config.debugMode === 0) {
  21024. return;
  21025. } else if (+Config.debugMode === 1) {
  21026. for (let k in arguments) {
  21027. throw new Error(arguments[k]);
  21028. }
  21029. } else if (+Config.debugMode > 1) {
  21030. for (let k in arguments) {
  21031. console.log(arguments[k]);
  21032. }
  21033. }
  21034. };
  21035. /* for debug
  21036. return function(mes) {
  21037. document.getElementById('wrong-message').innerHTML =
  21038. mes + ' ' + (new Date() - 0)
  21039. + '<br/>'
  21040. + document.getElementById('wrong-message').innerHTML;
  21041. };
  21042. */
  21043. }
  21044. destory() {
  21045. return true;
  21046. }
  21047. }
  21048. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Math.js
  21049. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21050. * This program are made available under the terms of the Apache License, Version 2.0
  21051. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21052. /**
  21053. * @private
  21054. * @class LevelRenderer.Tool.Math
  21055. * @category Visualization Theme
  21056. * @classdesc LevelRenderer 工具-数学辅助类
  21057. */
  21058. class MathTool {
  21059. constructor() {
  21060. /**
  21061. * @member {number} LevelRenderer.Tool.Math._radians
  21062. * @description 角度与弧度转化参数
  21063. */
  21064. this._radians = window.Math.PI / 180;
  21065. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Math";
  21066. }
  21067. /**
  21068. * @function LevelRenderer.Tool.Math.prototype.sin
  21069. * @description 正弦函数。
  21070. * @param {number} angle - 弧度(角度)参数。
  21071. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  21072. * @returns {number} sin 值。
  21073. */
  21074. sin(angle, isDegrees) {
  21075. return window.Math.sin(isDegrees ? angle * this._radians : angle);
  21076. }
  21077. /**
  21078. * @function LevelRenderer.Tool.Math.prototype.cos
  21079. * @description 余弦函数。
  21080. * @param {number} angle - 弧度(角度)参数。
  21081. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  21082. * @returns {number} cos 值。
  21083. */
  21084. cos(angle, isDegrees) {
  21085. return window.Math.cos(isDegrees ? angle * this._radians : angle);
  21086. }
  21087. /**
  21088. * @function LevelRenderer.Tool.Math.prototype.degreeToRadian
  21089. * @description 角度转弧度。
  21090. * @param {number} angle - 弧度(角度)参数。
  21091. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  21092. * @returns {number} 弧度值。
  21093. */
  21094. degreeToRadian(angle) {
  21095. return angle * this._radians;
  21096. }
  21097. /**
  21098. * @function LevelRenderer.Tool.Math.prototype.radianToDegree
  21099. * @description 弧度转角度。
  21100. * @param {number} angle - 弧度(角度)参数。
  21101. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  21102. * @returns {number} 角度。
  21103. */
  21104. radianToDegree(angle) {
  21105. return angle / this._radians;
  21106. }
  21107. }
  21108. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Matrix.js
  21109. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21110. * This program are made available under the terms of the Apache License, Version 2.0
  21111. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21112. /**
  21113. * @private
  21114. * @class LevelRenderer.Tool.Matrix
  21115. * @category Visualization Theme
  21116. * @classdesc LevelRenderer 工具-3x2矩阵操作类
  21117. */
  21118. class Matrix {
  21119. constructor() {
  21120. /**
  21121. * @member {Object} LevelRenderer.Tool.Matrix.prototype.ArrayCtor
  21122. * @description 数组类型控制
  21123. */
  21124. this.ArrayCtor = typeof Float32Array === 'undefined'
  21125. ? Array
  21126. : Float32Array;
  21127. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Matrix";
  21128. }
  21129. /**
  21130. * @function LevelRenderer.Tool.Matrix.prototype.create
  21131. * @description 创建一个单位矩阵。
  21132. * @returns {(Float32Array|Array.<number>)} 单位矩阵。
  21133. */
  21134. create() {
  21135. var ArrayCtor = this.ArrayCtor;
  21136. var out = new ArrayCtor(6);
  21137. this.identity(out);
  21138. return out;
  21139. }
  21140. /**
  21141. * @function LevelRenderer.Tool.Matrix.prototype.identity
  21142. * @description 设置矩阵为单位矩阵。
  21143. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  21144. * @returns {(Float32Array|Array.<number>)} 单位矩阵。
  21145. */
  21146. identity(out) {
  21147. out[0] = 1;
  21148. out[1] = 0;
  21149. out[2] = 0;
  21150. out[3] = 1;
  21151. out[4] = 0;
  21152. out[5] = 0;
  21153. return out;
  21154. }
  21155. /**
  21156. * @function LevelRenderer.Tool.Matrix.prototype.copy
  21157. * @description 复制矩阵。
  21158. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  21159. * @returns {(Float32Array|Array.<number>)} 克隆矩阵。
  21160. */
  21161. copy(out, m) {
  21162. out[0] = m[0];
  21163. out[1] = m[1];
  21164. out[2] = m[2];
  21165. out[3] = m[3];
  21166. out[4] = m[4];
  21167. out[5] = m[5];
  21168. return out;
  21169. }
  21170. /**
  21171. * @function LevelRenderer.Tool.Matrix.prototype.mul
  21172. * @description 矩阵相乘。
  21173. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  21174. * @param {(Float32Array|Array.<number>)} m1 - 矩阵m1。
  21175. * @param {(Float32Array|Array.<number>)} m2- 矩阵m2。
  21176. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  21177. */
  21178. mul(out, m1, m2) {
  21179. out[0] = m1[0] * m2[0] + m1[2] * m2[1];
  21180. out[1] = m1[1] * m2[0] + m1[3] * m2[1];
  21181. out[2] = m1[0] * m2[2] + m1[2] * m2[3];
  21182. out[3] = m1[1] * m2[2] + m1[3] * m2[3];
  21183. out[4] = m1[0] * m2[4] + m1[2] * m2[5] + m1[4];
  21184. out[5] = m1[1] * m2[4] + m1[3] * m2[5] + m1[5];
  21185. return out;
  21186. }
  21187. /**
  21188. * @function LevelRenderer.Tool.Matrix.prototype.mul
  21189. * @description 平移变换。
  21190. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  21191. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  21192. * @param {(Float32Array|Array.<number>)} v- 平移参数。
  21193. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  21194. */
  21195. translate(out, a, v) {
  21196. out[0] = a[0];
  21197. out[1] = a[1];
  21198. out[2] = a[2];
  21199. out[3] = a[3];
  21200. out[4] = a[4] + v[0];
  21201. out[5] = a[5] + v[1];
  21202. return out;
  21203. }
  21204. /**
  21205. * @function LevelRenderer.Tool.Matrix.prototype.rotate
  21206. * @description 平移变换。
  21207. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  21208. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  21209. * @param {(Float32Array|Array.<number>)} rad - 旋转参数。
  21210. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  21211. */
  21212. rotate(out, a, rad) {
  21213. var aa = a[0];
  21214. var ac = a[2];
  21215. var atx = a[4];
  21216. var ab = a[1];
  21217. var ad = a[3];
  21218. var aty = a[5];
  21219. var st = Math.sin(rad);
  21220. var ct = Math.cos(rad);
  21221. out[0] = aa * ct + ab * st;
  21222. out[1] = -aa * st + ab * ct;
  21223. out[2] = ac * ct + ad * st;
  21224. out[3] = -ac * st + ct * ad;
  21225. out[4] = ct * atx + st * aty;
  21226. out[5] = ct * aty - st * atx;
  21227. return out;
  21228. }
  21229. /**
  21230. * @function LevelRenderer.Tool.Matrix.prototype.scale
  21231. * @description 缩放变换。
  21232. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  21233. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  21234. * @param {(Float32Array|Array.<number>)} v - 缩放参数。
  21235. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  21236. */
  21237. scale(out, a, v) {
  21238. var vx = v[0];
  21239. var vy = v[1];
  21240. out[0] = a[0] * vx;
  21241. out[1] = a[1] * vy;
  21242. out[2] = a[2] * vx;
  21243. out[3] = a[3] * vy;
  21244. out[4] = a[4] * vx;
  21245. out[5] = a[5] * vy;
  21246. return out;
  21247. }
  21248. /**
  21249. * @function LevelRenderer.Tool.Matrix.prototype.invert
  21250. * @description 求逆矩阵。
  21251. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  21252. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  21253. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  21254. */
  21255. invert(out, a) {
  21256. var aa = a[0];
  21257. var ac = a[2];
  21258. var atx = a[4];
  21259. var ab = a[1];
  21260. var ad = a[3];
  21261. var aty = a[5];
  21262. var det = aa * ad - ab * ac;
  21263. if (!det) {
  21264. return null;
  21265. }
  21266. det = 1.0 / det;
  21267. out[0] = ad * det;
  21268. out[1] = -ab * det;
  21269. out[2] = -ac * det;
  21270. out[3] = aa * det;
  21271. out[4] = (ac * aty - ad * atx) * det;
  21272. out[5] = (ab * atx - aa * aty) * det;
  21273. return out;
  21274. }
  21275. /**
  21276. * @function LevelRenderer.Tool.Matrix.prototype.mulVector
  21277. * @description 矩阵左乘向量。
  21278. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  21279. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  21280. * @param {(Float32Array|Array.<number>)} v - 缩放参数。
  21281. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  21282. */
  21283. mulVector(out, a, v) {
  21284. var aa = a[0];
  21285. var ac = a[2];
  21286. var atx = a[4];
  21287. var ab = a[1];
  21288. var ad = a[3];
  21289. var aty = a[5];
  21290. out[0] = v[0] * aa + v[1] * ac + atx;
  21291. out[1] = v[0] * ab + v[1] * ad + aty;
  21292. return out;
  21293. }
  21294. }
  21295. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SUtil.js
  21296. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21297. * This program are made available under the terms of the Apache License, Version 2.0
  21298. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21299. class SUtil_SUtil {
  21300. /**
  21301. * @function LevelRenderer.SUtil.SUtil_smoothBezier
  21302. * @description 贝塞尔平滑曲线。
  21303. * @private
  21304. * @param {Array} points - 线段顶点数组。
  21305. * @param {number} smooth - 平滑等级, 0-1。
  21306. * @param {boolean} isLoop - isLoop。
  21307. * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
  21308. * @param {Array.<number>} [originalPosition=[0, 0]] - 参考原点。
  21309. * @return {Array} 生成的平滑节点数组。
  21310. */
  21311. static SUtil_smoothBezier(points, smooth, isLoop, constraint, originalPosition) {
  21312. if (!originalPosition || originalPosition.length !== 2) {
  21313. originalPosition = [0, 0];
  21314. }
  21315. var __OP = originalPosition;
  21316. var cps = [];
  21317. var v = [];
  21318. var v1 = [];
  21319. var v2 = [];
  21320. var hasConstraint = !!constraint;
  21321. var min, max;
  21322. if (hasConstraint) {
  21323. min = [Infinity, Infinity];
  21324. max = [-Infinity, -Infinity];
  21325. let len = points.length;
  21326. for (let i = 0; i < len; i++) {
  21327. SUtil_SUtil.Util_vector.min(min, min, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  21328. SUtil_SUtil.Util_vector.max(max, max, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  21329. }
  21330. // 与指定的包围盒做并集
  21331. SUtil_SUtil.Util_vector.min(min, min, constraint[0]);
  21332. SUtil_SUtil.Util_vector.max(max, max, constraint[1]);
  21333. }
  21334. let len = points.length;
  21335. for (let i = 0; i < len; i++) {
  21336. let point = [points[i][0] + __OP[0], points[i][1] + __OP[1]];
  21337. let prevPoint;
  21338. let nextPoint;
  21339. if (isLoop) {
  21340. prevPoint = [points[i ? i - 1 : len - 1][0] + __OP[0], points[i ? i - 1 : len - 1][1] + __OP[1]];
  21341. nextPoint = [points[(i + 1) % len][0] + __OP[0], points[(i + 1) % len][1] + __OP[1]];
  21342. } else {
  21343. if (i === 0 || i === len - 1) {
  21344. cps.push([points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  21345. continue;
  21346. } else {
  21347. prevPoint = [points[i - 1][0] + __OP[0], points[i - 1][1] + __OP[1]];
  21348. nextPoint = [points[i + 1][0] + __OP[0], points[i + 1][1] + __OP[1]];
  21349. }
  21350. }
  21351. SUtil_SUtil.Util_vector.sub(v, nextPoint, prevPoint);
  21352. // use degree to scale the handle length
  21353. SUtil_SUtil.Util_vector.scale(v, v, smooth);
  21354. let d0 = SUtil_SUtil.Util_vector.distance(point, prevPoint);
  21355. let d1 = SUtil_SUtil.Util_vector.distance(point, nextPoint);
  21356. let sum = d0 + d1;
  21357. if (sum !== 0) {
  21358. d0 /= sum;
  21359. d1 /= sum;
  21360. }
  21361. SUtil_SUtil.Util_vector.scale(v1, v, -d0);
  21362. SUtil_SUtil.Util_vector.scale(v2, v, d1);
  21363. let cp0 = SUtil_SUtil.Util_vector.add([], point, v1);
  21364. let cp1 = SUtil_SUtil.Util_vector.add([], point, v2);
  21365. if (hasConstraint) {
  21366. SUtil_SUtil.Util_vector.max(cp0, cp0, min);
  21367. SUtil_SUtil.Util_vector.min(cp0, cp0, max);
  21368. SUtil_SUtil.Util_vector.max(cp1, cp1, min);
  21369. SUtil_SUtil.Util_vector.min(cp1, cp1, max);
  21370. }
  21371. cps.push(cp0);
  21372. cps.push(cp1);
  21373. }
  21374. if (isLoop) {
  21375. cps.push(cps.shift());
  21376. }
  21377. return cps;
  21378. }
  21379. /**
  21380. * @function LevelRenderer.SUtil.SUtil_smoothSpline
  21381. * @description 插值折线。
  21382. * @private
  21383. * @param {Array} points - 线段顶点数组。
  21384. * @param {boolean} isLoop - isLoop。
  21385. * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
  21386. * @param {Array.<number>} originalPosition - 参考原点。默认值:[0, 0]。
  21387. * @return {Array} 生成的平滑节点数组。
  21388. */
  21389. static SUtil_smoothSpline(points, isLoop, constraint, originalPosition) {
  21390. if (!originalPosition || originalPosition.length !== 2) {
  21391. originalPosition = [0, 0];
  21392. }
  21393. var __OP = originalPosition;
  21394. var len = points.length;
  21395. var ret = [];
  21396. var distance = 0;
  21397. for (let i = 1; i < len; i++) {
  21398. 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]]);
  21399. }
  21400. var segs = distance / 5;
  21401. segs = segs < len ? len : segs;
  21402. for (let i = 0; i < segs; i++) {
  21403. let pos = i / (segs - 1) * (isLoop ? len : len - 1);
  21404. let idx = Math.floor(pos);
  21405. let w = pos - idx;
  21406. let p0;
  21407. let p1 = [points[idx % len][0] + __OP[0], points[idx % len][1] + __OP[1]];
  21408. let p2;
  21409. let p3;
  21410. if (!isLoop) {
  21411. p0 = [points[idx === 0 ? idx : idx - 1][0] + __OP[0], points[idx === 0 ? idx : idx - 1][1] + __OP[1]];
  21412. p2 = [points[idx > len - 2 ? len - 1 : idx + 1][0] + __OP[0], points[idx > len - 2 ? len - 1 : idx + 1][1] + __OP[1]];
  21413. p3 = [points[idx > len - 3 ? len - 1 : idx + 2][0] + __OP[0], points[idx > len - 3 ? len - 1 : idx + 2][1] + __OP[1]];
  21414. } else {
  21415. p0 = [points[(idx - 1 + len) % len][0] + __OP[0], points[(idx - 1 + len) % len][1] + __OP[1]];
  21416. p2 = [points[(idx + 1) % len][0] + __OP[0], points[(idx + 1) % len][1] + __OP[1]];
  21417. p3 = [points[(idx + 2) % len][0] + __OP[0], points[(idx + 2) % len][1] + __OP[1]];
  21418. }
  21419. let w2 = w * w;
  21420. let w3 = w * w2;
  21421. ret.push([
  21422. interpolate(p0[0], p1[0], p2[0], p3[0], w, w2, w3),
  21423. interpolate(p0[1], p1[1], p2[1], p3[1], w, w2, w3)
  21424. ]);
  21425. }
  21426. return ret;
  21427. // inner Function
  21428. function interpolate(p0, p1, p2, p3, t, t2, t3) {
  21429. var v0 = (p2 - p0) * 0.5;
  21430. var v1 = (p3 - p1) * 0.5;
  21431. return (2 * (p1 - p2) + v0 + v1) * t3
  21432. + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
  21433. + v0 * t + p1;
  21434. }
  21435. }
  21436. /**
  21437. * @function LevelRenderer.SUtil.SUtil_dashedLineTo
  21438. * @description 虚线 lineTo。
  21439. */
  21440. static SUtil_dashedLineTo(ctx, x1, y1, x2, y2, dashLength, customDashPattern) {
  21441. // http://msdn.microsoft.com/en-us/library/ie/dn265063(v=vs.85).aspx
  21442. var dashPattern = [5, 5];
  21443. dashLength = typeof dashLength != 'number'
  21444. ? 5
  21445. : dashLength;
  21446. if (ctx.setLineDash) {
  21447. dashPattern[0] = dashLength;
  21448. dashPattern[1] = dashLength;
  21449. if (customDashPattern && (customDashPattern instanceof Array)) {
  21450. ctx.setLineDash(customDashPattern);
  21451. } else {
  21452. ctx.setLineDash(dashPattern);
  21453. }
  21454. // ctx.setLineDash(dashPattern);
  21455. ctx.moveTo(x1, y1);
  21456. ctx.lineTo(x2, y2);
  21457. return;
  21458. }
  21459. var dx = x2 - x1;
  21460. var dy = y2 - y1;
  21461. var numDashes = Math.floor(
  21462. Math.sqrt(dx * dx + dy * dy) / dashLength
  21463. );
  21464. dx = dx / numDashes;
  21465. dy = dy / numDashes;
  21466. var flag = true;
  21467. for (var i = 0; i < numDashes; ++i) {
  21468. if (flag) {
  21469. ctx.moveTo(x1, y1);
  21470. } else {
  21471. ctx.lineTo(x1, y1);
  21472. }
  21473. flag = !flag;
  21474. x1 += dx;
  21475. y1 += dy;
  21476. }
  21477. ctx.lineTo(x2, y2);
  21478. }
  21479. }
  21480. // 把所有工具对象放到全局静态变量上,以便直接调用工具方法,
  21481. // 避免使用工具时频繁的创建工具对象带来的性能消耗。
  21482. SUtil_SUtil.Util_area = new Area();
  21483. SUtil_SUtil.Util_color = new Color();
  21484. SUtil_SUtil.Util_computeBoundingBox = new ComputeBoundingBox();
  21485. SUtil_SUtil.Util_curve = new Curve_Curve();
  21486. SUtil_SUtil.Util_env = new Env();
  21487. SUtil_SUtil.Util_event = new Event();
  21488. SUtil_SUtil.Util_http = new Http();
  21489. SUtil_SUtil.Util_log = new Log();
  21490. SUtil_SUtil.Util_math = new MathTool();
  21491. SUtil_SUtil.Util_matrix = new Matrix();
  21492. SUtil_SUtil.Util = new levelRenderer_Util_Util();
  21493. SUtil_SUtil.Util_vector = new Vector_Vector();
  21494. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Transformable.js
  21495. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21496. * This program are made available under the terms of the Apache License, Version 2.0
  21497. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21498. /**
  21499. * @private
  21500. * @class LevelRenderer.Transformable
  21501. * @category Visualization Theme
  21502. * @classdesc 可变换超类,所有支持 Canvas Transform 变换操作的类均是此类的子类。此类不可实例化。
  21503. */
  21504. class Transformable {
  21505. constructor() {
  21506. /**
  21507. * @member {Array.<number>} LevelRenderer.Transformable.prototype.position
  21508. * @description 平移,默认值:[0, 0]。
  21509. */
  21510. this.position = [0, 0];
  21511. /**
  21512. * @member {Array.<number>} LevelRenderer.Transformable.prototype.rotation
  21513. * @description 旋转,可以通过数组二三项指定旋转的原点,默认值:[0, 0, 0]。
  21514. */
  21515. this.rotation = [0, 0, 0];
  21516. /**
  21517. * @member {Array.<number>} LevelRenderer.Transformable.prototype.scale
  21518. * @description 缩放,可以通过数组三四项指定缩放的原点,默认值:[1, 1, 0, 0]。
  21519. */
  21520. this.scale = [1, 1, 0, 0];
  21521. /**
  21522. * @member {boolean} LevelRenderer.Transformable.prototype.needLocalTransform
  21523. * @description 是否变换。默认值:false。
  21524. */
  21525. this.needLocalTransform = false;
  21526. /**
  21527. * @member {boolean} LevelRenderer.Transformable.prototype.needTransform
  21528. * @description 是否有坐标变换。默认值:false。
  21529. */
  21530. this.needTransform = false;
  21531. this.CLASS_NAME = "SuperMap.LevelRenderer.Transformable";
  21532. /**
  21533. * @function LevelRenderer.Transformable.prototype.lookAt
  21534. * @description 设置图形的朝向。
  21535. */
  21536. this.lookAt = (function () {
  21537. var v = SUtil_SUtil.Util_vector.create();
  21538. // {Array.<Number>|Float32Array} target
  21539. return function (target) {
  21540. if (!this.transform) {
  21541. this.transform = SUtil_SUtil.Util_matrix.create();
  21542. }
  21543. var m = this.transform;
  21544. SUtil_SUtil.Util_vector.sub(v, target, this.position);
  21545. if (isAroundZero(v[0]) && isAroundZero(v[1])) {
  21546. return;
  21547. }
  21548. SUtil_SUtil.Util_vector.normalize(v, v);
  21549. // Y Axis
  21550. // TODO Scale origin ?
  21551. m[2] = v[0] * this.scale[1];
  21552. m[3] = v[1] * this.scale[1];
  21553. // X Axis
  21554. m[0] = v[1] * this.scale[0];
  21555. m[1] = -v[0] * this.scale[0];
  21556. // Position
  21557. m[4] = this.position[0];
  21558. m[5] = this.position[1];
  21559. this.decomposeTransform();
  21560. function isAroundZero(val) {
  21561. var EPSILON = 5e-5;
  21562. return val > -EPSILON && val < EPSILON;
  21563. }
  21564. };
  21565. })();
  21566. }
  21567. /**
  21568. * @function LevelRenderer.Transformable.prototype.destroy
  21569. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  21570. */
  21571. destroy() {
  21572. this.position = null;
  21573. this.rotation = null;
  21574. this.scale = null;
  21575. this.needLocalTransform = null;
  21576. this.needTransform = null;
  21577. }
  21578. /**
  21579. * @function LevelRenderer.Transformable.prototype.updateNeedTransform
  21580. * @description 更新 needLocalTransform
  21581. */
  21582. updateNeedTransform() {
  21583. this.needLocalTransform = isNotAroundZero(this.rotation[0])
  21584. || isNotAroundZero(this.position[0])
  21585. || isNotAroundZero(this.position[1])
  21586. || isNotAroundZero(this.scale[0] - 1)
  21587. || isNotAroundZero(this.scale[1] - 1);
  21588. function isNotAroundZero(val) {
  21589. var EPSILON = 5e-5;
  21590. return val > EPSILON || val < -EPSILON;
  21591. }
  21592. }
  21593. /**
  21594. * @function LevelRenderer.Transformable.prototype.updateTransform
  21595. * @description 判断是否需要有坐标变换,更新 needTransform 属性。如果有坐标变换,则从 position, rotation, scale 以及父节点的 transform 计算出自身的 transform 矩阵。
  21596. */
  21597. updateTransform() {
  21598. this.updateNeedTransform();
  21599. if (this.parent) {
  21600. this.needTransform = this.needLocalTransform || this.parent.needTransform;
  21601. } else {
  21602. this.needTransform = this.needLocalTransform;
  21603. }
  21604. if (!this.needTransform) {
  21605. return;
  21606. }
  21607. var origin = [0, 0];
  21608. var m = this.transform || SUtil_SUtil.Util_matrix.create();
  21609. SUtil_SUtil.Util_matrix.identity(m);
  21610. if (this.needLocalTransform) {
  21611. if (
  21612. isNotAroundZero(this.scale[0])
  21613. || isNotAroundZero(this.scale[1])
  21614. ) {
  21615. origin[0] = -this.scale[2] || 0;
  21616. origin[1] = -this.scale[3] || 0;
  21617. let haveOrigin = isNotAroundZero(origin[0])
  21618. || isNotAroundZero(origin[1]);
  21619. if (haveOrigin) {
  21620. SUtil_SUtil.Util_matrix.translate(
  21621. m, m, origin
  21622. );
  21623. }
  21624. SUtil_SUtil.Util_matrix.scale(m, m, this.scale);
  21625. if (haveOrigin) {
  21626. origin[0] = -origin[0];
  21627. origin[1] = -origin[1];
  21628. SUtil_SUtil.Util_matrix.translate(
  21629. m, m, origin
  21630. );
  21631. }
  21632. }
  21633. if (this.rotation instanceof Array) {
  21634. if (this.rotation[0] !== 0) {
  21635. origin[0] = -this.rotation[1] || 0;
  21636. origin[1] = -this.rotation[2] || 0;
  21637. let haveOrigin = isNotAroundZero(origin[0])
  21638. || isNotAroundZero(origin[1]);
  21639. if (haveOrigin) {
  21640. SUtil_SUtil.Util_matrix.translate(
  21641. m, m, origin
  21642. );
  21643. }
  21644. SUtil_SUtil.Util_matrix.rotate(m, m, this.rotation[0]);
  21645. if (haveOrigin) {
  21646. origin[0] = -origin[0];
  21647. origin[1] = -origin[1];
  21648. SUtil_SUtil.Util_matrix.translate(
  21649. m, m, origin
  21650. );
  21651. }
  21652. }
  21653. } else {
  21654. if (+this.rotation !== 0) {
  21655. SUtil_SUtil.Util_matrix.rotate(m, m, this.rotation);
  21656. }
  21657. }
  21658. if (
  21659. isNotAroundZero(this.position[0]) || isNotAroundZero(this.position[1])
  21660. ) {
  21661. SUtil_SUtil.Util_matrix.translate(m, m, this.position);
  21662. }
  21663. }
  21664. // 保存这个变换矩阵
  21665. this.transform = m;
  21666. // 应用父节点变换
  21667. if (this.parent && this.parent.needTransform) {
  21668. if (this.needLocalTransform) {
  21669. SUtil_SUtil.Util_matrix.mul(this.transform, this.parent.transform, this.transform);
  21670. } else {
  21671. SUtil_SUtil.Util_matrix.copy(this.transform, this.parent.transform);
  21672. }
  21673. }
  21674. function isNotAroundZero(val) {
  21675. var EPSILON = 5e-5;
  21676. return val > EPSILON || val < -EPSILON;
  21677. }
  21678. }
  21679. /**
  21680. * @function LevelRenderer.Transformable.prototype.setTransform
  21681. * @description 将自己的 transform 应用到 context 上。
  21682. *
  21683. * @param {Context2D} ctx - Context2D 上下文。
  21684. */
  21685. setTransform(ctx) {
  21686. if (this.needTransform) {
  21687. var m = this.transform;
  21688. ctx.transform(
  21689. m[0], m[1],
  21690. m[2], m[3],
  21691. m[4], m[5]
  21692. );
  21693. }
  21694. }
  21695. /**
  21696. * @function LevelRenderer.Transformable.prototype.decomposeTransform
  21697. * @description 分解`transform`矩阵到`position`, `rotation`, `scale` 。
  21698. */
  21699. decomposeTransform() {
  21700. if (!this.transform) {
  21701. return;
  21702. }
  21703. var m = this.transform;
  21704. var sx = m[0] * m[0] + m[1] * m[1];
  21705. var position = this.position;
  21706. var scale = this.scale;
  21707. var rotation = this.rotation;
  21708. if (isNotAroundZero(sx - 1)) {
  21709. sx = Math.sqrt(sx);
  21710. }
  21711. var sy = m[2] * m[2] + m[3] * m[3];
  21712. if (isNotAroundZero(sy - 1)) {
  21713. sy = Math.sqrt(sy);
  21714. }
  21715. position[0] = m[4];
  21716. position[1] = m[5];
  21717. scale[0] = sx;
  21718. scale[1] = sy;
  21719. scale[2] = scale[3] = 0;
  21720. rotation[0] = Math.atan2(-m[1] / sy, m[0] / sx);
  21721. rotation[1] = rotation[2] = 0;
  21722. function isNotAroundZero(val) {
  21723. var EPSILON = 5e-5;
  21724. return val > EPSILON || val < -EPSILON;
  21725. }
  21726. }
  21727. }
  21728. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Group.js
  21729. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21730. * This program are made available under the terms of the Apache License, Version 2.0
  21731. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21732. /**
  21733. * @class LevelRenderer.Group
  21734. * @category Visualization Theme
  21735. * @private
  21736. * @classdesc Group 是一个容器,可以插入子节点,Group 的变换也会被应用到子节点上。
  21737. * @extends {LevelRenderer.Transformable}
  21738. * (code)
  21739. * var g = new LevelRenderer.Group();
  21740. * var Circle = new LevelRenderer.Shape.Circle();
  21741. * g.position[0] = 100;
  21742. * g.position[1] = 100;
  21743. * g.addChild(new Circle({
  21744. * style: {
  21745. * x: 100,
  21746. * y: 100,
  21747. * r: 20,
  21748. * brushType: 'fill'
  21749. * }
  21750. * }));
  21751. * LR.addGroup(g);
  21752. * (end)
  21753. * @param {Array} options - Group 的配置(options)项,可以是 Group 的自有属性,也可以是自定义的属性。
  21754. */
  21755. class Group extends mixinExt(Eventful, Transformable) {
  21756. constructor(options) {
  21757. super(options)
  21758. options = options || {};
  21759. /**
  21760. * @member {string} LevelRenderer.Group.prototype.id
  21761. * @description Group 的唯一标识。
  21762. */
  21763. this.id = null;
  21764. /**
  21765. * @readonly
  21766. * @member {string} [LevelRenderer.Group.prototype.type='group']
  21767. * @description 类型。
  21768. */
  21769. this.type = 'group';
  21770. //http://www.w3.org/TR/2dcontext/#clipping-region
  21771. /**
  21772. * @member {string} LevelRenderer.Group.prototype.clipShape
  21773. * @description 用于裁剪的图形(shape),所有 Group 内的图形在绘制时都会被这个图形裁剪,该图形会继承 Group 的变换。
  21774. */
  21775. this.clipShape = null;
  21776. /**
  21777. * @member {Array} LevelRenderer.Group.prototype._children
  21778. * @description _children。
  21779. */
  21780. this._children = [];
  21781. /**
  21782. * @member {Array} LevelRenderer.Group.prototype._storage
  21783. * @description _storage。
  21784. */
  21785. this._storage = null;
  21786. /**
  21787. * @member {boolean} [LevelRenderer.Group.prototype.__dirty=true]
  21788. * @description __dirty。
  21789. */
  21790. this.__dirty = true;
  21791. /**
  21792. * @member {boolean} [LevelRenderer.Group.prototype.ignore=false]
  21793. * @description 是否忽略该 Group 及其所有子节点。
  21794. */
  21795. this.ignore = false;
  21796. Util_Util.extend(this, options);
  21797. this.id = this.id || Util_Util.createUniqueID("smShapeGroup_");
  21798. this.CLASS_NAME = "SuperMap.LevelRenderer.Group";
  21799. }
  21800. /**
  21801. * @function LevelRenderer.Group.prototype.destroy
  21802. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  21803. */
  21804. destroy() {
  21805. this.id = null;
  21806. this.type = null;
  21807. this.clipShape = null;
  21808. this._children = null;
  21809. this._storage = null;
  21810. this.__dirty = null;
  21811. this.ignore = null;
  21812. super.destroy();
  21813. }
  21814. /**
  21815. * @function LevelRenderer.Group.prototype.children
  21816. * @description 复制并返回一份新的包含所有儿子节点的数组。
  21817. * @returns {Array.<LevelRenderer.Shape>} 图形数组。
  21818. */
  21819. children() {
  21820. return this._children.slice();
  21821. }
  21822. /**
  21823. * @function LevelRenderer.Group.prototype.childAt
  21824. * @description 获取指定 index 的儿子节点
  21825. * @param {number} idx - 节点索引。
  21826. * @returns {LevelRenderer.Shape} 图形。
  21827. */
  21828. childAt(idx) {
  21829. return this._children[idx];
  21830. }
  21831. /**
  21832. * @function LevelRenderer.Group.prototype.addChild
  21833. * @description 添加子节点,可以是 Shape 或者 Group。
  21834. * @param {(LevelRenderer.Shape|LevelRenderer.Group)} child - 节点图形。
  21835. */
  21836. // TODO Type Check
  21837. addChild(child) {
  21838. if (child == this) {
  21839. return;
  21840. }
  21841. if (child.parent == this) {
  21842. return;
  21843. }
  21844. if (child.parent) {
  21845. child.parent.removeChild(child);
  21846. }
  21847. this._children.push(child);
  21848. child.parent = this;
  21849. if (this._storage && this._storage !== child._storage) {
  21850. this._storage.addToMap(child);
  21851. if (child instanceof Group) {
  21852. child.addChildrenToStorage(this._storage);
  21853. }
  21854. }
  21855. }
  21856. /**
  21857. * @function LevelRenderer.Group.prototype.removeChild
  21858. * @description 移除子节点。
  21859. * @param {LevelRenderer.Shape} child - 需要移除的子节点图形。
  21860. */
  21861. removeChild(child) {
  21862. var idx = Util_Util.indexOf(this._children, child);
  21863. this._children.splice(idx, 1);
  21864. child.parent = null;
  21865. if (this._storage) {
  21866. this._storage.delFromMap(child.id);
  21867. if (child instanceof Group) {
  21868. child.delChildrenFromStorage(this._storage);
  21869. }
  21870. }
  21871. }
  21872. /**
  21873. * @function LevelRenderer.Group.prototype.eachChild
  21874. * @description 遍历所有子节点。
  21875. * @param {function} cb - 回调函数。
  21876. * @param {Object} context - 上下文。
  21877. */
  21878. eachChild(cb, context) {
  21879. var haveContext = !!context;
  21880. for (var i = 0; i < this._children.length; i++) {
  21881. var child = this._children[i];
  21882. if (haveContext) {
  21883. cb.call(context, child);
  21884. } else {
  21885. cb(child);
  21886. }
  21887. }
  21888. }
  21889. /**
  21890. * @function LevelRenderer.Group.prototype.traverse
  21891. * @description 深度优先遍历所有子孙节点。
  21892. * @param {function} cb - 回调函数。
  21893. * @param {Object} context - 上下文。
  21894. */
  21895. traverse(cb, context) {
  21896. var haveContext = !!context;
  21897. for (var i = 0; i < this._children.length; i++) {
  21898. var child = this._children[i];
  21899. if (haveContext) {
  21900. cb.call(context, child);
  21901. } else {
  21902. cb(child);
  21903. }
  21904. if (child.type === 'group') {
  21905. child.traverse(cb, context);
  21906. }
  21907. }
  21908. }
  21909. /**
  21910. * @function LevelRenderer.Group.prototype.addChildrenToStorage
  21911. * @description 把子图形添加到仓库。
  21912. * @param {LevelRenderer.Storage} storage - 图形仓库。
  21913. */
  21914. addChildrenToStorage(storage) {
  21915. for (var i = 0; i < this._children.length; i++) {
  21916. var child = this._children[i];
  21917. storage.addToMap(child);
  21918. if (child.type === 'group') {
  21919. child.addChildrenToStorage(storage);
  21920. }
  21921. }
  21922. }
  21923. /**
  21924. * @function LevelRenderer.Group.prototype.delChildrenFromStorage
  21925. * @description 从仓库把子图形删除。
  21926. * @param {LevelRenderer.Storage} storage - 图形仓库。
  21927. */
  21928. delChildrenFromStorage(storage) {
  21929. for (var i = 0; i < this._children.length; i++) {
  21930. var child = this._children[i];
  21931. storage.delFromMap(child.id);
  21932. if (child.type === 'group') {
  21933. child.delChildrenFromStorage(storage);
  21934. }
  21935. }
  21936. }
  21937. /**
  21938. * @function LevelRenderer.Group.prototype.modSelf
  21939. * @description 是否修改。
  21940. */
  21941. modSelf() {
  21942. this.__dirty = true;
  21943. }
  21944. }
  21945. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Storage.js
  21946. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21947. * This program are made available under the terms of the Apache License, Version 2.0
  21948. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21949. /**
  21950. * @private
  21951. * @class LevelRenderer.Storage
  21952. * @category Visualization Theme
  21953. * @classdesc 内容(图像)仓库 (M) 。
  21954. */
  21955. class Storage {
  21956. constructor() {
  21957. /**
  21958. * @member {Object} LevelRenderer.Storage.prototype._elements
  21959. * @description 所有常规形状,id 索引的 map。
  21960. */
  21961. this._elements = {};
  21962. /**
  21963. * @member {Array} LevelRenderer.Storage.prototype._hoverElements
  21964. * @description 高亮层形状,不稳定,动态增删,数组位置也是 z 轴方向,靠前显示在下方。
  21965. *
  21966. */
  21967. this._hoverElements = [];
  21968. /**
  21969. * @member {Array} LevelRenderer.Storage.prototype._roots
  21970. * @description _roots。
  21971. *
  21972. */
  21973. this._roots = [];
  21974. /**
  21975. * @member {Array} LevelRenderer.Storage.prototype._shapeList
  21976. * @description _shapeList。
  21977. *
  21978. */
  21979. this._shapeList = [];
  21980. /**
  21981. * @member {number} LevelRenderer.Storage.prototype._shapeListOffset
  21982. * @description _shapeListOffset。默认值:0。
  21983. *
  21984. */
  21985. this._shapeListOffset = 0;
  21986. this.CLASS_NAME = "SuperMap.LevelRenderer.Storage";
  21987. }
  21988. /**
  21989. * @function LevelRenderer.Storage.prototype.destroy
  21990. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  21991. */
  21992. destroy() {
  21993. this.dispose();
  21994. this._shapeList = null;
  21995. this._shapeListOffset = null;
  21996. }
  21997. /**
  21998. * @function LevelRenderer.Storage.prototype.iterShape
  21999. * @description 遍历迭代器。
  22000. *
  22001. * @param {function} fun - 迭代回调函数,return true终止迭代。
  22002. * @param {Object} option - 迭代参数,缺省为仅降序遍历普通层图形。
  22003. * @param {boolean} [hover=true] - 是否是高亮层图形。
  22004. * @param {string} [normal='down'] - 是否是普通层图形,迭代时是否指定及z轴顺序。可设值:'down' ,'up'。
  22005. * @param {boolean} [update=false] - 是否在迭代前更新形状列表。
  22006. * @return {LevelRenderer.Storage} this。
  22007. */
  22008. iterShape(fun, option) {
  22009. if (!option) {
  22010. var defaultIterateOption = {
  22011. hover: false,
  22012. normal: 'down',
  22013. update: false
  22014. };
  22015. option = defaultIterateOption;
  22016. }
  22017. if (option.hover) {
  22018. // 高亮层数据遍历
  22019. for (var i = 0, l = this._hoverElements.length; i < l; i++) {
  22020. var el = this._hoverElements[i];
  22021. el.updateTransform();
  22022. if (fun(el)) {
  22023. return this;
  22024. }
  22025. }
  22026. }
  22027. if (option.update) {
  22028. this.updateShapeList();
  22029. }
  22030. // 遍历: 'down' | 'up'
  22031. switch (option.normal) {
  22032. case 'down':
  22033. {
  22034. // 降序遍历,高层优先
  22035. let l = this._shapeList.length;
  22036. while (l--) {
  22037. if (fun(this._shapeList[l])) {
  22038. return this;
  22039. }
  22040. }
  22041. break;
  22042. }
  22043. // case 'up':
  22044. default:
  22045. {
  22046. // 升序遍历,底层优先
  22047. for (let i = 0, l = this._shapeList.length; i < l; i++) {
  22048. if (fun(this._shapeList[i])) {
  22049. return this;
  22050. }
  22051. }
  22052. break;
  22053. }
  22054. }
  22055. return this;
  22056. }
  22057. /**
  22058. * @function LevelRenderer.Storage.prototype.getHoverShapes
  22059. * @param {boolean} [update=false] - 是否在返回前更新图形的变换。
  22060. * @return {Array.<LevelRenderer.Shape>} 图形数组。
  22061. */
  22062. getHoverShapes(update) {
  22063. // hoverConnect
  22064. var hoverElements = [], len = this._hoverElements.length;
  22065. for (let i = 0; i < len; i++) {
  22066. hoverElements.push(this._hoverElements[i]);
  22067. var target = this._hoverElements[i].hoverConnect;
  22068. if (target) {
  22069. var shape;
  22070. target = target instanceof Array ? target : [target];
  22071. for (var j = 0, k = target.length; j < k; j++) {
  22072. shape = target[j].id ? target[j] : this.get(target[j]);
  22073. if (shape) {
  22074. hoverElements.push(shape);
  22075. }
  22076. }
  22077. }
  22078. }
  22079. hoverElements.sort(Storage.shapeCompareFunc);
  22080. if (update) {
  22081. for (let i = 0, l = hoverElements.length; i < l; i++) {
  22082. hoverElements[i].updateTransform();
  22083. }
  22084. }
  22085. return hoverElements;
  22086. }
  22087. /**
  22088. * @function LevelRenderer.Storage.prototype.getShapeList
  22089. * @description 返回所有图形的绘制队列。
  22090. *
  22091. * @param {boolean} [update=false] - 是否在返回前更新该数组。详见:<LevelRenderer.Shape> updateShapeList。
  22092. * @return {LevelRenderer.Shape} 图形。
  22093. */
  22094. getShapeList(update) {
  22095. if (update) {
  22096. this.updateShapeList();
  22097. }
  22098. return this._shapeList;
  22099. }
  22100. /**
  22101. * @function LevelRenderer.Storage.prototype.updateShapeList
  22102. * @description 更新图形的绘制队列。每次绘制前都会调用,该方法会先深度优先遍历整个树,更新所有Group和Shape的变换并且把所有可见的Shape保存到数组中,最后根据绘制的优先级(zlevel > z > 插入顺序)排序得到绘制队列。
  22103. */
  22104. updateShapeList() {
  22105. this._shapeListOffset = 0;
  22106. var rootsLen = this._roots.length;
  22107. for (let i = 0; i < rootsLen; i++) {
  22108. let root = this._roots[i];
  22109. this._updateAndAddShape(root);
  22110. }
  22111. this._shapeList.length = this._shapeListOffset;
  22112. var shapeListLen = this._shapeList.length;
  22113. for (let i = 0; i < shapeListLen; i++) {
  22114. this._shapeList[i].__renderidx = i;
  22115. }
  22116. this._shapeList.sort(Storage.shapeCompareFunc);
  22117. }
  22118. /**
  22119. * @function LevelRenderer.Storage.prototype._updateAndAddShape
  22120. * @description 更新并添加图形。
  22121. *
  22122. */
  22123. _updateAndAddShape(el, clipShapes) {
  22124. if (el.ignore) {
  22125. return;
  22126. }
  22127. el.updateTransform();
  22128. if (el.type == 'group') {
  22129. if (el.clipShape) {
  22130. // clipShape 的变换是基于 group 的变换
  22131. el.clipShape.parent = el;
  22132. el.clipShape.updateTransform();
  22133. // PENDING 效率影响
  22134. if (clipShapes) {
  22135. clipShapes = clipShapes.slice();
  22136. clipShapes.push(el.clipShape);
  22137. } else {
  22138. clipShapes = [el.clipShape];
  22139. }
  22140. }
  22141. for (var i = 0; i < el._children.length; i++) {
  22142. var child = el._children[i];
  22143. // Force to mark as dirty if group is dirty
  22144. child.__dirty = el.__dirty || child.__dirty;
  22145. this._updateAndAddShape(child, clipShapes);
  22146. }
  22147. // Mark group clean here
  22148. el.__dirty = false;
  22149. } else {
  22150. el.__clipShapes = clipShapes;
  22151. this._shapeList[this._shapeListOffset++] = el;
  22152. }
  22153. }
  22154. /**
  22155. * @function LevelRenderer.Storage.prototype.mod
  22156. * @description 修改图形(Shape)或者组(Group)。
  22157. *
  22158. * @param {string} elId - 唯一标识。
  22159. * @param {Object} params - 参数。
  22160. * @return {LevelRenderer.Storage} this。
  22161. */
  22162. mod(elId, params) {
  22163. var el = this._elements[elId];
  22164. if (el) {
  22165. el.modSelf();
  22166. if (params) {
  22167. // 如果第二个参数直接使用 shape
  22168. // parent, _storage, __startClip 三个属性会有循环引用
  22169. // 主要为了向 1.x 版本兼容,2.x 版本不建议使用第二个参数
  22170. if (params.parent || params._storage || params.__startClip) {
  22171. var target = {};
  22172. for (var name in params) {
  22173. if (
  22174. name == 'parent'
  22175. || name == '_storage'
  22176. || name == '__startClip'
  22177. ) {
  22178. continue;
  22179. }
  22180. if (params.hasOwnProperty(name)) {
  22181. target[name] = params[name];
  22182. }
  22183. }
  22184. new levelRenderer_Util_Util().merge(el, target, true);
  22185. } else {
  22186. new levelRenderer_Util_Util().merge(el, params, true);
  22187. }
  22188. }
  22189. }
  22190. return this;
  22191. }
  22192. /**
  22193. * @function LevelRenderer.Storage.prototype.drift
  22194. * @description 移动指定的图形(Shape)的位置。
  22195. * @param {string} shapeId - 唯一标识。
  22196. * @param {number} dx
  22197. * @param {number} dy
  22198. * @return {LevelRenderer.Storage} this。
  22199. */
  22200. drift(shapeId, dx, dy) {
  22201. var shape = this._elements[shapeId];
  22202. if (shape) {
  22203. shape.needTransform = true;
  22204. if (shape.draggable === 'horizontal') {
  22205. dy = 0;
  22206. } else if (shape.draggable === 'vertical') {
  22207. dx = 0;
  22208. }
  22209. if (!shape.ondrift // ondrift
  22210. // 有onbrush并且调用执行返回false或undefined则继续
  22211. || (shape.ondrift && !shape.ondrift(dx, dy))
  22212. ) {
  22213. shape.drift(dx, dy);
  22214. }
  22215. }
  22216. return this;
  22217. }
  22218. /**
  22219. * @function LevelRenderer.Storage.prototype.addHover
  22220. * @description 添加高亮层数据。
  22221. * @param {LevelRenderer.Shape} shape - 图形。
  22222. * @return {LevelRenderer.Storage} this。
  22223. */
  22224. addHover(shape) {
  22225. shape.updateNeedTransform();
  22226. this._hoverElements.push(shape);
  22227. return this;
  22228. }
  22229. /**
  22230. * @function LevelRenderer.Storage.prototype.delHover
  22231. * @description 清空高亮层数据。
  22232. * @return {LevelRenderer.Storage} this。
  22233. */
  22234. delHover() {
  22235. this._hoverElements = [];
  22236. return this;
  22237. }
  22238. /**
  22239. * @function LevelRenderer.Storage.prototype.hasHoverShape
  22240. * @description 是否有图形在高亮层里。
  22241. * @return {boolean} 是否有图形在高亮层里。
  22242. */
  22243. hasHoverShape() {
  22244. return this._hoverElements.length > 0;
  22245. }
  22246. /**
  22247. * @function LevelRenderer.Storage.prototype.addRoot
  22248. * @description 添加图形(Shape)或者组(Group)到根节点。
  22249. *
  22250. * @param {(LevelRenderer.Shape/LevelRenderer.Group)} el - 图形。
  22251. *
  22252. */
  22253. addRoot(el) {
  22254. if (el instanceof Group) {
  22255. el.addChildrenToStorage(this);
  22256. }
  22257. this.addToMap(el);
  22258. this._roots.push(el);
  22259. }
  22260. /**
  22261. * @function LevelRenderer.Storage.prototype.delRoot
  22262. * @description 删除指定的图形(Shape)或者组(Group)。
  22263. *
  22264. * @param {Array.<string>} elId - 删除图形(Shape)或者组(Group)的 ID 数组。如果为空清空整个Storage。
  22265. *
  22266. */
  22267. delRoot(elId) {
  22268. if (typeof(elId) == 'undefined') {
  22269. // 不指定elId清空
  22270. for (var i = 0; i < this._roots.length; i++) {
  22271. var root = this._roots[i];
  22272. if (root instanceof Group) {
  22273. root.delChildrenFromStorage(this);
  22274. }
  22275. }
  22276. this._elements = {};
  22277. this._hoverElements = [];
  22278. this._roots = [];
  22279. return;
  22280. }
  22281. if (elId instanceof Array) {
  22282. var elIdLen = elId.length;
  22283. for (let i = 0; i < elIdLen; i++) {
  22284. this.delRoot(elId[i]);
  22285. }
  22286. return;
  22287. }
  22288. var el;
  22289. if (typeof(elId) == 'string') {
  22290. el = this._elements[elId];
  22291. } else {
  22292. el = elId;
  22293. }
  22294. var idx = new levelRenderer_Util_Util().indexOf(this._roots, el);
  22295. if (idx >= 0) {
  22296. this.delFromMap(el.id);
  22297. this._roots.splice(idx, 1);
  22298. if (el instanceof Group) {
  22299. el.delChildrenFromStorage(this);
  22300. }
  22301. }
  22302. }
  22303. /**
  22304. * @function LevelRenderer.Storage.prototype.addToMap
  22305. * @description 添加图形到 map。
  22306. *
  22307. * @param {LevelRenderer.Shape} el - 图形。
  22308. * @return {LevelRenderer.Storage} this。
  22309. */
  22310. addToMap(el) {
  22311. if (el instanceof Group) {
  22312. el._storage = this;
  22313. }
  22314. el.modSelf();
  22315. this._elements[el.id] = el;
  22316. return this;
  22317. }
  22318. /**
  22319. * @function LevelRenderer.Storage.prototype.get
  22320. * @description 获取指定图形。
  22321. *
  22322. * @param {string} elId - 图形 id。
  22323. * @return {LevelRenderer.Shape} 图形。
  22324. */
  22325. get(elId) {
  22326. return this._elements[elId];
  22327. }
  22328. /**
  22329. * @function LevelRenderer.Storage.prototype.delFromMap
  22330. * @description 从 map 中删除指定图形。
  22331. *
  22332. * @param {string} elId - 图形id。
  22333. * @return {LevelRenderer.Storage} this。
  22334. */
  22335. delFromMap(elId) {
  22336. var el = this._elements[elId];
  22337. if (el) {
  22338. delete this._elements[elId];
  22339. if (el instanceof Group) {
  22340. el._storage = null;
  22341. }
  22342. }
  22343. return this;
  22344. }
  22345. /**
  22346. * @function LevelRenderer.Storage.prototype.dispose
  22347. * @description 清空并且释放 Storage。
  22348. */
  22349. dispose() {
  22350. this._elements = null;
  22351. // this._renderList = null;
  22352. this._roots = null;
  22353. this._hoverElements = null;
  22354. }
  22355. static shapeCompareFunc(a, b) {
  22356. if (a.zlevel == b.zlevel) {
  22357. if (a.z == b.z) {
  22358. return a.__renderidx - b.__renderidx;
  22359. }
  22360. return a.z - b.z;
  22361. }
  22362. return a.zlevel - b.zlevel;
  22363. }
  22364. }
  22365. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Rectangle.js
  22366. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22367. * This program are made available under the terms of the Apache License, Version 2.0
  22368. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22369. /**
  22370. * @class GeometryRectangle
  22371. * @aliasclass Geometry.Rectangle
  22372. * @deprecatedclass SuperMap.Geometry.Rectangle
  22373. * @classdesc 矩形几何对象类。
  22374. * @category BaseTypes Geometry
  22375. * @param {number} x - 矩形左下角点的横坐标。
  22376. * @param {number} y - 矩形左下角点的纵坐标。
  22377. * @param {number} width - 矩形的宽度。
  22378. * @param {number} height - 矩形的高度。
  22379. * @extends {Geometry}
  22380. * @example
  22381. * //x 为矩形左下角点的横坐标;y 为矩形左下角点的纵坐标;w 为矩形的宽度;h 为矩形的高度
  22382. * var x = 1;
  22383. * var y = 2;
  22384. * var w = 10;
  22385. * var h = 20;
  22386. * var recttangle = new GeometryRectangle(x, y, w, h);
  22387. * @usage
  22388. */
  22389. class Rectangle extends Geometry_Geometry {
  22390. constructor(x, y, width, height) {
  22391. super(x, y, width, height);
  22392. /**
  22393. * @member {number} GeometryRectangle.prototype.x
  22394. * @description 矩形左下角点的横坐标。
  22395. */
  22396. this.x = x;
  22397. /**
  22398. * @member {number} GeometryRectangle.prototype.y
  22399. * @description 矩形左下角点的纵坐标。
  22400. */
  22401. this.y = y;
  22402. /**
  22403. * @member {number} GeometryRectangle.prototype.width
  22404. * @description 矩形的宽度。
  22405. */
  22406. this.width = width;
  22407. /**
  22408. * @member {number} GeometryRectangle.prototype.height
  22409. * @description 矩形的高度。
  22410. */
  22411. this.height = height;
  22412. this.CLASS_NAME = "SuperMap.Geometry.Rectangle";
  22413. this.geometryType = "Rectangle";
  22414. }
  22415. /**
  22416. * @function GeometryRectangle.prototype.calculateBounds
  22417. * @description 计算出此矩形对象的 bounds。
  22418. */
  22419. calculateBounds() {
  22420. this.bounds = new Bounds(this.x, this.y,
  22421. this.x + this.width,
  22422. this.y + this.height);
  22423. }
  22424. /**
  22425. * @function GeometryRectangle.prototype.getArea
  22426. * @description 获取矩形对象的面积。
  22427. * @returns {number} 矩形对象面积。
  22428. */
  22429. getArea() {
  22430. var area = this.width * this.height;
  22431. return area;
  22432. }
  22433. }
  22434. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/index.js
  22435. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22436. * This program are made available under the terms of the Apache License, Version 2.0
  22437. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22438. ;// CONCATENATED MODULE: ./src/common/commontypes/Credential.js
  22439. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22440. * This program are made available under the terms of the Apache License, Version 2.0
  22441. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22442. /**
  22443. * @class Credential
  22444. * @deprecatedclass SuperMap.Credential
  22445. * @category Security
  22446. * @classdesc SuperMap 的安全证书类,其中包括 token 等安全验证信息。</br>
  22447. * 需要使用用户名和密码在:"http://localhost:8090/iserver/services/security/tokens" 下申请 value。</br>
  22448. * 获得形如:"2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ.." 的 value。</br>
  22449. * 目前支持的功能包括:地图服务、专题图、量算、查询、公交换乘、空间分析、网络分析,不支持轮询功能。</br>
  22450. * @param {string} value - 访问受安全限制的服务时用于通过安全认证的验证信息。
  22451. * @param {string} [name='token'] - 验证信息前缀,name=value 部分的 name 部分。
  22452. * @example
  22453. * var pixcel = new Credential("valueString","token");
  22454. * pixcel.destroy();
  22455. * @usage
  22456. */
  22457. class Credential {
  22458. constructor(value, name) {
  22459. /**
  22460. * @member {string} Credential.prototype.value
  22461. * @description 访问受安全限制的服务时用于通过安全认证的验证信息。
  22462. */
  22463. this.value = value ? value : "";
  22464. /**
  22465. * @member {string} [Credential.prototype.name='token']
  22466. * @description 验证信息前缀,name=value 部分的 name 部分。
  22467. */
  22468. this.name = name ? name : "token";
  22469. this.CLASS_NAME = "SuperMap.Credential";
  22470. }
  22471. /**
  22472. * @function Credential.prototype.getUrlParameters
  22473. * @description 获取 name=value 的表达式。
  22474. * @example
  22475. * var credential = new Credential("valueString","token");
  22476. * //这里 str = "token=valueString";
  22477. * var str = credential.getUrlParameters();
  22478. * @returns {string} 安全信息组成的 url 片段。
  22479. */
  22480. getUrlParameters() {
  22481. //当需要其他安全信息的时候,则需要return this.name + "=" + this.value + "&" + "...";的形式添加。
  22482. return this.name + "=" + this.value;
  22483. }
  22484. /**
  22485. * @function Credential.prototype.getValue
  22486. * @description 获取 value。
  22487. * @example
  22488. * var credential = new Credential("2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..","token");
  22489. * //这里 str = "2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..";
  22490. * var str = credential.getValue();
  22491. * @returns {string} value 字符串,在 iServer 服务下该 value 值即为 token 值。
  22492. */
  22493. getValue() {
  22494. return this.value;
  22495. }
  22496. /**
  22497. *
  22498. * @function Credential.prototype.destroy
  22499. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  22500. * @example
  22501. * var credential = new Credential("valueString","token");
  22502. * credential.destroy();
  22503. */
  22504. destroy() {
  22505. this.value = null;
  22506. this.name = null;
  22507. }
  22508. }
  22509. /**
  22510. * @member {Credential} Credential.CREDENTIAL
  22511. * @description 这个对象保存一个安全类的实例,在服务端需要安全验证的时候必须进行设置。
  22512. * @example
  22513. * 代码实例:
  22514. * // 当iServer启用服务安全的时候,下边的代码是必须的。安全证书类能够接收一个value和一个name参数。
  22515. * var value = "(以iServer为例,这里是申请的token值)";
  22516. * var name = "token";
  22517. * // 默认name参数为token,所以当使用iServer服务的时候可以不进行设置。
  22518. * Credential.CREDENTIAL = new Credential(value, name);
  22519. *
  22520. */
  22521. Credential.CREDENTIAL = null;
  22522. ;// CONCATENATED MODULE: ./src/common/commontypes/Date.js
  22523. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22524. * This program are made available under the terms of the Apache License, Version 2.0
  22525. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22526. /**
  22527. * @name Date
  22528. * @namespace
  22529. * @category BaseTypes Util
  22530. * @description 包含 parse、toISOString 方法的实现,两个方法用来解析 RFC 3339 日期,遵循 ECMAScript 5 规范。
  22531. * @private
  22532. */
  22533. var DateExt = {
  22534. /**
  22535. * @description 生成代表一个具体的日期字符串,该日期遵循 ISO 8601 标准(详情查看{@link http://tools.ietf.org/html/rfc3339})。
  22536. * @example
  22537. * var dateString = DateExt.toISOString(new Date());
  22538. * @param {Date} date - 日期对象。
  22539. * @returns {string} 一个代表日期的字符串。(例如 "2010-08-07T16:58:23.123Z")。
  22540. */
  22541. toISOString: (function () {
  22542. //标准的Date会存在toISOString方法,可以直接调用
  22543. if ("toISOString" in Date.prototype) {
  22544. return function (date) {
  22545. return date.toISOString();
  22546. };
  22547. } else {// 部分浏览器没有,就得自己组合,组合后的字符串规则不变
  22548. function pad(num, len) {
  22549. var str = num + "";
  22550. while (str.length < len) {
  22551. str = "0" + str;
  22552. }
  22553. return str;
  22554. }
  22555. return function (date) {
  22556. var str;
  22557. if (isNaN(date.getTime())) {
  22558. // ECMA-262 says throw RangeError, Firefox returns
  22559. // "Invalid Date"
  22560. str = "Invalid Date";
  22561. } else {
  22562. str =
  22563. date.getUTCFullYear() + "-" +
  22564. pad(date.getUTCMonth() + 1, 2) + "-" +
  22565. pad(date.getUTCDate(), 2) + "T" +
  22566. pad(date.getUTCHours(), 2) + ":" +
  22567. pad(date.getUTCMinutes(), 2) + ":" +
  22568. pad(date.getUTCSeconds(), 2) + "." +
  22569. pad(date.getUTCMilliseconds(), 3) + "Z";
  22570. }
  22571. return str;
  22572. };
  22573. }
  22574. })(),
  22575. /**
  22576. * @description 从一个字符串生成一个日期对象。
  22577. * @example
  22578. * var date = DateExt.parse("2010-08-07");
  22579. * @param {string} str - 日期的字符串。(例如: "2010", "2010-08", "2010-08-07", "2010-08-07T16:58:23.123Z","2010-08-07T11:58:23.123-06")。
  22580. * @returns {Date} 日期对象,如果字符串无法被解析,则返回一个无效的日期。(例如 isNaN(date.getTime()))。
  22581. */
  22582. parse: function (str) {
  22583. var date;
  22584. 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)?$/);
  22585. if (match && (match[1] || match[7])) { // must have at least year or time
  22586. var year = parseInt(match[1], 10) || 0;
  22587. var month = (parseInt(match[2], 10) - 1) || 0;
  22588. var day = parseInt(match[3], 10) || 1;
  22589. date = new Date(Date.UTC(year, month, day));
  22590. // optional time
  22591. var type = match[7];
  22592. if (type) {
  22593. var hours = parseInt(match[4], 10);
  22594. var minutes = parseInt(match[5], 10);
  22595. var secFrac = parseFloat(match[6]);
  22596. var seconds = secFrac | 0;
  22597. var milliseconds = Math.round(1000 * (secFrac - seconds));
  22598. date.setUTCHours(hours, minutes, seconds, milliseconds);
  22599. // check offset
  22600. if (type !== "Z") {
  22601. var hoursOffset = parseInt(type, 10);
  22602. var minutesOffset = parseInt(match[8], 10) || 0;
  22603. var offset = -1000 * (60 * (hoursOffset * 60) + minutesOffset * 60);
  22604. date = new Date(date.getTime() + offset);
  22605. }
  22606. }
  22607. } else {
  22608. date = new Date("invalid");
  22609. }
  22610. return date;
  22611. }
  22612. };
  22613. ;// CONCATENATED MODULE: ./src/common/commontypes/Event.js
  22614. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22615. * This program are made available under the terms of the Apache License, Version 2.0
  22616. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22617. /**
  22618. * @name Event
  22619. * @namespace
  22620. * @category BaseTypes Events
  22621. * @description 事件处理函数.
  22622. * @usage
  22623. * ```
  22624. * // 浏览器
  22625. * <script type="text/javascript" src="{cdn}"></script>
  22626. * <script>
  22627. * const element = {namespace}.Event.element();
  22628. *
  22629. * // 弃用的写法
  22630. * const result = SuperMap.Event.element();
  22631. *
  22632. * </script>
  22633. *
  22634. * // ES6 Import
  22635. * import { Event } from '{npm}';
  22636. *
  22637. * const result = Event.element();
  22638. * ```
  22639. */
  22640. var Event_Event = {
  22641. /**
  22642. * @description 事件观察者列表。
  22643. * @type {Object}
  22644. * @default false
  22645. */
  22646. observers: false,
  22647. /**
  22648. * @description KEY_SPACE
  22649. * @type {number}
  22650. * @default 32
  22651. */
  22652. KEY_SPACE: 32,
  22653. /**
  22654. * @description KEY_BACKSPACE
  22655. * @type {number}
  22656. * @default 8
  22657. */
  22658. KEY_BACKSPACE: 8,
  22659. /**
  22660. * @description KEY_TAB
  22661. * @type {number}
  22662. * @default 9
  22663. */
  22664. KEY_TAB: 9,
  22665. /**
  22666. * @description KEY_RETURN
  22667. * @type {number}
  22668. * @default 13
  22669. */
  22670. KEY_RETURN: 13,
  22671. /**
  22672. * @description KEY_ESC
  22673. * @type {number}
  22674. * @default 27
  22675. */
  22676. KEY_ESC: 27,
  22677. /**
  22678. * @description KEY_LEFT
  22679. * @type {number}
  22680. * @default 37
  22681. */
  22682. KEY_LEFT: 37,
  22683. /**
  22684. * @description KEY_UP
  22685. * @type {number}
  22686. * @default 38
  22687. */
  22688. KEY_UP: 38,
  22689. /**
  22690. * @description KEY_RIGHT
  22691. * @type {number}
  22692. * @default 39
  22693. */
  22694. KEY_RIGHT: 39,
  22695. /**
  22696. * @description KEY_DOWN
  22697. * @type {number}
  22698. * @default 40
  22699. */
  22700. KEY_DOWN: 40,
  22701. /**
  22702. * @description KEY_DELETE
  22703. * @type {number}
  22704. * @default 46
  22705. */
  22706. KEY_DELETE: 46,
  22707. /**
  22708. * @description 监听浏览器 DOM 事件。
  22709. * @param {Event} event - Event 对象。
  22710. * @returns {HTMLElement} 触发事件的 DOM 元素。
  22711. */
  22712. element: function (event) {
  22713. return event.target || event.srcElement;
  22714. },
  22715. /**
  22716. * @description 判断事件是否由单次触摸引起。
  22717. * @param {Event} event - Event 对象。
  22718. * @returns {boolean} 是否有且只有一个当前在与触摸表面接触的 Touch 对象。
  22719. */
  22720. isSingleTouch: function (event) {
  22721. return event.touches && event.touches.length === 1;
  22722. },
  22723. /**
  22724. * @description 判断事件是否由多点触控引起。
  22725. * @param {Event} event - Event 对象。
  22726. * @returns {boolean} 是否存在多个当前在与触摸表面接触的 Touch 对象。
  22727. */
  22728. isMultiTouch: function (event) {
  22729. return event.touches && event.touches.length > 1;
  22730. },
  22731. /**
  22732. * @description 确定事件是否由左键单击引起。
  22733. * @param {Event} event - Event 对象。
  22734. * @returns {boolean} 是否点击鼠标左键。
  22735. */
  22736. isLeftClick: function (event) {
  22737. return (((event.which) && (event.which === 1)) ||
  22738. ((event.button) && (event.button === 1)));
  22739. },
  22740. /**
  22741. * @description 确定事件是否由鼠标右键单击引起。
  22742. * @param {Event} event - Event 对象。
  22743. * @returns {boolean} 是否点击鼠标右键。
  22744. */
  22745. isRightClick: function (event) {
  22746. return (((event.which) && (event.which === 3)) ||
  22747. ((event.button) && (event.button === 2)));
  22748. },
  22749. /**
  22750. * @description 阻止事件冒泡。
  22751. * @param {Event} event - Event 对象。
  22752. * @param {boolean} allowDefault - 默认为 false,表示阻止事件的默认行为。
  22753. */
  22754. stop: function (event, allowDefault) {
  22755. if (!allowDefault) {
  22756. if (event.preventDefault) {
  22757. event.preventDefault();
  22758. } else {
  22759. event.returnValue = false;
  22760. }
  22761. }
  22762. if (event.stopPropagation) {
  22763. event.stopPropagation();
  22764. } else {
  22765. event.cancelBubble = true;
  22766. }
  22767. },
  22768. /**
  22769. * @description 查询触发指定事件的 DOM 元素。
  22770. * @param {Event} event - Event 对象。
  22771. * @param {string} tagName - html 标签名。
  22772. * @returns {HTMLElement} DOM 元素。
  22773. */
  22774. findElement: function (event, tagName) {
  22775. var element = Event_Event.element(event);
  22776. while (element.parentNode && (!element.tagName ||
  22777. (element.tagName.toUpperCase() != tagName.toUpperCase()))) {
  22778. element = element.parentNode;
  22779. }
  22780. return element;
  22781. },
  22782. /**
  22783. * @description 监听事件,注册事件处理方法。
  22784. * @param {(HTMLElement|string)} elementParam - 待监听的 DOM 对象或者其 ID 标识。
  22785. * @param {string} name - 监听事件的类别名称。
  22786. * @param {function} observer - 注册的事件处理方法。
  22787. * @param {boolean} [useCapture=false] - 是否捕获。
  22788. */
  22789. observe: function (elementParam, name, observer, useCapture) {
  22790. var element = Util_Util.getElement(elementParam);
  22791. useCapture = useCapture || false;
  22792. if (name === 'keypress' &&
  22793. (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
  22794. || element.attachEvent)) {
  22795. name = 'keydown';
  22796. }
  22797. //if observers cache has not yet been created, create it
  22798. if (!this.observers) {
  22799. this.observers = {};
  22800. }
  22801. //if not already assigned, make a new unique cache ID
  22802. if (!element._eventCacheID) {
  22803. var idPrefix = "eventCacheID_";
  22804. if (element.id) {
  22805. idPrefix = element.id + "_" + idPrefix;
  22806. }
  22807. element._eventCacheID = Util_Util.createUniqueID(idPrefix);
  22808. }
  22809. var cacheID = element._eventCacheID;
  22810. //if there is not yet a hash entry for this element, add one
  22811. if (!this.observers[cacheID]) {
  22812. this.observers[cacheID] = [];
  22813. }
  22814. //add a new observer to this element's list
  22815. this.observers[cacheID].push({
  22816. 'element': element,
  22817. 'name': name,
  22818. 'observer': observer,
  22819. 'useCapture': useCapture
  22820. });
  22821. //add the actual browser event listener
  22822. if (element.addEventListener) {
  22823. if(name === 'mousewheel'){
  22824. // https://www.chromestatus.com/features/6662647093133312
  22825. element.addEventListener(name, observer, {useCapture: useCapture, passive: false} );
  22826. } else {
  22827. element.addEventListener(name, observer, useCapture);
  22828. }
  22829. } else if (element.attachEvent) {
  22830. element.attachEvent('on' + name, observer);
  22831. }
  22832. },
  22833. /**
  22834. * @description 移除给定 DOM 元素的监听事件。
  22835. * @param {(HTMLElement|string)} elementParam - 待监听的 DOM 对象或者其 ID 标识。
  22836. */
  22837. stopObservingElement: function (elementParam) {
  22838. var element = Util_Util.getElement(elementParam);
  22839. var cacheID = element._eventCacheID;
  22840. this._removeElementObservers(Event_Event.observers[cacheID]);
  22841. },
  22842. _removeElementObservers: function (elementObservers) {
  22843. if (elementObservers) {
  22844. for (var i = elementObservers.length - 1; i >= 0; i--) {
  22845. var entry = elementObservers[i];
  22846. var args = new Array(entry.element, entry.name, entry.observer, entry.useCapture);
  22847. Event_Event.stopObserving.apply(this, args);
  22848. }
  22849. }
  22850. },
  22851. /**
  22852. * @description 移除事件监听和注册的事件处理方法。注意:事件的移除和监听相对应,移除时的各属性信息必须监听时保持一致才能确保事件移除成功。
  22853. * @param {(HTMLElement|string)} elementParam - 被监听的 DOM 元素或者其 ID。
  22854. * @param {string} name - 需要移除的被监听事件名称。
  22855. * @param {function} observer - 需要移除的事件处理方法。
  22856. * @param {boolean} [useCapture=false] - 是否捕获。
  22857. * @returns {boolean} 监听事件是否被移除。
  22858. */
  22859. stopObserving: function (elementParam, name, observer, useCapture) {
  22860. useCapture = useCapture || false;
  22861. var element = Util_Util.getElement(elementParam);
  22862. var cacheID = element._eventCacheID;
  22863. if (name === 'keypress') {
  22864. if (navigator.appVersion.match(/Konqueror|Safari|KHTML/) ||
  22865. element.detachEvent) {
  22866. name = 'keydown';
  22867. }
  22868. }
  22869. // find element's entry in this.observers cache and remove it
  22870. var foundEntry = false;
  22871. var elementObservers = Event_Event.observers[cacheID];
  22872. if (elementObservers) {
  22873. // find the specific event type in the element's list
  22874. var i = 0;
  22875. while (!foundEntry && i < elementObservers.length) {
  22876. var cacheEntry = elementObservers[i];
  22877. if ((cacheEntry.name === name) &&
  22878. (cacheEntry.observer === observer) &&
  22879. (cacheEntry.useCapture === useCapture)) {
  22880. elementObservers.splice(i, 1);
  22881. if (elementObservers.length == 0) {
  22882. delete Event_Event.observers[cacheID];
  22883. }
  22884. foundEntry = true;
  22885. break;
  22886. }
  22887. i++;
  22888. }
  22889. }
  22890. //actually remove the event listener from browser
  22891. if (foundEntry) {
  22892. if (element.removeEventListener) {
  22893. element.removeEventListener(name, observer, useCapture);
  22894. } else if (element && element.detachEvent) {
  22895. element.detachEvent('on' + name, observer);
  22896. }
  22897. }
  22898. return foundEntry;
  22899. },
  22900. /**
  22901. * @description 移除缓存中的监听事件。
  22902. */
  22903. unloadCache: function () {
  22904. // check for Event before checking for observers, because
  22905. // Event may be undefined in IE if no map instance was
  22906. // created
  22907. if (Event_Event && Event_Event.observers) {
  22908. for (var cacheID in Event_Event.observers) {
  22909. var elementObservers = Event_Event.observers[cacheID];
  22910. Event_Event._removeElementObservers.apply(this,
  22911. [elementObservers]);
  22912. }
  22913. Event_Event.observers = false;
  22914. }
  22915. },
  22916. CLASS_NAME: "SuperMap.Event"
  22917. };
  22918. /* prevent memory leaks in IE */
  22919. Event_Event.observe(window, 'resize', Event_Event.unloadCache, false);
  22920. ;// CONCATENATED MODULE: ./src/common/commontypes/Events.js
  22921. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22922. * This program are made available under the terms of the Apache License, Version 2.0
  22923. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22924. /**
  22925. * @class Events
  22926. * @deprecatedclass SuperMap.Events
  22927. * @classdesc 事件类。
  22928. * @category BaseTypes Events
  22929. * @param {Object} object - 当前事件对象被添加到的 JS 对象。
  22930. * @param {HTMLElement} element - 响应浏览器事件的 DOM 元素。
  22931. * @param {Array.<string>} eventTypes - 自定义应用事件的数组。
  22932. * @param {boolean} [fallThrough=false] - 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  22933. * @param {Object} options - 事件对象选项。
  22934. * @usage
  22935. */
  22936. class Events {
  22937. constructor(object, element, eventTypes, fallThrough, options) {
  22938. /**
  22939. * @member {Array.<string>} Events.prototype.BROWSER_EVENTS
  22940. * @description 支持的事件。
  22941. * @constant
  22942. * @default [
  22943. "mouseover", "mouseout","mousedown", "mouseup", "mousemove",
  22944. "click", "dblclick", "rightclick", "dblrightclick","resize",
  22945. "focus", "blur","touchstart", "touchmove", "touchend","keydown",
  22946. "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  22947. "MSGestureStart", "MSGestureChange", "MSGestureEnd","contextmenu"
  22948. ]
  22949. */
  22950. this.BROWSER_EVENTS = [
  22951. "mouseover", "mouseout",
  22952. "mousedown", "mouseup", "mousemove",
  22953. "click", "dblclick", "rightclick", "dblrightclick",
  22954. "resize", "focus", "blur",
  22955. "touchstart", "touchmove", "touchend",
  22956. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  22957. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  22958. "contextmenu"
  22959. ];
  22960. /**
  22961. * @member {Object} Events.prototype.listeners
  22962. * @description 事件监听器函数。
  22963. */
  22964. this.listeners = {};
  22965. /**
  22966. * @member {Object} Events.prototype.object
  22967. * @description 发布应用程序事件的对象。
  22968. */
  22969. this.object = object;
  22970. /**
  22971. * @member {HTMLElement} Events.prototype.element
  22972. * @description 接受浏览器事件的 DOM 节点。
  22973. */
  22974. this.element = null;
  22975. /**
  22976. * @member {Array.<string>} Events.prototype.eventTypes
  22977. * @description 支持的事件类型列表。
  22978. */
  22979. this.eventTypes = [];
  22980. /**
  22981. * @member {function} Events.prototype.eventHandler
  22982. * @description 绑定在元素上的事件处理器对象。
  22983. */
  22984. this.eventHandler = null;
  22985. /**
  22986. * @member {boolean} [Events.prototype.fallThrough=false]
  22987. * @description 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  22988. */
  22989. this.fallThrough = fallThrough;
  22990. /**
  22991. * @member {boolean} [Events.prototype.includeXY=false]
  22992. * @description 判断是否让 xy 属性自动创建到浏览器上的鼠标事件,一般设置为 false,如果设置为 true,鼠标事件将会在事件传递过程中自动产生 xy 属性。可根据事件对象的 'evt.object' 属性在相关的事件句柄上调用 getMousePosition 函数。这个选项习惯默认为 false 的原因在于,当创建一个事件对象,其主要目的是管理。在一个 div 的相对定位的鼠标事件,将其设为 true 也是有意义的。这个选项也可以用来控制是否抵消缓存。如果设为 false 不抵消,如果设为 true,用 this.clearMouseCache() 清除缓存偏移(边界元素偏移,元素在页面的位置偏移)。
  22993. * @example
  22994. * function named(evt) {
  22995. * this.xy = this.object.events.getMousePosition(evt);
  22996. * }
  22997. */
  22998. this.includeXY = false;
  22999. /**
  23000. * @member {Object} Events.prototype.extensions
  23001. * @description 事件扩展。Keys 代表事件类型,values 代表事件对象。
  23002. */
  23003. this.extensions = {};
  23004. /**
  23005. * @member {Object} Events.prototype.extensionCount
  23006. * @description 事件扩展数量。
  23007. */
  23008. this.extensionCount = {};
  23009. /**
  23010. * @member {Object} Events.prototype.clearMouseListener
  23011. * @description 待移除的鼠标监听事件。
  23012. */
  23013. this.clearMouseListener = null;
  23014. Util_Util.extend(this, options);
  23015. if (eventTypes != null) {
  23016. for (var i = 0, len = eventTypes.length; i < len; i++) {
  23017. this.addEventType(eventTypes[i]);
  23018. }
  23019. }
  23020. if (element != null) {
  23021. this.attachToElement(element);
  23022. }
  23023. this.CLASS_NAME = "SuperMap.Events";
  23024. }
  23025. /**
  23026. * @function Events.prototype.destroy
  23027. * @description 移除当前要素 element 上的所有事件监听和处理。
  23028. */
  23029. destroy() {
  23030. for (var e in this.extensions) {
  23031. if (typeof this.extensions[e] !== "boolean") {
  23032. this.extensions[e].destroy();
  23033. }
  23034. }
  23035. this.extensions = null;
  23036. if (this.element) {
  23037. Event_Event.stopObservingElement(this.element);
  23038. if (this.element.hasScrollEvent) {
  23039. Event_Event.stopObserving(
  23040. window, "scroll", this.clearMouseListener
  23041. );
  23042. }
  23043. }
  23044. this.element = null;
  23045. this.listeners = null;
  23046. this.object = null;
  23047. this.eventTypes = null;
  23048. this.fallThrough = null;
  23049. this.eventHandler = null;
  23050. }
  23051. /**
  23052. * @function Events.prototype.addEventType
  23053. * @description 在此事件对象中添加新的事件类型,如果这个事件类型已经添加过了,则不做任何事情。
  23054. * @param {string} eventName - 事件名。
  23055. */
  23056. addEventType(eventName) {
  23057. if (!this.listeners[eventName]) {
  23058. this.eventTypes.push(eventName);
  23059. this.listeners[eventName] = [];
  23060. }
  23061. }
  23062. /**
  23063. * @function Events.prototype.attachToElement
  23064. * @description 给 DOM 元素绑定浏览器事件。
  23065. * @param {HTMLElement} element - 绑定浏览器事件的 DOM 元素。
  23066. */
  23067. attachToElement(element) {
  23068. if (this.element) {
  23069. Event_Event.stopObservingElement(this.element);
  23070. } else {
  23071. // keep a bound copy of handleBrowserEvent() so that we can
  23072. // pass the same function to both Event.observe() and .stopObserving()
  23073. this.eventHandler = FunctionExt.bindAsEventListener(
  23074. this.handleBrowserEvent, this
  23075. );
  23076. // to be used with observe and stopObserving
  23077. this.clearMouseListener = FunctionExt.bind(
  23078. this.clearMouseCache, this
  23079. );
  23080. }
  23081. this.element = element;
  23082. for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {
  23083. var eventType = this.BROWSER_EVENTS[i];
  23084. // every browser event has a corresponding application event
  23085. // (whether it's listened for or not).
  23086. this.addEventType(eventType);
  23087. // use Prototype to register the event cross-browser
  23088. Event_Event.observe(element, eventType, this.eventHandler);
  23089. }
  23090. // disable dragstart in IE so that mousedown/move/up works normally
  23091. Event_Event.observe(element, "dragstart", Event_Event.stop);
  23092. }
  23093. /**
  23094. * @function Events.prototype.on
  23095. * @description 在一个相同的范围内注册监听器的方法,此方法调用 register 函数。
  23096. * @example
  23097. * // 注册一个 "loadstart" 监听事件
  23098. * events.on({"loadstart": loadStartListener});
  23099. *
  23100. * // 同样注册一个 "loadstart" 监听事件
  23101. * events.register("loadstart", undefined, loadStartListener);
  23102. *
  23103. * // 同时为对象注册多个监听事件
  23104. * events.on({
  23105. * "loadstart": loadStartListener,
  23106. * "loadend": loadEndListener,
  23107. * scope: object
  23108. * });
  23109. *
  23110. * // 同时为对象注册多个监听事件,多次调用 register 方法
  23111. * events.register("loadstart", object, loadStartListener);
  23112. * events.register("loadend", object, loadEndListener);
  23113. *
  23114. *
  23115. * @param {Object} object - 添加监听的对象。
  23116. */
  23117. on(object) {
  23118. for (var type in object) {
  23119. if (type !== "scope" && object.hasOwnProperty(type)) {
  23120. this.register(type, object.scope, object[type]);
  23121. }
  23122. }
  23123. }
  23124. /**
  23125. * @function Events.prototype.register
  23126. * @description 在事件对象上注册一个事件。当事件被触发时,'func' 函数被调用,假设我们触发一个事件,
  23127. * 指定 Bounds 作为 "obj",当事件被触发时,回调函数的上下文作为 Bounds 对象。
  23128. * @param {string} type - 事件注册者的名字。
  23129. * @param {Object} [obj=this.object] - 对象绑定的回调。
  23130. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  23131. * @param {(boolean|Object)} [priority] - 当为 true 时将新的监听加在事件队列的前面。
  23132. */
  23133. register(type, obj, func, priority) {
  23134. if (type in Events && !this.extensions[type]) {
  23135. this.extensions[type] = new Events[type](this);
  23136. }
  23137. if ((func != null) &&
  23138. (Util_Util.indexOf(this.eventTypes, type) !== -1)) {
  23139. if (obj == null) {
  23140. obj = this.object;
  23141. }
  23142. var listeners = this.listeners[type];
  23143. if (!listeners) {
  23144. listeners = [];
  23145. this.listeners[type] = listeners;
  23146. this.extensionCount[type] = 0;
  23147. }
  23148. var listener = {obj: obj, func: func};
  23149. if (priority) {
  23150. listeners.splice(this.extensionCount[type], 0, listener);
  23151. if (typeof priority === "object" && priority.extension) {
  23152. this.extensionCount[type]++;
  23153. }
  23154. } else {
  23155. listeners.push(listener);
  23156. }
  23157. }
  23158. }
  23159. /**
  23160. * @function Events.prototype.registerPriority
  23161. * @description 相同的注册方法,但是在前面增加新的监听者事件查询而代替到方法的结束。
  23162. * @param {string} type - 事件注册者的名字。
  23163. * @param {Object} [obj=this.object] - 对象绑定的回调。
  23164. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  23165. */
  23166. registerPriority(type, obj, func) {
  23167. this.register(type, obj, func, true);
  23168. }
  23169. /**
  23170. * @function Events.prototype.un
  23171. * @description 在一个相同的范围内取消注册监听器的方法,此方法调用 unregister 函数。
  23172. * @example
  23173. * // 移除 "loadstart" 事件监听
  23174. * events.un({"loadstart": loadStartListener});
  23175. *
  23176. * // 使用 "unregister" 方法移除 "loadstart" 事件监听
  23177. * events.unregister("loadstart", undefined, loadStartListener);
  23178. *
  23179. * // 取消对象多个事件监听
  23180. * events.un({
  23181. * "loadstart": loadStartListener,
  23182. * "loadend": loadEndListener,
  23183. * scope: object
  23184. * });
  23185. *
  23186. * // 取消对象多个事件监听,多次调用unregister方法。
  23187. * events.unregister("loadstart", object, loadStartListener);
  23188. * events.unregister("loadend", object, loadEndListener);
  23189. *
  23190. * @param {Object} object - 移除监听的对象。
  23191. */
  23192. un(object) {
  23193. for (var type in object) {
  23194. if (type !== "scope" && object.hasOwnProperty(type)) {
  23195. this.unregister(type, object.scope, object[type]);
  23196. }
  23197. }
  23198. }
  23199. /**
  23200. * @function Events.prototype.unregister
  23201. * @description 取消注册。
  23202. * @param {string} type - 事件类型。
  23203. * @param {Object} [obj=this.object] - 对象绑定的回调。
  23204. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  23205. */
  23206. unregister(type, obj, func) {
  23207. if (obj == null) {
  23208. obj = this.object;
  23209. }
  23210. var listeners = this.listeners[type];
  23211. if (listeners != null) {
  23212. for (var i = 0, len = listeners.length; i < len; i++) {
  23213. if (listeners[i].obj === obj && listeners[i].func === func) {
  23214. listeners.splice(i, 1);
  23215. break;
  23216. }
  23217. }
  23218. }
  23219. }
  23220. /**
  23221. * @function Events.prototype.remove
  23222. * @description 删除某个事件类型的所有监听,如果该事件类型没有注册,则不做任何操作。
  23223. * @param {string} type - 事件类型。
  23224. */
  23225. remove(type) {
  23226. if (this.listeners[type] != null) {
  23227. this.listeners[type] = [];
  23228. }
  23229. }
  23230. /**
  23231. * @function Events.prototype.triggerEvent
  23232. * @description 触发一个特定的注册事件。
  23233. * @param {string} type - 触发事件类型。
  23234. * @param {Event} evt - 事件对象。
  23235. * @returns {Event|boolean} 监听对象,如果返回是 false,则停止监听。
  23236. */
  23237. triggerEvent(type, evt) {
  23238. var listeners = this.listeners[type];
  23239. // fast path
  23240. if (!listeners || listeners.length == 0) {
  23241. return undefined;
  23242. }
  23243. // prep evt object with object & div references
  23244. if (evt == null) {
  23245. evt = {};
  23246. }
  23247. evt.object = this.object;
  23248. evt.element = this.element;
  23249. if (!evt.type) {
  23250. evt.type = type;
  23251. }
  23252. // execute all callbacks registered for specified type
  23253. // get a clone of the listeners array to
  23254. // allow for splicing during callbacks
  23255. listeners = listeners.slice();
  23256. var continueChain;
  23257. for (var i = 0, len = listeners.length; i < len; i++) {
  23258. var callback = listeners[i];
  23259. // bind the context to callback.obj
  23260. continueChain = callback.func.apply(callback.obj, [evt]);
  23261. if ((continueChain != undefined) && (continueChain === false)) {
  23262. // if callback returns false, execute no more callbacks.
  23263. break;
  23264. }
  23265. }
  23266. // don't fall through to other DOM elements
  23267. if (!this.fallThrough) {
  23268. Event_Event.stop(evt, true);
  23269. }
  23270. return continueChain;
  23271. }
  23272. /**
  23273. * @function Events.prototype.handleBrowserEvent
  23274. * @description 对 triggerEvent 函数的包装,给事件对象设置了 xy 属性(即当前鼠标点的 xy 坐标)。
  23275. * @param {Event} evt - 事件对象。
  23276. */
  23277. handleBrowserEvent(evt) {
  23278. var type = evt.type, listeners = this.listeners[type];
  23279. if (!listeners || listeners.length == 0) {
  23280. // noone's listening, bail out
  23281. return;
  23282. }
  23283. // add clientX & clientY to all events - corresponds to average x, y
  23284. var touches = evt.touches;
  23285. if (touches && touches[0]) {
  23286. var x = 0;
  23287. var y = 0;
  23288. var num = touches.length;
  23289. var touch;
  23290. for (var i = 0; i < num; ++i) {
  23291. touch = touches[i];
  23292. x += touch.clientX;
  23293. y += touch.clientY;
  23294. }
  23295. evt.clientX = x / num;
  23296. evt.clientY = y / num;
  23297. }
  23298. if (this.includeXY) {
  23299. evt.xy = this.getMousePosition(evt);
  23300. }
  23301. this.triggerEvent(type, evt);
  23302. }
  23303. /**
  23304. * @function Events.prototype.clearMouseCache
  23305. * @description 清除鼠标缓存。
  23306. */
  23307. clearMouseCache() {
  23308. this.element.scrolls = null;
  23309. this.element.lefttop = null;
  23310. var body = document.body;
  23311. if (body && !((body.scrollTop != 0 || body.scrollLeft != 0) &&
  23312. navigator.userAgent.match(/iPhone/i))) {
  23313. this.element.offsets = null;
  23314. }
  23315. }
  23316. /**
  23317. * @function Events.prototype.getMousePosition
  23318. * @description 获取当前鼠标的位置。
  23319. * @param {Event} evt - 事件对象。
  23320. * @returns {Pixel} 当前的鼠标的 xy 坐标点。
  23321. */
  23322. getMousePosition(evt) {
  23323. if (!this.includeXY) {
  23324. this.clearMouseCache();
  23325. } else if (!this.element.hasScrollEvent) {
  23326. Event_Event.observe(window, "scroll", this.clearMouseListener);
  23327. this.element.hasScrollEvent = true;
  23328. }
  23329. if (!this.element.scrolls) {
  23330. var viewportElement = Util_Util.getViewportElement();
  23331. this.element.scrolls = [
  23332. viewportElement.scrollLeft,
  23333. viewportElement.scrollTop
  23334. ];
  23335. }
  23336. if (!this.element.lefttop) {
  23337. this.element.lefttop = [
  23338. (document.documentElement.clientLeft || 0),
  23339. (document.documentElement.clientTop || 0)
  23340. ];
  23341. }
  23342. if (!this.element.offsets) {
  23343. this.element.offsets = Util_Util.pagePosition(this.element);
  23344. }
  23345. return new Pixel(
  23346. (evt.clientX + this.element.scrolls[0]) - this.element.offsets[0]
  23347. - this.element.lefttop[0],
  23348. (evt.clientY + this.element.scrolls[1]) - this.element.offsets[1]
  23349. - this.element.lefttop[1]
  23350. );
  23351. }
  23352. }
  23353. Events.prototype.BROWSER_EVENTS = [
  23354. "mouseover", "mouseout",
  23355. "mousedown", "mouseup", "mousemove",
  23356. "click", "dblclick", "rightclick", "dblrightclick",
  23357. "resize", "focus", "blur",
  23358. "touchstart", "touchmove", "touchend",
  23359. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  23360. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  23361. "contextmenu"
  23362. ];
  23363. ;// CONCATENATED MODULE: ./src/common/commontypes/index.js
  23364. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23365. * This program are made available under the terms of the Apache License, Version 2.0
  23366. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23367. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Shape.js
  23368. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23369. * This program are made available under the terms of the Apache License, Version 2.0
  23370. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23371. /**
  23372. * @private
  23373. * @class LevelRenderer.Shape
  23374. * @category Visualization Theme
  23375. * @classdesc 图形(shape)基类。
  23376. * @extends LevelRenderer.Eventful
  23377. * @extends LevelRenderer.Transformable
  23378. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  23379. */
  23380. class Shape_Shape extends mixinExt(Eventful, Transformable) {
  23381. constructor(options) {
  23382. super(options);
  23383. options = options || {};
  23384. /**
  23385. * @member {string} LevelRenderer.Shape.prototype.id
  23386. * @description 唯一标识。
  23387. */
  23388. this.id = null;
  23389. /**
  23390. * @member {Object} LevelRenderer.Shape.prototype.style
  23391. * @description 基础绘制样式。
  23392. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  23393. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  23394. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  23395. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  23396. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  23397. * @param {number} style.opacity - 绘制透明度。默认值:1。
  23398. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  23399. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  23400. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  23401. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  23402. * @param {string} style.text - 图形中的附加文本。默认值:""。
  23403. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  23404. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  23405. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  23406. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  23407. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  23408. *
  23409. */
  23410. this.style = {};
  23411. /**
  23412. * @member {Object} LevelRenderer.Shape.prototype.style.__rect
  23413. * @description 包围图形的最小矩形盒子。
  23414. *
  23415. * @param {number} x - 左上角顶点x轴坐标。
  23416. * @param {number} y - 左上角顶点y轴坐标。
  23417. * @param {number} width - 包围盒矩形宽度。
  23418. * @param {number} height - 包围盒矩形高度。
  23419. */
  23420. /**
  23421. * @member {Object} LevelRenderer.Shape.prototype.highlightStyle
  23422. * @description 高亮样式。
  23423. *
  23424. * @param {string} highlightStyle.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  23425. * @param {string} highlightStyle.color - 填充颜色。默认值:"#000000'"。
  23426. * @param {string} highlightStyle.strokeColor - 描边颜色。默认值:"#000000'"。
  23427. * @param {string} highlightStyle.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  23428. * @param {number} highlightStyle.lineWidth - 描边宽度。默认值:1。
  23429. * @param {number} highlightStyle.opacity - 绘制透明度。默认值:1。
  23430. * @param {number} highlightStyle.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  23431. * @param {number} highlightStyle.shadowColor - 阴影颜色。默认值:"#000000'"。
  23432. * @param {number} highlightStyle.shadowOffsetX - 阴影横向偏移。默认值:0。
  23433. * @param {number} highlightStyle.shadowOffsetY - 阴影纵向偏移。默认值:0。
  23434. * @param {string} highlightStyle.text - 图形中的附加文本。默认值:""。
  23435. * @param {string} highlightStyle.textColor - 文本颜色。默认值:"#000000'"。
  23436. * @param {string} highlightStyle.textFont - 附加文本样式。示例:'bold 18px verdana'。
  23437. * @param {string} highlightStyle.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  23438. * @param {string} highlightStyle.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  23439. * @param {string} highlightStyle.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  23440. */
  23441. this.highlightStyle = null;
  23442. /**
  23443. * @member {Object} LevelRenderer.Shape.prototype.parent
  23444. * @description 父节点,只读属性。<LevelRenderer.Group>
  23445. */
  23446. this.parent = null;
  23447. /**
  23448. * @member {boolean} LevelRenderer.Shape.prototype.__dirty
  23449. * @description {boolean}
  23450. */
  23451. this.__dirty = true;
  23452. /**
  23453. * @member {Array} LevelRenderer.Shape.prototype.__clipShapes
  23454. * @description {Array}
  23455. *
  23456. */
  23457. this.__clipShapes = [];
  23458. /**
  23459. * @member {boolean} LevelRenderer.Shape.prototype.invisible
  23460. * @description 图形是否可见,为 true 时不绘制图形,但是仍能触发鼠标事件。默认值:false。
  23461. */
  23462. this.invisible = false;
  23463. /**
  23464. * @member {boolean} LevelRenderer.Shape.prototype.ignore
  23465. * @description 图形是否忽略,为 true 时忽略图形的绘制以及事件触发。默认值:false。
  23466. */
  23467. this.ignore = false;
  23468. /**
  23469. * @member {boolean} LevelRenderer.Shape.prototype.zlevel
  23470. * @description z 层 level,决定绘画在哪层 canvas 中。默认值:0。
  23471. */
  23472. this.zlevel = 0;
  23473. /**
  23474. * @member {boolean} LevelRenderer.Shape.prototype.draggable
  23475. * @description 是否可拖拽。默认值:false。
  23476. */
  23477. this.draggable = false;
  23478. /**
  23479. * @member {boolean} LevelRenderer.Shape.prototype.clickable
  23480. * @description 是否可点击。默认值:false。
  23481. */
  23482. this.clickable = false;
  23483. /**
  23484. * @member {boolean} LevelRenderer.Shape.prototype.hoverable
  23485. * @description 是否可以 hover。默认值:true。
  23486. */
  23487. this.hoverable = true;
  23488. /**
  23489. * @member {number} LevelRenderer.Shape.prototype.z
  23490. * @description z值,跟zlevel一样影响shape绘制的前后顺序,z值大的shape会覆盖在z值小的上面,但是并不会创建新的canvas,所以优先级低于zlevel,而且频繁改动的开销比zlevel小很多。默认值:0。
  23491. */
  23492. this.z = 0;
  23493. //地理扩展
  23494. /**
  23495. * @member {Array.<number>} LevelRenderer.Shape.prototype.refOriginalPosition
  23496. * @description 图形参考原点位置,图形的参考中心位置。
  23497. * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  23498. *
  23499. * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
  23500. * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
  23501. * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
  23502. *
  23503. * 图形(Shape) 的所有位置相关属性都是以 refOriginalPosition 为参考中心,
  23504. * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
  23505. * refOriginalPosition 的值为 [0, 0] 时,形的位置信息才是 canvas 绝对位置。
  23506. *
  23507. * 图形的位置信息通常有:style.pointList,style.x,style.y。
  23508. *
  23509. * refOriginalPosition。默认值是: [0, 0]。
  23510. */
  23511. this.refOriginalPosition = [0, 0];
  23512. /**
  23513. * @member {string} LevelRenderer.Shape.prototype.refDataID
  23514. * @description 图形所关联数据的 ID。
  23515. *
  23516. */
  23517. this.refDataID = null;
  23518. /**
  23519. * @member {boolean} LevelRenderer.Shape.prototype.isHoverByRefDataID
  23520. * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
  23521. *
  23522. */
  23523. this.isHoverByRefDataID = false;
  23524. /**
  23525. * @member {string} LevelRenderer.Shape.prototype.refDataHoverGroup
  23526. * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
  23527. * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
  23528. *
  23529. */
  23530. this.refDataHoverGroup = null;
  23531. /**
  23532. * @member {Object} LevelRenderer.Shape.prototype.dataInfo
  23533. * @description 图形的数据信息。
  23534. *
  23535. */
  23536. this.dataInfo = null;
  23537. Util_Util.extend(this, options);
  23538. this.id = this.id || Util_Util.createUniqueID("smShape_");
  23539. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape";
  23540. /**
  23541. * @function LevelRenderer.Shape.prototype.getTansform
  23542. * @description 变换鼠标位置到 shape 的局部坐标空间
  23543. *
  23544. */
  23545. this.getTansform = (function () {
  23546. var invTransform = [];
  23547. return function (x, y) {
  23548. var originPos = [x, y];
  23549. // 对鼠标的坐标也做相同的变换
  23550. if (this.needTransform && this.transform) {
  23551. SUtil_SUtil.Util_matrix.invert(invTransform, this.transform);
  23552. SUtil_SUtil.Util_matrix.mulVector(originPos, invTransform, [x, y, 1]);
  23553. if (x == originPos[0] && y == originPos[1]) {
  23554. // 避免外部修改导致的 needTransform 不准确
  23555. this.updateNeedTransform();
  23556. }
  23557. }
  23558. return originPos;
  23559. };
  23560. })();
  23561. }
  23562. /**
  23563. * @function LevelRenderer.Shape.prototype.destroy
  23564. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  23565. */
  23566. destroy() {
  23567. this.id = null;
  23568. this.style = null;
  23569. this.highlightStyle = null;
  23570. this.parent = null;
  23571. this.__dirty = null;
  23572. this.__clipShapes = null;
  23573. this.invisible = null;
  23574. this.ignore = null;
  23575. this.zlevel = null;
  23576. this.draggable = null;
  23577. this.clickable = null;
  23578. this.hoverable = null;
  23579. this.z = null;
  23580. this.refOriginalPosition = null;
  23581. this.refDataID = null;
  23582. this.refDataHoverGroup = null;
  23583. this.isHoverByRefDataID = null;
  23584. this.dataInfo = null;
  23585. super.destroy();
  23586. }
  23587. /**
  23588. * @function LevelRenderer.Shape.prototype.brush
  23589. * @description 绘制图形。
  23590. *
  23591. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  23592. * @param {boolean} isHighlight - 是否使用高亮属性。
  23593. * @param {function} updateCallback - 需要异步加载资源的 shape 可以通过这个 callback(e),让painter更新视图,base.brush 没用,需要的话重载 brush。
  23594. */
  23595. brush(ctx, isHighlight) {
  23596. var style = this.beforeBrush(ctx, isHighlight);
  23597. ctx.beginPath();
  23598. this.buildPath(ctx, style);
  23599. switch (style.brushType) {
  23600. /* jshint ignore:start */
  23601. case 'both':
  23602. this.setCtxGlobalAlpha(ctx, "fill", style);
  23603. ctx.fill();
  23604. if (style.lineWidth > 0) {
  23605. this.setCtxGlobalAlpha(ctx, "stroke", style);
  23606. ctx.stroke();
  23607. }
  23608. this.setCtxGlobalAlpha(ctx, "reset", style);
  23609. break;
  23610. case 'stroke':
  23611. this.setCtxGlobalAlpha(ctx, "stroke", style);
  23612. style.lineWidth > 0 && ctx.stroke();
  23613. this.setCtxGlobalAlpha(ctx, "reset", style);
  23614. break;
  23615. /* jshint ignore:end */
  23616. default:
  23617. this.setCtxGlobalAlpha(ctx, "fill", style);
  23618. ctx.fill();
  23619. this.setCtxGlobalAlpha(ctx, "reset", style);
  23620. break;
  23621. }
  23622. this.drawText(ctx, style, this.style);
  23623. this.afterBrush(ctx);
  23624. }
  23625. /**
  23626. * @function LevelRenderer.Shape.prototype.beforeBrush
  23627. * @description 具体绘制操作前的一些公共操作。
  23628. *
  23629. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  23630. * @param {boolean} isHighlight - 是否使用高亮属性。
  23631. * @return {Object} 处理后的样式。
  23632. */
  23633. beforeBrush(ctx, isHighlight) {
  23634. var style = this.style;
  23635. if (this.brushTypeOnly) {
  23636. style.brushType = this.brushTypeOnly;
  23637. }
  23638. if (isHighlight) {
  23639. // 根据style扩展默认高亮样式
  23640. style = this.getHighlightStyle(
  23641. style,
  23642. this.highlightStyle || {},
  23643. this.brushTypeOnly
  23644. );
  23645. }
  23646. if (this.brushTypeOnly == 'stroke') {
  23647. style.strokeColor = style.strokeColor || style.color;
  23648. }
  23649. ctx.save();
  23650. this.doClip(ctx);
  23651. this.setContext(ctx, style);
  23652. // 设置transform
  23653. this.setTransform(ctx);
  23654. return style;
  23655. }
  23656. /**
  23657. * @function LevelRenderer.Shape.prototype.afterBrush
  23658. * @description 绘制后的处理。
  23659. *
  23660. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  23661. *
  23662. */
  23663. afterBrush(ctx) {
  23664. ctx.restore();
  23665. }
  23666. /**
  23667. * @function LevelRenderer.Shape.prototype.setContext
  23668. * @description 设置 fillStyle, strokeStyle, shadow 等通用绘制样式。
  23669. *
  23670. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  23671. * @param {Object} style - 样式。
  23672. *
  23673. */
  23674. setContext(ctx, style) {
  23675. var STYLE_CTX_MAP = [
  23676. ['color', 'fillStyle'],
  23677. ['strokeColor', 'strokeStyle'],
  23678. ['opacity', 'globalAlpha'],
  23679. ['lineCap', 'lineCap'],
  23680. ['lineJoin', 'lineJoin'],
  23681. ['miterLimit', 'miterLimit'],
  23682. ['lineWidth', 'lineWidth'],
  23683. ['shadowBlur', 'shadowBlur'],
  23684. ['shadowColor', 'shadowColor'],
  23685. ['shadowOffsetX', 'shadowOffsetX'],
  23686. ['shadowOffsetY', 'shadowOffsetY']
  23687. ];
  23688. for (var i = 0, len = STYLE_CTX_MAP.length; i < len; i++) {
  23689. var styleProp = STYLE_CTX_MAP[i][0];
  23690. var styleValue = style[styleProp];
  23691. var ctxProp = STYLE_CTX_MAP[i][1];
  23692. if (typeof styleValue != 'undefined') {
  23693. ctx[ctxProp] = styleValue;
  23694. }
  23695. }
  23696. }
  23697. /**
  23698. * @function LevelRenderer.Shape.prototype.doClip
  23699. *
  23700. */
  23701. doClip(ctx) {
  23702. var clipShapeInvTransform = SUtil_SUtil.Util_matrix.create();
  23703. if (this.__clipShapes) {
  23704. for (var i = 0; i < this.__clipShapes.length; i++) {
  23705. var clipShape = this.__clipShapes[i];
  23706. if (clipShape.needTransform) {
  23707. let m = clipShape.transform;
  23708. SUtil_SUtil.Util_matrix.invert(clipShapeInvTransform, m);
  23709. ctx.transform(
  23710. m[0], m[1],
  23711. m[2], m[3],
  23712. m[4], m[5]
  23713. );
  23714. }
  23715. ctx.beginPath();
  23716. clipShape.buildPath(ctx, clipShape.style);
  23717. ctx.clip();
  23718. // Transform back
  23719. if (clipShape.needTransform) {
  23720. let m = clipShapeInvTransform;
  23721. ctx.transform(
  23722. m[0], m[1],
  23723. m[2], m[3],
  23724. m[4], m[5]
  23725. );
  23726. }
  23727. }
  23728. }
  23729. }
  23730. /**
  23731. * @function LevelRenderer.Shape.prototype.getHighlightStyle
  23732. * @description 根据默认样式扩展高亮样式
  23733. *
  23734. * @param {Object} style - 样式。
  23735. * @param {Object} highlightStyle - 高亮样式。
  23736. * @param {string} brushTypeOnly - brushTypeOnly。
  23737. *
  23738. */
  23739. getHighlightStyle(style, highlightStyle, brushTypeOnly) {
  23740. var newStyle = {};
  23741. for (let k in style) {
  23742. newStyle[k] = style[k];
  23743. }
  23744. var highlightColor = SUtil_SUtil.Util_color.getHighlightColor();
  23745. // 根据highlightStyle扩展
  23746. if (style.brushType != 'stroke') {
  23747. // 带填充则用高亮色加粗边线
  23748. newStyle.strokeColor = highlightColor;
  23749. // SMIC-方法修改 - start
  23750. newStyle.lineWidth = (style.lineWidth || 1);
  23751. // 原始代码
  23752. // newStyle.lineWidth = (style.lineWidth || 1)
  23753. // + this.getHighlightZoom();
  23754. // 修改代码1
  23755. // if(!style.lineType || style.lineType === "solid"){
  23756. // newStyle.lineWidth = (style.lineWidth || 1)
  23757. // + this.getHighlightZoom();
  23758. // }
  23759. // else{
  23760. // newStyle.lineWidth = (style.lineWidth || 1);
  23761. // }
  23762. // SMIC-方法修改 - end
  23763. newStyle.brushType = 'both';
  23764. } else {
  23765. if (brushTypeOnly != 'stroke') {
  23766. // 描边型的则用原色加工高亮
  23767. newStyle.strokeColor = highlightColor;
  23768. // SMIC-方法修改 - start
  23769. newStyle.lineWidth = (style.lineWidth || 1);
  23770. // 原始代码
  23771. // newStyle.lineWidth = (style.lineWidth || 1)
  23772. // + this.getHighlightZoom();
  23773. // 修改代码1
  23774. // if(!style.lineType || style.lineType === "solid"){
  23775. // newStyle.lineWidth = (style.lineWidth || 1)
  23776. // + this.getHighlightZoom();
  23777. // }
  23778. // else{
  23779. // newStyle.lineWidth = (style.lineWidth || 1);
  23780. // }
  23781. // SMIC-方法修改 - end
  23782. } else {
  23783. // 线型的则用原色加工高亮
  23784. newStyle.strokeColor = highlightStyle.strokeColor
  23785. || SUtil_SUtil.Util_color.mix(
  23786. style.strokeColor,
  23787. SUtil_SUtil.Util_color.toRGB(highlightColor)
  23788. );
  23789. }
  23790. }
  23791. // 可自定义覆盖默认值
  23792. for (let k in highlightStyle) {
  23793. if (typeof highlightStyle[k] != 'undefined') {
  23794. newStyle[k] = highlightStyle[k];
  23795. }
  23796. }
  23797. return newStyle;
  23798. }
  23799. /**
  23800. * @function LevelRenderer.Shape.prototype.getHighlightZoom
  23801. * @description 高亮放大效果参数,当前统一设置为6,如有需要差异设置,通过 this.type 判断实例类型
  23802. *
  23803. */
  23804. getHighlightZoom() {
  23805. return this.type != 'text' ? 6 : 2;
  23806. }
  23807. /**
  23808. * @function LevelRenderer.Shape.prototype.drift
  23809. * @description 移动位置
  23810. *
  23811. * @param {Object} dx - 横坐标变化。
  23812. * @param {Object} dy - 纵坐标变化。
  23813. *
  23814. */
  23815. drift(dx, dy) {
  23816. this.position[0] += dx;
  23817. this.position[1] += dy;
  23818. }
  23819. /**
  23820. * @function LevelRenderer.Shape.prototype.buildPath
  23821. * @description 构建绘制的Path。子类必须重新实现此方法。
  23822. *
  23823. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  23824. * @param {Object} style - 样式。
  23825. */
  23826. buildPath(ctx, style) { // eslint-disable-line no-unused-vars
  23827. SUtil_SUtil.Util_log('buildPath not implemented in ' + this.type);
  23828. }
  23829. /**
  23830. * @function LevelRenderer.Shape.prototype.getRect
  23831. * @description 计算返回包围盒矩形。子类必须重新实现此方法。
  23832. *
  23833. * @param {Object} style - 样式。
  23834. */
  23835. getRect(style) { // eslint-disable-line no-unused-vars
  23836. SUtil_SUtil.Util_log('getRect not implemented in ' + this.type);
  23837. }
  23838. /**
  23839. * @function LevelRenderer.Shape.prototype.isCover
  23840. * @description 判断鼠标位置是否在图形内。
  23841. *
  23842. * @param {number} x - x。
  23843. * @param {number} y - y。
  23844. */
  23845. isCover(x, y) {
  23846. var originPos = this.getTansform(x, y);
  23847. x = originPos[0];
  23848. y = originPos[1];
  23849. // 快速预判并保留判断矩形
  23850. var rect = this.style.__rect;
  23851. if (!rect) {
  23852. rect = this.style.__rect = this.getRect(this.style);
  23853. }
  23854. if (x >= rect.x
  23855. && x <= (rect.x + rect.width)
  23856. && y >= rect.y
  23857. && y <= (rect.y + rect.height)
  23858. ) {
  23859. // 矩形内
  23860. return SUtil_SUtil.Util_area.isInside(this, this.style, x, y);
  23861. }
  23862. return false;
  23863. }
  23864. /**
  23865. * @function LevelRenderer.Shape.prototype.drawText
  23866. * @description 绘制附加文本。
  23867. *
  23868. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  23869. * @param {string} style - 样式。
  23870. * @param {string} normalStyle - normalStyle 默认样式,用于定位文字显示。
  23871. */
  23872. drawText(ctx, style, normalStyle) {
  23873. if (typeof(style.text) == 'undefined' || style.text === false) {
  23874. return;
  23875. }
  23876. // 字体颜色策略
  23877. var textColor = style.textColor || style.color || style.strokeColor;
  23878. ctx.fillStyle = textColor;
  23879. // 文本与图形间空白间隙
  23880. var dd = 10;
  23881. var al; // 文本水平对齐
  23882. var bl; // 文本垂直对齐
  23883. var tx; // 文本横坐标
  23884. var ty; // 文本纵坐标
  23885. var textPosition = style.textPosition // 用户定义
  23886. || this.textPosition // shape默认
  23887. || 'top'; // 全局默认
  23888. // Smic 方法修改 -start
  23889. var __OP = [];
  23890. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  23891. __OP = [0, 0];
  23892. } else {
  23893. __OP = this.refOriginalPosition;
  23894. }
  23895. //原代码:
  23896. // Smic 方法修改 -end
  23897. switch (textPosition) {
  23898. case 'inside':
  23899. case 'top':
  23900. case 'bottom':
  23901. case 'left':
  23902. case 'right':
  23903. if (this.getRect) {
  23904. var rect = (normalStyle || style).__rect
  23905. || this.getRect(normalStyle || style);
  23906. switch (textPosition) {
  23907. case 'inside':
  23908. tx = rect.x + rect.width / 2;
  23909. ty = rect.y + rect.height / 2;
  23910. al = 'center';
  23911. bl = 'middle';
  23912. if (style.brushType != 'stroke'
  23913. && textColor == style.color
  23914. ) {
  23915. ctx.fillStyle = '#fff';
  23916. }
  23917. break;
  23918. case 'left':
  23919. tx = rect.x - dd;
  23920. ty = rect.y + rect.height / 2;
  23921. al = 'end';
  23922. bl = 'middle';
  23923. break;
  23924. case 'right':
  23925. tx = rect.x + rect.width + dd;
  23926. ty = rect.y + rect.height / 2;
  23927. al = 'start';
  23928. bl = 'middle';
  23929. break;
  23930. case 'top':
  23931. tx = rect.x + rect.width / 2;
  23932. ty = rect.y - dd;
  23933. al = 'center';
  23934. bl = 'bottom';
  23935. break;
  23936. case 'bottom':
  23937. tx = rect.x + rect.width / 2;
  23938. ty = rect.y + rect.height + dd;
  23939. al = 'center';
  23940. bl = 'top';
  23941. break;
  23942. }
  23943. }
  23944. break;
  23945. case 'start':
  23946. case 'end':
  23947. var xStart = 0;
  23948. var xEnd = 0;
  23949. var yStart = 0;
  23950. var yEnd = 0;
  23951. if (typeof style.pointList != 'undefined') {
  23952. var pointList = style.pointList;
  23953. if (pointList.length < 2) {
  23954. // 少于2个点就不画了~
  23955. return;
  23956. }
  23957. var length = pointList.length;
  23958. switch (textPosition) {
  23959. // Smic 方法修改 -start
  23960. case 'start':
  23961. xStart = pointList[0][0] + __OP[0];
  23962. xEnd = pointList[1][0] + __OP[0];
  23963. yStart = pointList[0][1] + __OP[1];
  23964. yEnd = pointList[1][1] + __OP[1];
  23965. break;
  23966. case 'end':
  23967. xStart = pointList[length - 2][0] + __OP[0];
  23968. xEnd = pointList[length - 1][0] + __OP[0];
  23969. yStart = pointList[length - 2][1] + __OP[1];
  23970. yEnd = pointList[length - 1][1] + __OP[1];
  23971. break;
  23972. //原代码:
  23973. /*
  23974. case 'start':
  23975. xStart = pointList[0][0];
  23976. xEnd = pointList[1][0];
  23977. yStart = pointList[0][1];
  23978. yEnd = pointList[1][1];
  23979. break;
  23980. case 'end':
  23981. xStart = pointList[length - 2][0];
  23982. xEnd = pointList[length - 1][0];
  23983. yStart = pointList[length - 2][1];
  23984. yEnd = pointList[length - 1][1];
  23985. break;
  23986. */
  23987. // Smic 方法修改 -end
  23988. }
  23989. } else {
  23990. // Smic 方法修改 -start
  23991. xStart = (style.xStart + __OP[0]) || 0;
  23992. xEnd = (style.xEnd + __OP[0]) || 0;
  23993. yStart = (style.yStart + __OP[1]) || 0;
  23994. yEnd = (style.yEnd + __OP[1]) || 0;
  23995. //原代码:
  23996. /*
  23997. xStart = style.xStart || 0;
  23998. xEnd = style.xEnd || 0;
  23999. yStart = style.yStart || 0;
  24000. yEnd = style.yEnd || 0;
  24001. */
  24002. // Smic 方法修改 -end
  24003. }
  24004. switch (textPosition) {
  24005. case 'start':
  24006. al = xStart < xEnd ? 'end' : 'start';
  24007. bl = yStart < yEnd ? 'bottom' : 'top';
  24008. tx = xStart;
  24009. ty = yStart;
  24010. break;
  24011. case 'end':
  24012. al = xStart < xEnd ? 'start' : 'end';
  24013. bl = yStart < yEnd ? 'top' : 'bottom';
  24014. tx = xEnd;
  24015. ty = yEnd;
  24016. break;
  24017. }
  24018. dd -= 4;
  24019. if (xStart && xEnd && xStart != xEnd) {
  24020. tx -= (al == 'end' ? dd : -dd);
  24021. } else {
  24022. al = 'center';
  24023. }
  24024. if (yStart != yEnd) {
  24025. ty -= (bl == 'bottom' ? dd : -dd);
  24026. } else {
  24027. bl = 'middle';
  24028. }
  24029. break;
  24030. case 'specific':
  24031. tx = style.textX || 0;
  24032. ty = style.textY || 0;
  24033. al = 'start';
  24034. bl = 'middle';
  24035. break;
  24036. }
  24037. // Smic 方法修改 -start
  24038. if (style.labelXOffset && !isNaN(style.labelXOffset)) {
  24039. tx += style.labelXOffset;
  24040. }
  24041. if (style.labelYOffset && !isNaN(style.labelYOffset)) {
  24042. ty += style.labelYOffset;
  24043. }
  24044. //原代码:
  24045. // Smic 方法修改 -end
  24046. if (tx != null && ty != null) {
  24047. Shape_Shape._fillText(
  24048. ctx,
  24049. style.text,
  24050. tx, ty,
  24051. style.textFont,
  24052. style.textAlign || al,
  24053. style.textBaseline || bl
  24054. );
  24055. }
  24056. }
  24057. /**
  24058. * @function LevelRenderer.Shape.prototype.modSelf
  24059. * @description 图形发生改变
  24060. */
  24061. modSelf() {
  24062. this.__dirty = true;
  24063. if (this.style) {
  24064. this.style.__rect = null;
  24065. }
  24066. if (this.highlightStyle) {
  24067. this.highlightStyle.__rect = null;
  24068. }
  24069. }
  24070. /**
  24071. * @function LevelRenderer.Shape.prototype.isSilent
  24072. * @description 图形是否会触发事件,通过 bind 绑定的事件
  24073. */
  24074. isSilent() {
  24075. return !(
  24076. this.hoverable || this.draggable || this.clickable
  24077. || this.onmousemove || this.onmouseover || this.onmouseout
  24078. || this.onmousedown || this.onmouseup || this.onclick
  24079. || this.ondragenter || this.ondragover || this.ondragleave
  24080. || this.ondrop
  24081. );
  24082. }
  24083. /**
  24084. * @function LevelRenderer.Shape.prototype.setCtxGlobalAlpha
  24085. * @description 设置 Cavans 上下文全局透明度
  24086. *
  24087. * @param {Object} _ctx - Cavans 上下文
  24088. * @param {string} type - one of 'stroke', 'fill', or 'reset'
  24089. * @param {Object} style - Symbolizer hash
  24090. */
  24091. setCtxGlobalAlpha(_ctx, type, style) {
  24092. if (type === "fill") {
  24093. _ctx.globalAlpha = typeof(style["fillOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['fillOpacity'];
  24094. } else if (type === "stroke") {
  24095. _ctx.globalAlpha = typeof(style["strokeOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['strokeOpacity'];
  24096. } else {
  24097. _ctx.globalAlpha = typeof(style["opacity"]) === "undefined" ? 1 : style['opacity'];
  24098. }
  24099. }
  24100. /**
  24101. * @function LevelRenderer.Shape.prototype._fillText
  24102. * @description 填充文本
  24103. */
  24104. static _fillText(ctx, text, x, y, textFont, textAlign, textBaseline) {
  24105. if (textFont) {
  24106. ctx.font = textFont;
  24107. }
  24108. ctx.textAlign = textAlign;
  24109. ctx.textBaseline = textBaseline;
  24110. var rect = Shape_Shape._getTextRect(
  24111. text, x, y, textFont, textAlign, textBaseline
  24112. );
  24113. text = (text + '').split('\n');
  24114. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', textFont);
  24115. switch (textBaseline) {
  24116. case 'top':
  24117. y = rect.y;
  24118. break;
  24119. case 'bottom':
  24120. y = rect.y + lineHeight;
  24121. break;
  24122. default:
  24123. y = rect.y + lineHeight / 2;
  24124. }
  24125. for (var i = 0, l = text.length; i < l; i++) {
  24126. ctx.fillText(text[i], x, y);
  24127. y += lineHeight;
  24128. }
  24129. }
  24130. /**
  24131. * @function LevelRenderer.Shape._getTextRect
  24132. * @description 返回矩形区域,用于局部刷新和文字定位
  24133. *
  24134. * @param {string} text - text。
  24135. * @param {number} x - x。
  24136. * @param {number} y - y。
  24137. * @param {string} textFont - textFont。
  24138. * @param {string} textAlign - textAlign。
  24139. * @param {string} textBaseline - textBaseline。
  24140. * @return {Object} 矩形区域。
  24141. */
  24142. static _getTextRect(text, x, y, textFont, textAlign, textBaseline) {
  24143. var width = SUtil_SUtil.Util_area.getTextWidth(text, textFont);
  24144. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', textFont);
  24145. text = (text + '').split('\n');
  24146. switch (textAlign) {
  24147. case 'end':
  24148. case 'right':
  24149. x -= width;
  24150. break;
  24151. case 'center':
  24152. x -= (width / 2);
  24153. break;
  24154. }
  24155. switch (textBaseline) {
  24156. case 'top':
  24157. break;
  24158. case 'bottom':
  24159. y -= lineHeight * text.length;
  24160. break;
  24161. default:
  24162. y -= lineHeight * text.length / 2;
  24163. }
  24164. return {
  24165. x: x,
  24166. y: y,
  24167. width: width,
  24168. height: lineHeight * text.length
  24169. };
  24170. }
  24171. }
  24172. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicImage.js
  24173. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24174. * This program are made available under the terms of the Apache License, Version 2.0
  24175. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24176. /**
  24177. * @private
  24178. * @class LevelRenderer.Shape.SmicImage
  24179. * @category Visualization Theme
  24180. * @classdesc 图片绘制。
  24181. * @extends LevelRenderer.Shape
  24182. * @example
  24183. * var shape = new LevelRenderer.Shape.SmicImage({
  24184. * style: {
  24185. * image: 'test.jpg',
  24186. * x: 100,
  24187. * y: 100
  24188. * }
  24189. * });
  24190. * levelRenderer.addShape(shape);
  24191. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  24192. *
  24193. */
  24194. class SmicImage extends Shape_Shape {
  24195. constructor(options) {
  24196. super(options);
  24197. /**
  24198. * @member {string} LevelRenderer.Shape.SmicImage.prototype.type
  24199. * @description 图形类型。
  24200. */
  24201. this.type = 'smicimage';
  24202. /**
  24203. * @member {string} LevelRenderer.Shape.SmicImage.prototype._imageCache
  24204. * @description 图片缓存。
  24205. */
  24206. this._imageCache = {};
  24207. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  24208. this.refOriginalPosition = [0, 0];
  24209. }
  24210. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicImage";
  24211. }
  24212. /**
  24213. * @function LevelRenderer.Shape.SmicImage.prototype.destroy
  24214. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  24215. */
  24216. destroy() {
  24217. this.type = null;
  24218. this._imageCache = null;
  24219. super.destroy();
  24220. }
  24221. /**
  24222. * @function LevelRenderer.Shape.SmicImage.prototype.buildPath
  24223. * @description 创建图片。
  24224. *
  24225. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  24226. * @param {Object} style - style。
  24227. *
  24228. */
  24229. brush(ctx, isHighlight, refresh) {
  24230. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  24231. this.refOriginalPosition = [0, 0];
  24232. }
  24233. var __OP = this.refOriginalPosition;
  24234. var style = this.style || {};
  24235. if (isHighlight) {
  24236. // 根据style扩展默认高亮样式
  24237. style = this.getHighlightStyle(
  24238. style, this.highlightStyle || {}
  24239. );
  24240. }
  24241. var image = style.image;
  24242. var me = this;
  24243. if (typeof(image) === 'string') {
  24244. var src = image;
  24245. if (this._imageCache[src]) {
  24246. image = this._imageCache[src];
  24247. } else {
  24248. image = new Image();
  24249. image.onload = function () {
  24250. image.onload = null;
  24251. clearTimeout(SmicImage._refreshTimeout);
  24252. SmicImage._needsRefresh.push(me);
  24253. // 防止因为缓存短时间内触发多次onload事件
  24254. SmicImage._refreshTimeout = setTimeout(function () {
  24255. refresh && refresh(SmicImage._needsRefresh);
  24256. // 清空 needsRefresh
  24257. SmicImage._needsRefresh = [];
  24258. }, 10);
  24259. };
  24260. image.src = src;
  24261. this._imageCache[src] = image;
  24262. }
  24263. }
  24264. if (image) {
  24265. // 图片已经加载完成
  24266. if (image.nodeName.toUpperCase() == 'IMG') {
  24267. if (window.ActiveXObject) {
  24268. if (image.readyState != 'complete') {
  24269. return;
  24270. }
  24271. } else {
  24272. if (!image.complete) {
  24273. return;
  24274. }
  24275. }
  24276. }
  24277. // Else is canvas
  24278. var width = style.width || image.width;
  24279. var height = style.height || image.height;
  24280. var x = style.x + __OP[0];
  24281. var y = style.y + __OP[1];
  24282. // 图片加载失败
  24283. if (!image.width || !image.height) {
  24284. return;
  24285. }
  24286. ctx.save();
  24287. this.doClip(ctx);
  24288. this.setContext(ctx, style);
  24289. // 设置transform
  24290. this.setTransform(ctx);
  24291. if (style.sWidth && style.sHeight) {
  24292. let sx = (style.sx + __OP[0]) || 0;
  24293. let sy = (style.sy + __OP[1]) || 0;
  24294. ctx.drawImage(
  24295. image,
  24296. sx, sy, style.sWidth, style.sHeight,
  24297. x, y, width, height
  24298. );
  24299. } else if (style.sx && style.sy) {
  24300. let sx = style.sx + __OP[0];
  24301. let sy = style.sy + __OP[1];
  24302. var sWidth = width - sx;
  24303. var sHeight = height - sy;
  24304. ctx.drawImage(
  24305. image,
  24306. sx, sy, sWidth, sHeight,
  24307. x, y, width, height
  24308. );
  24309. } else {
  24310. ctx.drawImage(image, x, y, width, height);
  24311. }
  24312. // 如果没设置宽和高的话自动根据图片宽高设置
  24313. if (!style.width) {
  24314. style.width = width;
  24315. }
  24316. if (!style.height) {
  24317. style.height = height;
  24318. }
  24319. if (!this.style.width) {
  24320. this.style.width = width;
  24321. }
  24322. if (!this.style.height) {
  24323. this.style.height = height;
  24324. }
  24325. this.drawText(ctx, style, this.style);
  24326. ctx.restore();
  24327. }
  24328. }
  24329. /**
  24330. * @function LevelRenderer.Shape.SmicImage.prototype.getRect
  24331. * @description 计算返回图片的包围盒矩形。
  24332. *
  24333. * @param {Object} style - style
  24334. * @return {Object} 边框对象。包含属性:x,y,width,height。
  24335. */
  24336. getRect(style) {
  24337. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  24338. this.refOriginalPosition = [0, 0];
  24339. }
  24340. var __OP = this.refOriginalPosition;
  24341. return {
  24342. x: style.x + __OP[0],
  24343. y: style.y + __OP[1],
  24344. width: style.width,
  24345. height: style.height
  24346. };
  24347. }
  24348. /**
  24349. * @function LevelRenderer.Shape.SmicImage.prototype.clearCache
  24350. * @description 清除图片缓存。
  24351. *
  24352. * @param {Object} style - style
  24353. * @return {Object} 边框对象。包含属性:x,y,width,height。
  24354. *
  24355. */
  24356. clearCache() {
  24357. this._imageCache = {};
  24358. }
  24359. }
  24360. SmicImage._needsRefresh = [];
  24361. SmicImage._refreshTimeout = null;
  24362. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Painter.js
  24363. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24364. * This program are made available under the terms of the Apache License, Version 2.0
  24365. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24366. /**
  24367. * @private
  24368. * @class LevelRenderer.Painter
  24369. * @category Visualization Theme
  24370. * @classdesc Painter 绘图模块。
  24371. * @param {HTMLElement} root - 绘图区域(DIV)。
  24372. * @param {LevelRenderer.Storage} storage - Storage 实例。
  24373. */
  24374. class Painter {
  24375. constructor(root, storage) {
  24376. /**
  24377. * @member {HTMLElement} LevelRenderer.Painter.prototype.root
  24378. * @description 绘图容器。
  24379. *
  24380. */
  24381. this.root = root;
  24382. /**
  24383. * @member {Array} LevelRenderer.Painter.prototype.storage
  24384. * @description 图形仓库。
  24385. *
  24386. */
  24387. this.storage = storage;
  24388. /**
  24389. * @member {HTMLElement} LevelRenderer.Painter.prototype._domRoot
  24390. * @description 容器根 dom 对象。
  24391. *
  24392. */
  24393. this._domRoot = null;
  24394. /**
  24395. * @member {Object} LevelRenderer.Painter.prototype._layers
  24396. * @description 绘制层对象。
  24397. *
  24398. */
  24399. this._layers = {};
  24400. /**
  24401. * @member {Array} LevelRenderer.Painter.prototype._zlevelList
  24402. * @description 层列表。
  24403. *
  24404. */
  24405. this._zlevelList = [];
  24406. /**
  24407. * @member {Object} LevelRenderer.Painter.prototype._layerConfig
  24408. * @description 绘制层配置对象。
  24409. *
  24410. */
  24411. this._layerConfig = {};
  24412. /**
  24413. * @member {Object} LevelRenderer.Painter.prototype._bgDom
  24414. * @description 背景层 Canvas (Dom)。
  24415. *
  24416. */
  24417. this._bgDom = null;
  24418. /**
  24419. * @member {function} LevelRenderer.Painter.prototype.shapeToImage
  24420. * @description 形状转图像函数。
  24421. *
  24422. */
  24423. this.shapeToImage = null;
  24424. // retina 屏幕优化
  24425. Painter.devicePixelRatio = Math.max((window.devicePixelRatio || 1), 1);
  24426. this.CLASS_NAME = "SuperMap.LevelRenderer.Painter";
  24427. this.root.innerHTML = '';
  24428. this._width = this._getWidth(); // 宽,缓存记录
  24429. this._height = this._getHeight(); // 高,缓存记录
  24430. var domRoot = document.createElement('div');
  24431. this._domRoot = domRoot;
  24432. // domRoot.onselectstart = returnFalse; // 避免页面选中的尴尬
  24433. domRoot.style.position = 'relative';
  24434. domRoot.style.overflow = 'hidden';
  24435. domRoot.style.width = this._width + 'px';
  24436. domRoot.style.height = this._height + 'px';
  24437. this.root.appendChild(domRoot);
  24438. this.shapeToImage = this._createShapeToImageProcessor();
  24439. // 创建各层canvas
  24440. // 背景
  24441. //this._bgDom = Painter.createDom('bg', 'div', this);
  24442. this._bgDom = Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme_background_"), 'div', this);
  24443. domRoot.appendChild(this._bgDom);
  24444. this._bgDom.onselectstart = returnFalse;
  24445. this._bgDom.style['-webkit-user-select'] = 'none';
  24446. this._bgDom.style['user-select'] = 'none';
  24447. this._bgDom.style['-webkit-touch-callout'] = 'none';
  24448. // 高亮
  24449. //var hoverLayer = new PaintLayer('_hoverLayer_', this);
  24450. var hoverLayer = new PaintLayer(Util_Util.createUniqueID("_highLightLayer_"), this);
  24451. this._layers['hover'] = hoverLayer;
  24452. domRoot.appendChild(hoverLayer.dom);
  24453. hoverLayer.initContext();
  24454. hoverLayer.dom.onselectstart = returnFalse;
  24455. hoverLayer.dom.style['-webkit-user-select'] = 'none';
  24456. hoverLayer.dom.style['user-select'] = 'none';
  24457. hoverLayer.dom.style['-webkit-touch-callout'] = 'none';
  24458. var me = this;
  24459. this.updatePainter = function (shapeList, callback) {
  24460. me.refreshShapes(shapeList, callback);
  24461. };
  24462. // 返回false的方法,用于避免页面被选中
  24463. function returnFalse() {
  24464. return false;
  24465. }
  24466. /* eslint-disable */
  24467. // 什么都不干的空方法
  24468. function doNothing() { //NOSONAR
  24469. }
  24470. /* eslint-enable */
  24471. }
  24472. /**
  24473. * @function LevelRenderer.Painter.prototype.destroy
  24474. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  24475. */
  24476. destroy() {
  24477. this.dispose();
  24478. this._zlevelList = null;
  24479. this._layerConfig = null;
  24480. this._bgDom = null;
  24481. this.shapeToImage = null;
  24482. }
  24483. /**
  24484. * @function LevelRenderer.Painter.prototype.render
  24485. * @description 渲染。首次绘图,创建各种 dom 和 context。
  24486. *
  24487. * @param {function} callback - 绘画结束后的回调函数。
  24488. * @return {LevelRenderer.Painter} this。
  24489. */
  24490. render(callback) {
  24491. // TODO
  24492. this.refresh(callback, true);
  24493. return this;
  24494. }
  24495. /**
  24496. * @function LevelRenderer.Painter.prototype.refresh
  24497. * @description 刷新。
  24498. *
  24499. * @param {function} callback - 刷新结束后的回调函数。
  24500. * @param {boolean} paintAll - 强制绘制所有 shape。
  24501. * @return {LevelRenderer.Painter} this。
  24502. */
  24503. refresh(callback, paintAll) {
  24504. var list = this.storage.getShapeList(true);
  24505. this._paintList(list, paintAll);
  24506. if (typeof callback == 'function') {
  24507. callback();
  24508. }
  24509. return this;
  24510. }
  24511. /**
  24512. * Method: _paintList
  24513. * 按列表绘制图形。
  24514. */
  24515. _paintList(list, paintAll) {
  24516. if (typeof(paintAll) == 'undefined') {
  24517. paintAll = false;
  24518. }
  24519. this._updateLayerStatus(list);
  24520. var currentLayer;
  24521. var currentZLevel;
  24522. var ctx;
  24523. for (var id in this._layers) {
  24524. if (id !== 'hover') {
  24525. this._layers[id].unusedCount++;
  24526. this._layers[id].updateTransform();
  24527. }
  24528. }
  24529. var invTransform = [];
  24530. for (var i = 0, l = list.length; i < l; i++) {
  24531. var shape = list[i];
  24532. if (currentZLevel !== shape.zlevel) {
  24533. if (currentLayer && currentLayer.needTransform) {
  24534. ctx.restore();
  24535. }
  24536. currentLayer = this.getLayer(shape.zlevel);
  24537. ctx = currentLayer.ctx;
  24538. currentZLevel = shape.zlevel;
  24539. // Reset the count
  24540. currentLayer.unusedCount = 0;
  24541. if (currentLayer.dirty || paintAll) {
  24542. currentLayer.clear();
  24543. }
  24544. if (currentLayer.needTransform) {
  24545. ctx.save();
  24546. currentLayer.setTransform(ctx);
  24547. }
  24548. }
  24549. // Start group clipping
  24550. if (ctx && shape.__startClip) {
  24551. var clipShape = shape.__startClip;
  24552. ctx.save();
  24553. // Set transform
  24554. if (clipShape.needTransform) {
  24555. let m = clipShape.transform;
  24556. SUtil_SUtil.Util_matrix.invert(invTransform, m);
  24557. ctx.transform(
  24558. m[0], m[1],
  24559. m[2], m[3],
  24560. m[4], m[5]
  24561. );
  24562. }
  24563. ctx.beginPath();
  24564. clipShape.buildPath(ctx, clipShape.style);
  24565. ctx.clip();
  24566. // Transform back
  24567. if (clipShape.needTransform) {
  24568. let m = invTransform;
  24569. ctx.transform(
  24570. m[0], m[1],
  24571. m[2], m[3],
  24572. m[4], m[5]
  24573. );
  24574. }
  24575. }
  24576. if (((currentLayer && currentLayer.dirty) || paintAll) && !shape.invisible) {
  24577. if (
  24578. !shape.onbrush
  24579. || (shape.onbrush && !shape.onbrush(ctx, false))
  24580. ) {
  24581. if (Config.catchBrushException) {
  24582. try {
  24583. shape.brush(ctx, false, this.updatePainter);
  24584. } catch (error) {
  24585. SUtil_SUtil.Util_log(
  24586. error,
  24587. 'brush error of ' + shape.type,
  24588. shape
  24589. );
  24590. }
  24591. } else {
  24592. shape.brush(ctx, false, this.updatePainter);
  24593. }
  24594. }
  24595. }
  24596. // Stop group clipping
  24597. if (ctx && shape.__stopClip) {
  24598. ctx.restore();
  24599. }
  24600. shape.__dirty = false;
  24601. }
  24602. if (ctx && currentLayer && currentLayer.needTransform) {
  24603. ctx.restore();
  24604. }
  24605. for (let id in this._layers) {
  24606. if (id !== 'hover') {
  24607. var layer = this._layers[id];
  24608. layer.dirty = false;
  24609. // 删除过期的层
  24610. // PENDING
  24611. // if (layer.unusedCount >= 500) {
  24612. // this.delLayer(id);
  24613. // }
  24614. if (layer.unusedCount == 1) {
  24615. layer.clear();
  24616. }
  24617. }
  24618. }
  24619. }
  24620. /**
  24621. * @function LevelRenderer.Painter.prototype.getLayer
  24622. * @description 获取 zlevel 所在层,如果不存在则会创建一个新的层。
  24623. *
  24624. * @param {number} zlevel - zlevel。
  24625. * @return {LevelRenderer.Painter} this。
  24626. */
  24627. getLayer(zlevel) {
  24628. // Change draw layer
  24629. var currentLayer = this._layers[zlevel];
  24630. if (!currentLayer) {
  24631. var len = this._zlevelList.length;
  24632. var prevLayer = null;
  24633. var i = -1;
  24634. if (len > 0 && zlevel > this._zlevelList[0]) {
  24635. for (i = 0; i < len - 1; i++) {
  24636. if (
  24637. this._zlevelList[i] < zlevel
  24638. && this._zlevelList[i + 1] > zlevel
  24639. ) {
  24640. break;
  24641. }
  24642. }
  24643. prevLayer = this._layers[this._zlevelList[i]];
  24644. }
  24645. this._zlevelList.splice(i + 1, 0, zlevel);
  24646. // Create a new layer
  24647. //currentLayer = new PaintLayer(zlevel, this);
  24648. currentLayer = new PaintLayer(Util_Util.createUniqueID("_levelLayer_" + zlevel), this);
  24649. var prevDom = prevLayer ? prevLayer.dom : this._bgDom;
  24650. if (prevDom.nextSibling) {
  24651. prevDom.parentNode.insertBefore(
  24652. currentLayer.dom,
  24653. prevDom.nextSibling
  24654. );
  24655. } else {
  24656. prevDom.parentNode.appendChild(
  24657. currentLayer.dom
  24658. );
  24659. }
  24660. currentLayer.initContext();
  24661. this._layers[zlevel] = currentLayer;
  24662. if (this._layerConfig[zlevel]) {
  24663. new levelRenderer_Util_Util().merge(currentLayer, this._layerConfig[zlevel], true);
  24664. }
  24665. currentLayer.updateTransform();
  24666. }
  24667. return currentLayer;
  24668. }
  24669. /**
  24670. * @function LevelRenderer.Painter.prototype.getLayers
  24671. * @description 获取所有已创建的层。
  24672. * @return {Array.<Painter.Layer>} 已创建的层
  24673. */
  24674. getLayers() {
  24675. return this._layers;
  24676. }
  24677. /**
  24678. * Method: _updateLayerStatus
  24679. * 更新绘制层状态。
  24680. */
  24681. _updateLayerStatus(list) {
  24682. var layers = this._layers;
  24683. var elCounts = {};
  24684. for (let z in layers) {
  24685. if (z !== 'hover') {
  24686. elCounts[z] = layers[z].elCount;
  24687. layers[z].elCount = 0;
  24688. }
  24689. }
  24690. for (let i = 0; i < list.length; i++) {
  24691. var shape = list[i];
  24692. var zlevel = shape.zlevel;
  24693. var layer = layers[zlevel];
  24694. if (layer) {
  24695. layer.elCount++;
  24696. // 已经被标记为需要刷新
  24697. if (layer.dirty) {
  24698. continue;
  24699. }
  24700. layer.dirty = shape.__dirty;
  24701. }
  24702. }
  24703. // 层中的元素数量有发生变化
  24704. for (let z in layers) {
  24705. if (z !== 'hover') {
  24706. if (elCounts[z] !== layers[z].elCount) {
  24707. layers[z].dirty = true;
  24708. }
  24709. }
  24710. }
  24711. }
  24712. /**
  24713. * @function LevelRenderer.Painter.prototype.refreshShapes
  24714. * @description 更新的图形元素列表。
  24715. *
  24716. * @param {number} shapeList - 需要更新的图形元素列表。
  24717. * @param {number} callback - 视图更新后回调函数。
  24718. * @return {LevelRenderer.Painter} this。
  24719. */
  24720. refreshShapes(shapeList, callback) {
  24721. for (var i = 0, l = shapeList.length; i < l; i++) {
  24722. var shape = shapeList[i];
  24723. this.storage.mod(shape.id);
  24724. }
  24725. this.refresh(callback);
  24726. return this;
  24727. }
  24728. /**
  24729. * @function LevelRenderer.Painter.prototype.clear
  24730. * @description 清除 hover 层外所有内容。
  24731. * @return {LevelRenderer.Painter} this。
  24732. */
  24733. clear() {
  24734. for (var k in this._layers) {
  24735. if (k == 'hover') {
  24736. continue;
  24737. }
  24738. this._layers[k].clear();
  24739. }
  24740. return this;
  24741. }
  24742. /**
  24743. * @function LevelRenderer.Painter.prototype.modLayer
  24744. * @description 修改指定 zlevel 的绘制参数。
  24745. *
  24746. * @param {string} zlevel - zlevel。
  24747. * @param {Object} config - 配置对象。
  24748. * @param {string} [config.clearColor=0] - 每次清空画布的颜色。
  24749. * @param {boolean} [config.motionBlur=false] - 是否开启动态模糊。
  24750. * @param {number} [config.lastFrameAlpha=0.7] - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
  24751. * @param {Array.<number>} config.position - 层的平移。
  24752. * @param {Array.<number>} config.rotation - 层的旋转。
  24753. * @param {Array.<number>} config.scale - 层的缩放。
  24754. * @param {boolean} config.zoomable - 层是否支持鼠标缩放操作。默认值:false。
  24755. * @param {boolean} config.panable - 层是否支持鼠标平移操作。默认值:false。
  24756. *
  24757. */
  24758. modLayer(zlevel, config) {
  24759. if (config) {
  24760. if (!this._layerConfig[zlevel]) {
  24761. this._layerConfig[zlevel] = config;
  24762. } else {
  24763. new levelRenderer_Util_Util().merge(this._layerConfig[zlevel], config, true);
  24764. }
  24765. var layer = this._layers[zlevel];
  24766. if (layer) {
  24767. new levelRenderer_Util_Util().merge(layer, this._layerConfig[zlevel], true);
  24768. }
  24769. }
  24770. }
  24771. /**
  24772. * @function LevelRenderer.Painter.prototype.delLayer
  24773. * @description 删除指定层。
  24774. *
  24775. * @param {string} zlevel - 层所在的 zlevel。
  24776. */
  24777. delLayer(zlevel) {
  24778. var layer = this._layers[zlevel];
  24779. if (!layer) {
  24780. return;
  24781. }
  24782. // Save config
  24783. this.modLayer(zlevel, {
  24784. position: layer.position,
  24785. rotation: layer.rotation,
  24786. scale: layer.scale
  24787. });
  24788. layer.dom.parentNode.removeChild(layer.dom);
  24789. delete this._layers[zlevel];
  24790. this._zlevelList.splice(new levelRenderer_Util_Util().indexOf(this._zlevelList, zlevel), 1);
  24791. }
  24792. /**
  24793. * @function LevelRenderer.Painter.prototype.refreshHover
  24794. * @description 刷新 hover 层。
  24795. * @return {LevelRenderer.Painter} this。
  24796. */
  24797. refreshHover() {
  24798. this.clearHover();
  24799. var list = this.storage.getHoverShapes(true);
  24800. for (var i = 0, l = list.length; i < l; i++) {
  24801. this._brushHover(list[i]);
  24802. }
  24803. this.storage.delHover();
  24804. return this;
  24805. }
  24806. /**
  24807. * @function LevelRenderer.Painter.prototype.clearHover
  24808. * @description 清除 hover 层所有内容。
  24809. * @return {LevelRenderer.Painter} this。
  24810. */
  24811. clearHover() {
  24812. var hover = this._layers.hover;
  24813. hover && hover.clear();
  24814. return this;
  24815. }
  24816. /**
  24817. * @function LevelRenderer.Painter.prototype.resize
  24818. * @description 区域大小变化后重绘。
  24819. * @return {LevelRenderer.Painter} this。
  24820. */
  24821. resize() {
  24822. var domRoot = this._domRoot;
  24823. domRoot.style.display = 'none';
  24824. var width = this._getWidth();
  24825. var height = this._getHeight();
  24826. domRoot.style.display = '';
  24827. // 优化没有实际改变的resize
  24828. if (this._width != width || height != this._height) {
  24829. this._width = width;
  24830. this._height = height;
  24831. domRoot.style.width = width + 'px';
  24832. domRoot.style.height = height + 'px';
  24833. for (var id in this._layers) {
  24834. this._layers[id].resize(width, height);
  24835. }
  24836. this.refresh(null, true);
  24837. }
  24838. return this;
  24839. }
  24840. /**
  24841. * @function LevelRenderer.Painter.prototype.clearLayer
  24842. * @description 清除指定的一个层。
  24843. * @param {number} zLevel - 层。
  24844. */
  24845. clearLayer(zLevel) {
  24846. var layer = this._layers[zLevel];
  24847. if (layer) {
  24848. layer.clear();
  24849. }
  24850. }
  24851. /**
  24852. * @function LevelRenderer.Painter.prototype.dispose
  24853. * @description 释放。
  24854. *
  24855. */
  24856. dispose() {
  24857. this.root.innerHTML = '';
  24858. this.root = null;
  24859. this.storage = null;
  24860. this._domRoot = null;
  24861. this._layers = null;
  24862. }
  24863. /**
  24864. * @function LevelRenderer.Painter.prototype.getDomHover
  24865. * @description 获取 Hover 层的 Dom。
  24866. */
  24867. getDomHover() {
  24868. return this._layers.hover.dom;
  24869. }
  24870. /**
  24871. * @function LevelRenderer.Painter.prototype.toDataURL
  24872. * @description 图像导出。
  24873. * @param {string} type - 图片类型。
  24874. * @param {string} backgroundColor - 背景色。默认值:'#fff'。
  24875. * @param {Object} args
  24876. * @return {string} 图片的Base64 url。
  24877. */
  24878. toDataURL(type, backgroundColor, args) {
  24879. //var imageDom = Painter.createDom('image', 'canvas', this);
  24880. var imageDom = Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme.image_"), 'canvas', this);
  24881. this._bgDom.appendChild(imageDom);
  24882. var ctx = imageDom.getContext('2d');
  24883. Painter.devicePixelRatio != 1
  24884. && ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  24885. ctx.fillStyle = backgroundColor || '#fff';
  24886. ctx.rect(
  24887. 0, 0,
  24888. this._width * Painter.devicePixelRatio,
  24889. this._height * Painter.devicePixelRatio
  24890. );
  24891. ctx.fill();
  24892. var self = this;
  24893. // 升序遍历,shape上的zlevel指定绘画图层的z轴层叠
  24894. this.storage.iterShape(
  24895. function (shape) {
  24896. if (!shape.invisible) {
  24897. if (!shape.onbrush // 没有onbrush
  24898. // 有onbrush并且调用执行返回false或undefined则继续粉刷
  24899. || (shape.onbrush && !shape.onbrush(ctx, false))
  24900. ) {
  24901. if (Config.catchBrushException) {
  24902. try {
  24903. shape.brush(ctx, false, self.updatePainter);
  24904. } catch (error) {
  24905. SUtil_SUtil.Util_log(
  24906. error,
  24907. 'brush error of ' + shape.type,
  24908. shape
  24909. );
  24910. }
  24911. } else {
  24912. shape.brush(ctx, false, self.updatePainter);
  24913. }
  24914. }
  24915. }
  24916. },
  24917. {normal: 'up', update: true}
  24918. );
  24919. var image = imageDom.toDataURL(type, args);
  24920. ctx = null;
  24921. this._bgDom.removeChild(imageDom);
  24922. return image;
  24923. }
  24924. /**
  24925. * @function LevelRenderer.Painter.prototype.getWidth
  24926. * @description 获取绘图区域宽度。
  24927. * @return {number} 绘图区域宽度。
  24928. */
  24929. getWidth() {
  24930. return this._width;
  24931. }
  24932. /**
  24933. * @function LevelRenderer.Painter.prototype.getHeight
  24934. * @description 获取绘图区域高度。
  24935. * @return {number} 绘图区域高度。
  24936. */
  24937. getHeight() {
  24938. return this._height;
  24939. }
  24940. /**
  24941. * Method: _getWidth
  24942. *
  24943. */
  24944. _getWidth() {
  24945. var root = this.root;
  24946. var stl = root.currentStyle
  24947. || document.defaultView.getComputedStyle(root);
  24948. return ((root.clientWidth || parseInt(stl.width, 10))
  24949. - parseInt(stl.paddingLeft, 10) // 请原谅我这比较粗暴
  24950. - parseInt(stl.paddingRight, 10)).toFixed(0) - 0;
  24951. }
  24952. /**
  24953. * Method: _getHeight
  24954. *
  24955. */
  24956. _getHeight() {
  24957. var root = this.root;
  24958. var stl = root.currentStyle
  24959. || document.defaultView.getComputedStyle(root);
  24960. return ((root.clientHeight || parseInt(stl.height, 10))
  24961. - parseInt(stl.paddingTop, 10) // 请原谅我这比较粗暴
  24962. - parseInt(stl.paddingBottom, 10)).toFixed(0) - 0;
  24963. }
  24964. /**
  24965. * Method: _brushHover
  24966. *
  24967. */
  24968. _brushHover(shape) {
  24969. var ctx = this._layers.hover.ctx;
  24970. if (!shape.onbrush // 没有onbrush
  24971. // 有onbrush并且调用执行返回false或undefined则继续粉刷
  24972. || (shape.onbrush && !shape.onbrush(ctx, true))
  24973. ) {
  24974. var layer = this.getLayer(shape.zlevel);
  24975. if (layer.needTransform) {
  24976. ctx.save();
  24977. layer.setTransform(ctx);
  24978. }
  24979. // Retina 优化
  24980. if (Config.catchBrushException) {
  24981. try {
  24982. shape.brush(ctx, true, this.updatePainter);
  24983. } catch (error) {
  24984. SUtil_SUtil.Util_log(
  24985. error, 'hoverBrush error of ' + shape.type, shape
  24986. );
  24987. }
  24988. } else {
  24989. shape.brush(ctx, true, this.updatePainter);
  24990. }
  24991. if (layer.needTransform) {
  24992. ctx.restore();
  24993. }
  24994. }
  24995. }
  24996. /**
  24997. * Method: _shapeToImage
  24998. *
  24999. */
  25000. _shapeToImage(id, shape, width, height, devicePixelRatio) {
  25001. var canvas = document.createElement('canvas');
  25002. var ctx = canvas.getContext('2d');
  25003. var _devicePixelRatio = devicePixelRatio || window.devicePixelRatio || 1;
  25004. canvas.style.width = width + 'px';
  25005. canvas.style.height = height + 'px';
  25006. canvas.setAttribute('width', width * _devicePixelRatio);
  25007. canvas.setAttribute('height', height * _devicePixelRatio);
  25008. ctx.clearRect(0, 0, width * _devicePixelRatio, height * _devicePixelRatio);
  25009. var shapeTransform = {
  25010. position: shape.position,
  25011. rotation: shape.rotation,
  25012. scale: shape.scale
  25013. };
  25014. shape.position = [0, 0, 0];
  25015. shape.rotation = 0;
  25016. shape.scale = [1, 1];
  25017. if (shape) {
  25018. shape.brush(ctx, false);
  25019. }
  25020. var imgShape = new SmicImage({
  25021. id: id,
  25022. style: {
  25023. x: 0,
  25024. y: 0,
  25025. image: canvas
  25026. }
  25027. });
  25028. if (shapeTransform.position != null) {
  25029. imgShape.position = shape.position = shapeTransform.position;
  25030. }
  25031. if (shapeTransform.rotation != null) {
  25032. imgShape.rotation = shape.rotation = shapeTransform.rotation;
  25033. }
  25034. if (shapeTransform.scale != null) {
  25035. imgShape.scale = shape.scale = shapeTransform.scale;
  25036. }
  25037. return imgShape;
  25038. }
  25039. /**
  25040. * Method: _createShapeToImageProcessor
  25041. *
  25042. */
  25043. _createShapeToImageProcessor() {
  25044. var me = this;
  25045. return function (id, e, width, height) {
  25046. return me._shapeToImage(
  25047. id, e, width, height, Painter.devicePixelRatio
  25048. );
  25049. };
  25050. }
  25051. // SMIC-方法扩展 - start
  25052. /**
  25053. * @function LevelRenderer.Painter.prototype.updateHoverLayer
  25054. * @description 更新设置显示高亮图层。
  25055. * @param {Array} shapes - 图形数组。
  25056. */
  25057. updateHoverLayer(shapes) {
  25058. if (!(shapes instanceof Array)) {
  25059. return this;
  25060. }
  25061. //清除高亮
  25062. this.clearHover();
  25063. this.storage.delHover();
  25064. for (var i = 0; i < shapes.length; i++) {
  25065. this.storage.addHover(shapes[i]);
  25066. this._brushHover(shapes[i]);
  25067. }
  25068. }
  25069. /**
  25070. * @function LevelRenderer.Painter.prototype.createDom
  25071. * @description 创建 Dom。
  25072. *
  25073. * @param {string} id - Dom id
  25074. * @param {string} type - Dom type
  25075. * @param {LevelRenderer.Painter} painter - Painter 实例。
  25076. * @return {Object} Dom
  25077. */
  25078. static createDom(id, type, painter) {
  25079. var newDom = document.createElement(type);
  25080. var width = painter._width;
  25081. var height = painter._height;
  25082. // 没append呢,请原谅我这样写,清晰~
  25083. newDom.style.position = 'absolute';
  25084. newDom.style.left = 0;
  25085. newDom.style.top = 0;
  25086. newDom.style.width = width + 'px';
  25087. newDom.style.height = height + 'px';
  25088. newDom.setAttribute('width', width * Painter.devicePixelRatio);
  25089. newDom.setAttribute('height', height * Painter.devicePixelRatio);
  25090. // id不作为索引用,避免可能造成的重名,定义为私有属性
  25091. //newDom.setAttribute('data-zr-dom-id', id);
  25092. newDom.setAttribute('id', id);
  25093. return newDom;
  25094. }
  25095. }
  25096. /**
  25097. * @private
  25098. * @class Painter.Layer
  25099. * @classdesc 绘制层类。
  25100. * @extends LevelRenderer.Transformable
  25101. */
  25102. class PaintLayer extends Transformable {
  25103. /**
  25104. * @function Painter.Layer.constructor
  25105. * @description 构造函数。
  25106. *
  25107. * @param {string} id - id。
  25108. * @param {LevelRenderer.Painter} painter - Painter 实例。
  25109. *
  25110. */
  25111. constructor(id, painter) {
  25112. super(id, painter);
  25113. /**
  25114. * @member {Object} Painter.Layer.prototype.dom
  25115. * @description dom。
  25116. */
  25117. this.dom = null;
  25118. /**
  25119. * @member {Object} Painter.Layer.prototype.domBack
  25120. * @description domBack。
  25121. */
  25122. this.domBack = null;
  25123. /**
  25124. * @member {Object} Painter.Layer.prototype.ctxBack
  25125. * @description ctxBack。
  25126. */
  25127. this.ctxBack = null;
  25128. /**
  25129. * @member {LevelRenderer.Painter} Painter.Layer.prototype.painter
  25130. * @description painter。
  25131. */
  25132. this.painter = painter;
  25133. /**
  25134. * @member {number} Painter.Layer.prototype.unusedCount
  25135. * @description unusedCount。
  25136. */
  25137. this.unusedCount = 0;
  25138. /**
  25139. * @member {Object} Painter.Layer.prototype.config
  25140. * @description config。
  25141. */
  25142. this.config = null;
  25143. /**
  25144. * @member {boolean} Painter.Layer.prototype.dirty
  25145. * @description dirty。
  25146. */
  25147. this.dirty = true;
  25148. /**
  25149. * @member {number} Painter.Layer.prototype.elCount
  25150. * @description elCount。
  25151. */
  25152. this.elCount = 0;
  25153. // Configs
  25154. /**
  25155. * @member {string} Painter.Layer.prototype.clearColor
  25156. * @description 每次清空画布的颜色。默认值:0;
  25157. */
  25158. this.clearColor = 0;
  25159. /**
  25160. * @member {boolean} Painter.Layer.prototype.motionBlur
  25161. * @description 是否开启动态模糊。默认值:false;
  25162. */
  25163. this.motionBlur = false;
  25164. /**
  25165. * @member {number} Painter.Layer.prototype.lastFrameAlpha
  25166. * @description 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显
  25167. */
  25168. this.lastFrameAlpha = 0.7;
  25169. /**
  25170. * @member {boolean} Painter.Layer.prototype.zoomable
  25171. * @description 层是否支持鼠标平移操作。默认值:false;
  25172. */
  25173. this.zoomable = false;
  25174. /**
  25175. * @member {boolean} Painter.Layer.prototype.panable
  25176. * @description 层是否支持鼠标缩放操作。默认值:false;
  25177. */
  25178. this.panable = false;
  25179. /**
  25180. * @member {number} Painter.Layer.prototype.maxZoom
  25181. * @description maxZoom。默认值:Infinity。
  25182. */
  25183. this.maxZoom = Infinity;
  25184. /**
  25185. * @member {number} Painter.Layer.prototype.minZoom
  25186. * @description minZoom。默认值:0。
  25187. */
  25188. this.minZoom = 0;
  25189. /**
  25190. * @member {number} Painter.Layer.prototype.ctx
  25191. * @description Canvas 上下文。
  25192. */
  25193. this.ctx = null;
  25194. this.dom = Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme" + id), 'canvas', painter);
  25195. this.dom.onselectstart = returnFalse; // 避免页面选中的尴尬
  25196. this.dom.style['-webkit-user-select'] = 'none';
  25197. this.dom.style['user-select'] = 'none';
  25198. this.dom.style['-webkit-touch-callout'] = 'none';
  25199. // Function
  25200. // 返回false的方法,用于避免页面被选中
  25201. function returnFalse() {
  25202. return false;
  25203. }
  25204. this.CLASS_NAME = "SuperMap.LevelRenderer.Painter.Layer";
  25205. }
  25206. /**
  25207. * @function Painter.Layer.prototype.destroy
  25208. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  25209. */
  25210. destroy() {
  25211. this.dom = null;
  25212. this.domBack = null;
  25213. this.ctxBack = null;
  25214. this.painter = null;
  25215. this.unusedCount = null;
  25216. this.config = null;
  25217. this.dirty = null;
  25218. this.elCount = null;
  25219. this.clearColor = null;
  25220. this.motionBlur = null;
  25221. this.lastFrameAlpha = null;
  25222. this.zoomable = null;
  25223. this.panable = null;
  25224. this.maxZoom = null;
  25225. this.minZoom = null;
  25226. this.ctx = null;
  25227. Transformable.destroy.apply(this, arguments);
  25228. }
  25229. /**
  25230. * @function Painter.Layer.prototype.initContext
  25231. * @description 初始化 Canvan 2D 上下文。
  25232. */
  25233. initContext() {
  25234. this.ctx = this.dom.getContext('2d');
  25235. if (Painter.devicePixelRatio != 1) {
  25236. this.ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  25237. }
  25238. }
  25239. /**
  25240. * @function Painter.Layer.prototype.createBackBuffer
  25241. * @description 创建备份缓冲。
  25242. */
  25243. createBackBuffer() {
  25244. this.domBack = Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme.back-" + this.id), 'canvas', this.painter);
  25245. this.ctxBack = this.domBack.getContext('2d');
  25246. if (Painter.devicePixelRatio != 1) {
  25247. this.ctxBack.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  25248. }
  25249. }
  25250. /**
  25251. * @function Painter.Layer.prototype.resize
  25252. * @description 改变大小。
  25253. *
  25254. * @param {number} width - 宽。
  25255. * @param {number} height - 高。
  25256. */
  25257. resize(width, height) {
  25258. this.dom.style.width = width + 'px';
  25259. this.dom.style.height = height + 'px';
  25260. this.dom.setAttribute('width', width * Painter.devicePixelRatio);
  25261. this.dom.setAttribute('height', height * Painter.devicePixelRatio);
  25262. if (Painter.devicePixelRatio != 1) {
  25263. this.ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  25264. }
  25265. if (this.domBack) {
  25266. this.domBack.setAttribute('width', width * Painter.devicePixelRatio);
  25267. this.domBack.setAttribute('height', height * Painter.devicePixelRatio);
  25268. if (Painter.devicePixelRatio != 1) {
  25269. this.ctxBack.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  25270. }
  25271. }
  25272. }
  25273. /**
  25274. * @function Painter.Layer.prototype.clear
  25275. * @description 清空该层画布。
  25276. */
  25277. clear() {
  25278. var dom = this.dom;
  25279. var ctx = this.ctx;
  25280. var width = dom.width;
  25281. var height = dom.height;
  25282. var haveClearColor = this.clearColor;
  25283. var haveMotionBLur = this.motionBlur;
  25284. var lastFrameAlpha = this.lastFrameAlpha;
  25285. if (haveMotionBLur) {
  25286. if (!this.domBack) {
  25287. this.createBackBuffer();
  25288. }
  25289. this.ctxBack.globalCompositeOperation = 'copy';
  25290. this.ctxBack.drawImage(
  25291. dom, 0, 0,
  25292. width / Painter.devicePixelRatio,
  25293. height / Painter.devicePixelRatio
  25294. );
  25295. }
  25296. if (haveClearColor) {
  25297. ctx.save();
  25298. ctx.fillStyle = this.config.clearColor;
  25299. ctx.fillRect(
  25300. 0, 0,
  25301. width / Painter.devicePixelRatio,
  25302. height / Painter.devicePixelRatio
  25303. );
  25304. ctx.restore();
  25305. } else {
  25306. ctx.clearRect(
  25307. 0, 0,
  25308. width / Painter.devicePixelRatio,
  25309. height / Painter.devicePixelRatio
  25310. );
  25311. }
  25312. if (haveMotionBLur) {
  25313. var domBack = this.domBack;
  25314. ctx.save();
  25315. ctx.globalAlpha = lastFrameAlpha;
  25316. ctx.drawImage(
  25317. domBack, 0, 0,
  25318. width / Painter.devicePixelRatio,
  25319. height / Painter.devicePixelRatio
  25320. );
  25321. ctx.restore();
  25322. }
  25323. }
  25324. }
  25325. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Handler.js
  25326. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  25327. * This program are made available under the terms of the Apache License, Version 2.0
  25328. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25329. /**
  25330. * @private
  25331. * @class LevelRenderer.Handler
  25332. * @category Visualization Theme
  25333. * @classdesc Handler控制模块。
  25334. * @extends {LevelRenderer.Eventful}
  25335. * @param {HTMLElement} root - 绘图区域。
  25336. * @param {LevelRenderer.Storage} storage - Storage 实例。
  25337. * @param {LevelRenderer.Painter} painter - Painter 实例。
  25338. */
  25339. class Handler extends Eventful {
  25340. constructor(root, storage, painter) {
  25341. super(root, storage, painter);
  25342. /**
  25343. * @member {HTMLElement} LevelRenderer.Handler.prototype.root
  25344. * @description 绘图区域
  25345. */
  25346. this.root = root;
  25347. /**
  25348. * @member {LevelRenderer.Storage} LevelRenderer.Handler.prototype.storage
  25349. * @description Storage 实例
  25350. */
  25351. this.storage = storage;
  25352. /**
  25353. * @member {LevelRenderer.Painter} LevelRenderer.Handler.prototype.Painter
  25354. * @description Painter 实例
  25355. */
  25356. this.painter = painter;
  25357. /**
  25358. * @member {number} [LevelRenderer.Handler.prototype._lastX=0]
  25359. * @description 上一次鼠标位置x坐标值
  25360. */
  25361. this._lastX = 0;
  25362. /**
  25363. * @member {number} [LevelRenderer.Handler.prototype._lastY=0]
  25364. * @description 上一次鼠标位置y坐标值
  25365. */
  25366. this._lastY = 0;
  25367. /**
  25368. * @member {number} [LevelRenderer.Handler.prototype._mouseX=0]
  25369. * @description 当前鼠标位置x坐标值
  25370. */
  25371. this._mouseX = 0;
  25372. /**
  25373. * @member {number} [LevelRenderer.Handler.prototype._mouseY=0]
  25374. * @description 当前鼠标位置y坐标值
  25375. */
  25376. this._mouseY = 0;
  25377. /**
  25378. * @member {function} LevelRenderer.Handler.prototype._findHover
  25379. * @description 查找 Hover 图形
  25380. */
  25381. this._findHover = null;
  25382. /**
  25383. * @member {Object} LevelRenderer.Handler.prototype._domHover
  25384. * @description 高亮 DOM
  25385. */
  25386. this._domHover = null;
  25387. // 各种事件标识的私有变量
  25388. // this._hasfound = false; // 是否找到 hover 图形元素
  25389. // this._lastHover = null; // 最后一个 hover 图形元素
  25390. // this._mouseDownTarget = null;
  25391. // this._draggingTarget = null; // 当前被拖拽的图形元素
  25392. // this._isMouseDown = false;
  25393. // this._isDragging = false;
  25394. // this._lastMouseDownMoment;
  25395. // this._lastTouchMoment;
  25396. // this._lastDownButton;
  25397. this._findHover = bind3Arg(findHover, this);
  25398. this._domHover = painter.getDomHover();
  25399. this.CLASS_NAME = "SuperMap.LevelRenderer.Handler";
  25400. var domHandlers = {
  25401. /**
  25402. * Method: resize
  25403. * 窗口大小改变响应函数。
  25404. *
  25405. * Parameters:
  25406. * event - {Event} event。
  25407. *
  25408. */
  25409. resize: function (event) {
  25410. event = event || window.event;
  25411. this._lastHover = null;
  25412. this._isMouseDown = 0;
  25413. // 分发SuperMap.LevelRenderer.Config.EVENT.RESIZE事件,global
  25414. this.dispatch(Config.EVENT.RESIZE, event);
  25415. },
  25416. /**
  25417. * Method: click
  25418. * 点击响应函数。
  25419. *
  25420. * Parameters:
  25421. * event - {Event} event。
  25422. *
  25423. */
  25424. click: function (event) {
  25425. event = this._zrenderEventFixed(event);
  25426. // 分发SuperMap.LevelRenderer.Config.EVENT.CLICK事件
  25427. var _lastHover = this._lastHover;
  25428. if ((_lastHover && _lastHover.clickable)
  25429. || !_lastHover
  25430. ) {
  25431. // 判断没有发生拖拽才触发click事件
  25432. if (this._clickThreshold < 10) {
  25433. this._dispatchAgency(_lastHover, Config.EVENT.CLICK, event);
  25434. }
  25435. }
  25436. this._mousemoveHandler(event);
  25437. },
  25438. /**
  25439. * Method: dblclick
  25440. * 双击响应函数。
  25441. *
  25442. * Parameters:
  25443. * event - {Event} event。
  25444. *
  25445. */
  25446. dblclick: function (event) {
  25447. event = event || window.event;
  25448. event = this._zrenderEventFixed(event);
  25449. // 分发SuperMap.LevelRenderer.Config.EVENT.DBLCLICK事件
  25450. var _lastHover = this._lastHover;
  25451. if ((_lastHover && _lastHover.clickable)
  25452. || !_lastHover
  25453. ) {
  25454. // 判断没有发生拖拽才触发dblclick事件
  25455. if (this._clickThreshold < 5) {
  25456. this._dispatchAgency(_lastHover, Config.EVENT.DBLCLICK, event);
  25457. }
  25458. }
  25459. this._mousemoveHandler(event);
  25460. },
  25461. /**
  25462. * Method: mousewheel
  25463. * 鼠标滚轮响应函数。
  25464. *
  25465. * Parameters:
  25466. * event - {Event} event。
  25467. *
  25468. */
  25469. mousewheel: function (event) {
  25470. event = this._zrenderEventFixed(event);
  25471. // http://www.sitepoint.com/html5-javascript-mouse-wheel/
  25472. // https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/mousewheel
  25473. var delta = event.wheelDelta // Webkit
  25474. || -event.detail; // Firefox
  25475. var scale = delta > 0 ? 1.1 : 1 / 1.1;
  25476. var layers = this.painter.getLayers();
  25477. var needsRefresh = false;
  25478. for (var z in layers) {
  25479. if (z !== 'hover') {
  25480. var layer = layers[z];
  25481. var pos = layer.position;
  25482. if (layer.zoomable) {
  25483. layer.__zoom = layer.__zoom || 1;
  25484. var newZoom = layer.__zoom;
  25485. newZoom *= scale;
  25486. newZoom = Math.max(
  25487. Math.min(layer.maxZoom, newZoom),
  25488. layer.minZoom
  25489. );
  25490. scale = newZoom / layer.__zoom;
  25491. layer.__zoom = newZoom;
  25492. // Keep the mouse center when scaling
  25493. pos[0] -= (this._mouseX - pos[0]) * (scale - 1);
  25494. pos[1] -= (this._mouseY - pos[1]) * (scale - 1);
  25495. layer.scale[0] *= scale;
  25496. layer.scale[1] *= scale;
  25497. layer.dirty = true;
  25498. needsRefresh = true;
  25499. }
  25500. }
  25501. }
  25502. if (needsRefresh) {
  25503. this.painter.refresh();
  25504. }
  25505. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEWHEEL事件
  25506. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEWHEEL, event);
  25507. this._mousemoveHandler(event);
  25508. },
  25509. /**
  25510. * Method: mousemove
  25511. * 鼠标(手指)移动响应函数。
  25512. *
  25513. * Parameters:
  25514. * event - {Event} event。
  25515. *
  25516. */
  25517. mousemove: function (event) {
  25518. // 拖拽不触发click事件
  25519. this._clickThreshold++;
  25520. event = this._zrenderEventFixed(event);
  25521. this._lastX = this._mouseX;
  25522. this._lastY = this._mouseY;
  25523. this._mouseX = SUtil_SUtil.Util_event.getX(event);
  25524. this._mouseY = SUtil_SUtil.Util_event.getY(event);
  25525. var dx = this._mouseX - this._lastX;
  25526. var dy = this._mouseY - this._lastY;
  25527. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGSTART事件
  25528. // 避免手抖点击误认为拖拽
  25529. // if (this._mouseX - this._lastX > 1 || this._mouseY - this._lastY > 1) {
  25530. this._processDragStart(event);
  25531. // }
  25532. this._hasfound = 0;
  25533. this._event = event;
  25534. this._iterateAndFindHover();
  25535. // 找到的在迭代函数里做了处理,没找到得在迭代完后处理
  25536. if (!this._hasfound) {
  25537. // 过滤首次拖拽产生的mouseout和dragLeave
  25538. if (!this._draggingTarget
  25539. || (this._lastHover && this._lastHover != this._draggingTarget)
  25540. ) {
  25541. // 可能出现SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
  25542. this._processOutShape(event);
  25543. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  25544. this._processDragLeave(event);
  25545. }
  25546. this._lastHover = null;
  25547. this.storage.delHover();
  25548. this.painter.clearHover();
  25549. }
  25550. // set cursor for root element
  25551. var cursor = '';
  25552. // 如果存在拖拽中元素,被拖拽的图形元素最后addHover
  25553. if (this._draggingTarget) {
  25554. this.storage.drift(this._draggingTarget.id, dx, dy);
  25555. this._draggingTarget.modSelf();
  25556. this.storage.addHover(this._draggingTarget);
  25557. } else if (this._isMouseDown) {
  25558. // Layer dragging
  25559. var layers = this.painter.getLayers();
  25560. var needsRefresh = false;
  25561. for (var z in layers) {
  25562. if (z !== 'hover') {
  25563. var layer = layers[z];
  25564. if (layer.panable) {
  25565. // PENDING
  25566. cursor = 'move';
  25567. // Keep the mouse center when scaling
  25568. layer.position[0] += dx;
  25569. layer.position[1] += dy;
  25570. needsRefresh = true;
  25571. layer.dirty = true;
  25572. }
  25573. }
  25574. }
  25575. if (needsRefresh) {
  25576. this.painter.refresh();
  25577. }
  25578. }
  25579. if (this._draggingTarget || (this._hasfound && this._lastHover.draggable)) {
  25580. cursor = 'move';
  25581. } else if (this._hasfound && this._lastHover.clickable) {
  25582. cursor = 'pointer';
  25583. }
  25584. this.root.style.cursor = cursor;
  25585. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEMOVE事件
  25586. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEMOVE, event);
  25587. if (this._draggingTarget || this._hasfound || this.storage.hasHoverShape()) {
  25588. this.painter.refreshHover();
  25589. }
  25590. },
  25591. /**
  25592. * Method: mouseout
  25593. * 鼠标(手指)离开响应函数。
  25594. *
  25595. * Parameters:
  25596. * event - {Event} event。
  25597. *
  25598. */
  25599. mouseout: function (event) {
  25600. event = this._zrenderEventFixed(event);
  25601. var element = event.toElement || event.relatedTarget;
  25602. if (element != this.root) {
  25603. while (element && element.nodeType != 9) {
  25604. // 忽略包含在root中的dom引起的mouseOut
  25605. if (element == this.root) {
  25606. this._mousemoveHandler(event);
  25607. return;
  25608. }
  25609. element = element.parentNode;
  25610. }
  25611. }
  25612. event.zrenderX = this._lastX;
  25613. event.zrenderY = this._lastY;
  25614. this.root.style.cursor = '';
  25615. this._isMouseDown = 0;
  25616. this._processOutShape(event);
  25617. this._processDrop(event);
  25618. this._processDragEnd(event);
  25619. this.painter.refreshHover();
  25620. this.dispatch(Config.EVENT.GLOBALOUT, event);
  25621. },
  25622. /**
  25623. * Method: mousedown
  25624. * 鼠标(手指)按下响应函数。
  25625. *
  25626. * Parameters:
  25627. * event - {Event} event。
  25628. *
  25629. */
  25630. mousedown: function (event) {
  25631. // 重置 clickThreshold
  25632. this._clickThreshold = 0;
  25633. if (this._lastDownButton == 2) {
  25634. this._lastDownButton = event.button;
  25635. this._mouseDownTarget = null;
  25636. // 仅作为关闭右键菜单使用
  25637. return;
  25638. }
  25639. this._lastMouseDownMoment = new Date();
  25640. event = this._zrenderEventFixed(event);
  25641. this._isMouseDown = 1;
  25642. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEDOWN事件
  25643. this._mouseDownTarget = this._lastHover;
  25644. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEDOWN, event);
  25645. this._lastDownButton = event.button;
  25646. },
  25647. /**
  25648. * Method: mouseup
  25649. * 鼠标(手指)抬起响应函数。
  25650. *
  25651. * Parameters:
  25652. * event - {Event} event。
  25653. *
  25654. */
  25655. mouseup: function (event) {
  25656. event = this._zrenderEventFixed(event);
  25657. this.root.style.cursor = '';
  25658. this._isMouseDown = 0;
  25659. this._mouseDownTarget = null;
  25660. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEUP事件
  25661. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEUP, event);
  25662. this._processDrop(event);
  25663. this._processDragEnd(event);
  25664. },
  25665. /**
  25666. * Method: touchstart
  25667. * Touch 开始响应函数。
  25668. *
  25669. * Parameters:
  25670. * event - {Event} event。
  25671. *
  25672. */
  25673. touchstart: function (event) {
  25674. // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  25675. event = this._zrenderEventFixed(event, true);
  25676. this._lastTouchMoment = new Date();
  25677. // 平板补充一次findHover
  25678. this._mobildFindFixed(event);
  25679. this._mousedownHandler(event);
  25680. },
  25681. /**
  25682. * Method: touchmove
  25683. * Touch 移动响应函数。
  25684. *
  25685. * Parameters:
  25686. * event - {Event} event。
  25687. *
  25688. */
  25689. touchmove: function (event) {
  25690. event = this._zrenderEventFixed(event, true);
  25691. this._mousemoveHandler(event);
  25692. if (this._isDragging) {
  25693. SUtil_SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  25694. }
  25695. },
  25696. /**
  25697. * Method: touchend
  25698. * Touch 结束响应函数。
  25699. *
  25700. * Parameters:
  25701. * event - {Event} event。
  25702. *
  25703. */
  25704. touchend: function (event) {
  25705. // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  25706. event = this._zrenderEventFixed(event, true);
  25707. this._mouseupHandler(event);
  25708. var now = new Date();
  25709. if (now - this._lastTouchMoment < Config.EVENT.touchClickDelay) {
  25710. this._mobildFindFixed(event);
  25711. this._clickHandler(event);
  25712. if (now - this._lastClickMoment < Config.EVENT.touchClickDelay / 2) {
  25713. this._dblclickHandler(event);
  25714. if (this._lastHover && this._lastHover.clickable) {
  25715. SUtil_SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  25716. }
  25717. }
  25718. this._lastClickMoment = now;
  25719. }
  25720. this.painter.clearHover();
  25721. }
  25722. };
  25723. initDomHandler(this);
  25724. // 初始化,事件绑定,支持的所有事件都由如下原生事件计算得来
  25725. if (window.addEventListener) {
  25726. window.addEventListener('resize', this._resizeHandler);
  25727. if (SUtil_SUtil.Util_env.os.tablet || SUtil_SUtil.Util_env.os.phone) {
  25728. // mobile支持
  25729. root.addEventListener('touchstart', this._touchstartHandler);
  25730. root.addEventListener('touchmove', this._touchmoveHandler);
  25731. root.addEventListener('touchend', this._touchendHandler);
  25732. } else {
  25733. // mobile的click/move/up/down自己模拟
  25734. root.addEventListener('click', this._clickHandler);
  25735. root.addEventListener('dblclick', this._dblclickHandler);
  25736. root.addEventListener('mousewheel', this._mousewheelHandler);
  25737. root.addEventListener('mousemove', this._mousemoveHandler);
  25738. root.addEventListener('mousedown', this._mousedownHandler);
  25739. root.addEventListener('mouseup', this._mouseupHandler);
  25740. }
  25741. root.addEventListener('DOMMouseScroll', this._mousewheelHandler);
  25742. root.addEventListener('mouseout', this._mouseoutHandler);
  25743. } else {
  25744. window.attachEvent('onresize', this._resizeHandler);
  25745. root.attachEvent('onclick', this._clickHandler);
  25746. //root.attachEvent('ondblclick ', this._dblclickHandler);
  25747. root.ondblclick = this._dblclickHandler;
  25748. root.attachEvent('onmousewheel', this._mousewheelHandler);
  25749. root.attachEvent('onmousemove', this._mousemoveHandler);
  25750. root.attachEvent('onmouseout', this._mouseoutHandler);
  25751. root.attachEvent('onmousedown', this._mousedownHandler);
  25752. root.attachEvent('onmouseup', this._mouseupHandler);
  25753. }
  25754. // 辅助函数 start
  25755. /**
  25756. * Method: bind1Arg
  25757. * bind 一个参数的 function。
  25758. *
  25759. * Parameters:
  25760. * handler - {function} 要 bind 的 function。
  25761. * context - {Object} 运行时 this 环境。
  25762. *
  25763. * Returns:
  25764. * {function}
  25765. */
  25766. function bind1Arg(handler, context) {
  25767. return function (e) {
  25768. return handler.call(context, e);
  25769. };
  25770. }
  25771. /*
  25772. // bind 两个参数的 function
  25773. function bind2Arg(handler, context) {
  25774. return function (arg1, arg2) {
  25775. return handler.call(context, arg1, arg2);
  25776. };
  25777. }
  25778. */
  25779. // bind 三个参数的 function
  25780. function bind3Arg(handler, context) {
  25781. return function (arg1, arg2, arg3) {
  25782. return handler.call(context, arg1, arg2, arg3);
  25783. };
  25784. }
  25785. /**
  25786. * Method: initDomHandler
  25787. * 为控制类实例初始化 dom 事件处理函数。
  25788. *
  25789. * Parameters:
  25790. * instance - {<LevelRenderer.Handler>} 控制类实例 。
  25791. *
  25792. * Returns:
  25793. * {function}
  25794. */
  25795. function initDomHandler(instance) {
  25796. var domHandlerNames = [
  25797. 'resize', 'click', 'dblclick',
  25798. 'mousewheel', 'mousemove', 'mouseout', 'mouseup', 'mousedown',
  25799. 'touchstart', 'touchend', 'touchmove'
  25800. ];
  25801. var len = domHandlerNames.length;
  25802. while (len--) {
  25803. var name = domHandlerNames[len];
  25804. instance['_' + name + 'Handler'] = bind1Arg(domHandlers[name], instance);
  25805. }
  25806. }
  25807. /**
  25808. * Method: findHover
  25809. * 迭代函数,查找 hover 到的图形元素并即时做些事件分发。
  25810. *
  25811. * Parameters:
  25812. * shape - {Object} 图形。
  25813. * x - {number} 鼠标 x。
  25814. * y - {number} 鼠标 y。
  25815. *
  25816. * Returns:
  25817. * {boolean} 是否找到图形。
  25818. *
  25819. */
  25820. function findHover(shape, x, y) {
  25821. var me = this;
  25822. if (
  25823. (me._draggingTarget && me._draggingTarget.id == shape.id) // 迭代到当前拖拽的图形上
  25824. || shape.isSilent() // 打酱油的路过,啥都不响应的shape~
  25825. ) {
  25826. return false;
  25827. }
  25828. var event = me._event;
  25829. if (shape.isCover(x, y)) {
  25830. if (shape.hoverable) {
  25831. // SMIC-修改 - start
  25832. if (shape.isHoverByRefDataID && shape.isHoverByRefDataID === true) {
  25833. if (shape.refDataID) {
  25834. var fid = shape.refDataID;
  25835. //me.painter.clearHover();
  25836. //me.storage.delHover();
  25837. var hoverGroup = null;
  25838. if (shape.refDataHoverGroup) {
  25839. hoverGroup = shape.refDataHoverGroup;
  25840. }
  25841. //查找同一个用户数据 feature 的所有图形
  25842. var shapeList = me.storage._shapeList;
  25843. for (var i = 0, len = shapeList.length; i < len; i++) {
  25844. var si = shapeList[i];
  25845. if (si.refDataID && fid === si.refDataID) {
  25846. if (hoverGroup) {
  25847. if (si.refDataHoverGroup && hoverGroup === si.refDataHoverGroup) {
  25848. me.storage.addHover(si);
  25849. }
  25850. } else {
  25851. me.storage.addHover(si);
  25852. }
  25853. }
  25854. }
  25855. }
  25856. } else {
  25857. me.storage.addHover(shape);
  25858. }
  25859. //初始代码:
  25860. // me.storage.addHover(shape);
  25861. // SMIC-修改 - end
  25862. }
  25863. // 查找是否在 clipShape 中
  25864. var p = shape.parent;
  25865. while (p) {
  25866. if (p.clipShape && !p.clipShape.isCover(me._mouseX, me._mouseY)) {
  25867. // 已经被祖先 clip 掉了
  25868. return false;
  25869. }
  25870. p = p.parent;
  25871. }
  25872. if (me._lastHover != shape) {
  25873. me._processOutShape(event);
  25874. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  25875. me._processDragLeave(event);
  25876. me._lastHover = shape;
  25877. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
  25878. me._processDragEnter(event);
  25879. }
  25880. me._processOverShape(event);
  25881. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGOVER
  25882. me._processDragOver(event);
  25883. me._hasfound = 1;
  25884. return true; // 找到则中断迭代查找
  25885. }
  25886. return false;
  25887. }
  25888. // 辅助函数 end
  25889. }
  25890. /**
  25891. * @function LevelRenderer.Handler.prototype.destroy
  25892. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
  25893. */
  25894. destroy() {
  25895. this.dispose();
  25896. this._lastX = null;
  25897. this._lastY = null;
  25898. this._mouseX = null;
  25899. this._mouseY = null;
  25900. this._findHover = null;
  25901. Eventful.prototype.destroy.apply(this, arguments);
  25902. }
  25903. /**
  25904. * @function LevelRenderer.Handler.prototype.on
  25905. * @description 自定义事件绑定。
  25906. * @param {string} eventName - 事件名称,resize、hover、drag等。
  25907. * @param {function} handler - 响应函数。
  25908. * @returns {LevelRenderer.Handler} this。
  25909. */
  25910. on(eventName, handler) {
  25911. this.bind(eventName, handler);
  25912. return this;
  25913. }
  25914. /**
  25915. * @function LevelRenderer.Handler.prototype.un
  25916. * @description 自定义事件解除绑定。
  25917. * @param {string} eventName - 事件名称,resize、hover、drag等。
  25918. * @param {function} handler - 响应函数。
  25919. * @returns {LevelRenderer.Handler} this。
  25920. */
  25921. un(eventName, handler) {
  25922. this.unbind(eventName, handler);
  25923. return this;
  25924. }
  25925. /**
  25926. * @function LevelRenderer.Handler.prototype.trigger
  25927. * @description 事件触发。
  25928. * @param {string} eventName - 事件名称,resize、hover、drag等。
  25929. * @param {event} eventArgs - dom事件对象。
  25930. */
  25931. trigger(eventName, eventArgs) {
  25932. var EVENT = Config.EVENT;
  25933. switch (eventName) {
  25934. case EVENT.RESIZE:
  25935. case EVENT.CLICK:
  25936. case EVENT.DBLCLICK:
  25937. case EVENT.MOUSEWHEEL:
  25938. case EVENT.MOUSEMOVE:
  25939. case EVENT.MOUSEDOWN:
  25940. case EVENT.MOUSEUP:
  25941. case EVENT.MOUSEOUT:
  25942. this['_' + eventName + 'Handler'](eventArgs);
  25943. break;
  25944. }
  25945. }
  25946. /**
  25947. * @function LevelRenderer.Handler.prototype.dispose
  25948. * @description 释放,解绑所有事件。
  25949. */
  25950. dispose() {
  25951. var root = this.root;
  25952. if (window.removeEventListener) {
  25953. window.removeEventListener('resize', this._resizeHandler);
  25954. if (SUtil_SUtil.Util_env.os.tablet || SUtil_SUtil.Util_env.os.phone) {
  25955. // mobile支持
  25956. root.removeEventListener('touchstart', this._touchstartHandler);
  25957. root.removeEventListener('touchmove', this._touchmoveHandler);
  25958. root.removeEventListener('touchend', this._touchendHandler);
  25959. } else {
  25960. // mobile的click自己模拟
  25961. root.removeEventListener('click', this._clickHandler);
  25962. root.removeEventListener('dblclick', this._dblclickHandler);
  25963. root.removeEventListener('mousewheel', this._mousewheelHandler);
  25964. root.removeEventListener('mousemove', this._mousemoveHandler);
  25965. root.removeEventListener('mousedown', this._mousedownHandler);
  25966. root.removeEventListener('mouseup', this._mouseupHandler);
  25967. }
  25968. root.removeEventListener('DOMMouseScroll', this._mousewheelHandler);
  25969. root.removeEventListener('mouseout', this._mouseoutHandler);
  25970. } else {
  25971. window.detachEvent('onresize', this._resizeHandler);
  25972. root.detachEvent('onclick', this._clickHandler);
  25973. root.detachEvent('dblclick', this._dblclickHandler);
  25974. root.detachEvent('onmousewheel', this._mousewheelHandler);
  25975. root.detachEvent('onmousemove', this._mousemoveHandler);
  25976. root.detachEvent('onmouseout', this._mouseoutHandler);
  25977. root.detachEvent('onmousedown', this._mousedownHandler);
  25978. root.detachEvent('onmouseup', this._mouseupHandler);
  25979. }
  25980. this.root = null;
  25981. this._domHover = null;
  25982. this.storage = null;
  25983. this.painter = null;
  25984. this.un();
  25985. }
  25986. /**
  25987. * Method: _processDragStart
  25988. * 拖拽开始。
  25989. *
  25990. * Parameters:
  25991. * event - {Object} 事件对象。
  25992. *
  25993. */
  25994. _processDragStart(event) {
  25995. var _lastHover = this._lastHover;
  25996. if (this._isMouseDown
  25997. && _lastHover
  25998. && _lastHover.draggable
  25999. && !this._draggingTarget
  26000. && this._mouseDownTarget == _lastHover
  26001. ) {
  26002. // 拖拽点击生效时长阀门,某些场景需要降低拖拽敏感度
  26003. if (_lastHover.dragEnableTime &&
  26004. new Date() - this._lastMouseDownMoment < _lastHover.dragEnableTime
  26005. ) {
  26006. return;
  26007. }
  26008. var _draggingTarget = _lastHover;
  26009. this._draggingTarget = _draggingTarget;
  26010. this._isDragging = 1;
  26011. _draggingTarget.invisible = true;
  26012. this.storage.mod(_draggingTarget.id);
  26013. // 分发 Config.EVENT.DRAGSTART事件
  26014. this._dispatchAgency(
  26015. _draggingTarget,
  26016. Config.EVENT.DRAGSTART,
  26017. event
  26018. );
  26019. this.painter.refresh();
  26020. }
  26021. }
  26022. /**
  26023. * Method: _processDragEnter
  26024. * 拖拽进入目标元素。
  26025. *
  26026. * Parameters:
  26027. * event - {Object} 事件对象。
  26028. *
  26029. */
  26030. _processDragEnter(event) {
  26031. if (this._draggingTarget) {
  26032. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
  26033. this._dispatchAgency(
  26034. this._lastHover,
  26035. Config.EVENT.DRAGENTER,
  26036. event,
  26037. this._draggingTarget
  26038. );
  26039. }
  26040. }
  26041. /**
  26042. * Method: _processDragOver
  26043. * 拖拽在目标元素上移动。
  26044. *
  26045. * Parameters:
  26046. * event - {Object} 事件对象。
  26047. *
  26048. */
  26049. _processDragOver(event) {
  26050. if (this._draggingTarget) {
  26051. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGOVER事件
  26052. this._dispatchAgency(
  26053. this._lastHover,
  26054. Config.EVENT.DRAGOVER,
  26055. event,
  26056. this._draggingTarget
  26057. );
  26058. }
  26059. }
  26060. /**
  26061. * Method: _processDragLeave
  26062. * 拖拽离开目标元素。
  26063. *
  26064. * Parameters:
  26065. * event - {Object} 事件对象。
  26066. *
  26067. */
  26068. _processDragLeave(event) {
  26069. if (this._draggingTarget) {
  26070. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  26071. this._dispatchAgency(
  26072. this._lastHover,
  26073. Config.EVENT.DRAGLEAVE,
  26074. event,
  26075. this._draggingTarget
  26076. );
  26077. }
  26078. }
  26079. /**
  26080. * Method: _processDrop
  26081. * 拖拽在目标元素上完成。
  26082. *
  26083. * Parameters:
  26084. * event - {Object} 事件对象。
  26085. *
  26086. */
  26087. _processDrop(event) {
  26088. if (this._draggingTarget) {
  26089. this._draggingTarget.invisible = false;
  26090. this.storage.mod(this._draggingTarget.id);
  26091. this.painter.refresh();
  26092. // 分发SuperMap.LevelRenderer.Config.EVENT.DROP事件
  26093. this._dispatchAgency(
  26094. this._lastHover,
  26095. Config.EVENT.DROP,
  26096. event,
  26097. this._draggingTarget
  26098. );
  26099. }
  26100. }
  26101. /**
  26102. * Method: _processDragEnd
  26103. * 拖拽结束。
  26104. *
  26105. * Parameters:
  26106. * event - {Object} 事件对象。
  26107. *
  26108. */
  26109. _processDragEnd(event) {
  26110. if (this._draggingTarget) {
  26111. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGEND事件
  26112. this._dispatchAgency(
  26113. this._draggingTarget,
  26114. Config.EVENT.DRAGEND,
  26115. event
  26116. );
  26117. this._lastHover = null;
  26118. }
  26119. this._isDragging = 0;
  26120. this._draggingTarget = null;
  26121. }
  26122. /**
  26123. * Method: _processOverShape
  26124. * 鼠标在某个图形元素上移动。
  26125. *
  26126. * Parameters:
  26127. * event - {Object} 事件对象。
  26128. *
  26129. */
  26130. _processOverShape(event) {
  26131. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOVER事件
  26132. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEOVER, event);
  26133. }
  26134. /**
  26135. * Method: _processOutShape
  26136. * 鼠标离开某个图形元素。
  26137. *
  26138. * Parameters:
  26139. * event - {Object} 事件对象。
  26140. *
  26141. */
  26142. _processOutShape(event) {
  26143. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
  26144. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEOUT, event);
  26145. }
  26146. /**
  26147. * Method: _dispatchAgency
  26148. * 鼠标离开某个图形元素。
  26149. *
  26150. * Parameters:
  26151. * targetShape - {Object} 目标图形元素。
  26152. * eventName - {Object} 事件名称。
  26153. * event - {Object} 事件对象。
  26154. * draggedShape - {Object} 拖拽事件特有,当前被拖拽图形元素。
  26155. *
  26156. */
  26157. _dispatchAgency(targetShape, eventName, event, draggedShape) {
  26158. var eventHandler = 'on' + eventName;
  26159. var eventPacket = {
  26160. type: eventName,
  26161. event: event,
  26162. target: targetShape,
  26163. cancelBubble: false
  26164. };
  26165. var el = targetShape;
  26166. if (draggedShape) {
  26167. eventPacket.dragged = draggedShape;
  26168. }
  26169. while (el) {
  26170. el[eventHandler]
  26171. && (eventPacket.cancelBubble = el[eventHandler](eventPacket));
  26172. el.dispatch(eventName, eventPacket);
  26173. el = el.parent;
  26174. if (eventPacket.cancelBubble) {
  26175. break;
  26176. }
  26177. }
  26178. if (targetShape) {
  26179. // 冒泡到顶级 zrender 对象
  26180. if (!eventPacket.cancelBubble) {
  26181. this.dispatch(eventName, eventPacket);
  26182. }
  26183. } else if (!draggedShape) {
  26184. // 无hover目标,无拖拽对象,原生事件分发
  26185. this.dispatch(eventName, {
  26186. type: eventName,
  26187. event: event
  26188. });
  26189. }
  26190. }
  26191. /**
  26192. * Method: _iterateAndFindHover
  26193. * 迭代寻找 hover shape。
  26194. *
  26195. */
  26196. _iterateAndFindHover() {
  26197. var invTransform = SUtil_SUtil.Util_matrix.create();
  26198. var list = this.storage.getShapeList();
  26199. var currentZLevel;
  26200. var currentLayer;
  26201. var tmp = [0, 0];
  26202. for (var i = list.length - 1; i >= 0; i--) {
  26203. var shape = list[i];
  26204. if (currentZLevel !== shape.zlevel) {
  26205. currentLayer = this.painter.getLayer(shape.zlevel, currentLayer);
  26206. tmp[0] = this._mouseX;
  26207. tmp[1] = this._mouseY;
  26208. if (currentLayer.needTransform) {
  26209. SUtil_SUtil.Util_matrix.invert(invTransform, currentLayer.transform);
  26210. SUtil_SUtil.Util_vector.applyTransform(tmp, tmp, invTransform);
  26211. }
  26212. }
  26213. if (this._findHover(shape, tmp[0], tmp[1])) {
  26214. break;
  26215. }
  26216. }
  26217. }
  26218. /**
  26219. * Method: _mobildFindFixed
  26220. * touch 有指尖错觉,四向尝试,让touch上的点击更好触发事件。
  26221. *
  26222. * Parameters:
  26223. * event - {Object} 事件对象。
  26224. *
  26225. */
  26226. _mobildFindFixed(event) {
  26227. // touch指尖错觉的尝试偏移量配置
  26228. var MOBILE_TOUCH_OFFSETS = [
  26229. {x: 10},
  26230. {x: -20},
  26231. {x: 10, y: 10},
  26232. {y: -20}
  26233. ];
  26234. this._lastHover = null;
  26235. this._mouseX = event.zrenderX;
  26236. this._mouseY = event.zrenderY;
  26237. this._event = event;
  26238. this._iterateAndFindHover();
  26239. for (var i = 0; !this._lastHover && i < MOBILE_TOUCH_OFFSETS.length; i++) {
  26240. var offset = MOBILE_TOUCH_OFFSETS[i];
  26241. offset.x && (this._mouseX += offset.x);
  26242. offset.y && (this._mouseX += offset.y);
  26243. this._iterateAndFindHover();
  26244. }
  26245. if (this._lastHover) {
  26246. event.zrenderX = this._mouseX;
  26247. event.zrenderY = this._mouseY;
  26248. }
  26249. }
  26250. /**
  26251. * Method: _zrenderEventFixed
  26252. * 如果存在第三方嵌入的一些dom触发的事件,或touch事件,需要转换一下事件坐标 。
  26253. *
  26254. * Parameters:
  26255. * event - {Object} 事件。
  26256. * isTouch - {boolean} 是否触摸。
  26257. *
  26258. */
  26259. _zrenderEventFixed(event, isTouch) {
  26260. if (event.zrenderFixed) {
  26261. return event;
  26262. }
  26263. if (!isTouch) {
  26264. event = event || window.event;
  26265. // 进入对象优先~
  26266. var target = event.toElement
  26267. || event.relatedTarget
  26268. || event.srcElement
  26269. || event.target;
  26270. if (target && target != this._domHover) {
  26271. event.zrenderX = (typeof event.offsetX != 'undefined'
  26272. ? event.offsetX
  26273. : event.layerX)
  26274. + target.offsetLeft;
  26275. event.zrenderY = (typeof event.offsetY != 'undefined'
  26276. ? event.offsetY
  26277. : event.layerY)
  26278. + target.offsetTop;
  26279. }
  26280. } else {
  26281. var touch = event.type != 'touchend'
  26282. ? event.targetTouches[0]
  26283. : event.changedTouches[0];
  26284. if (touch) {
  26285. var rBounding = this.root.getBoundingClientRect();
  26286. // touch事件坐标是全屏的~
  26287. event.zrenderX = touch.clientX - rBounding.left;
  26288. event.zrenderY = touch.clientY - rBounding.top;
  26289. }
  26290. }
  26291. event.zrenderFixed = 1;
  26292. return event;
  26293. }
  26294. // SMIC-方法扩展 - start
  26295. /**
  26296. * @function LevelRenderer.Handler.prototype.getLastHoverOne
  26297. * @description 获取单个高亮图形
  26298. */
  26299. getLastHoverOne() {
  26300. if (this._lastHover) {
  26301. return this._lastHover;
  26302. }
  26303. return null;
  26304. }
  26305. // SMIC-方法扩展 - end
  26306. }
  26307. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Easing.js
  26308. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26309. * This program are made available under the terms of the Apache License, Version 2.0
  26310. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26311. /**
  26312. * @class LevelRenderer.Animation.easing
  26313. * @category Visualization Theme
  26314. * @classdesc 缓动
  26315. * @private
  26316. */
  26317. // 缓动代码来自 https://github.com/sole/tween.js/blob/master/src/Tween.js
  26318. // http://sole.github.io/tween.js/examples/03_graphs.html
  26319. class Easing {
  26320. constructor() {
  26321. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.easing";
  26322. }
  26323. /**
  26324. * @function LevelRenderer.Animation.easing.destroy
  26325. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  26326. */
  26327. destroy() {
  26328. }
  26329. /**
  26330. * @function LevelRenderer.Animation.easing.Linear
  26331. * @description 线性缓动
  26332. * @param {number} k - 参数
  26333. * @return {number} 输入值
  26334. */
  26335. Linear(k) {
  26336. return k;
  26337. }
  26338. /**
  26339. * @function LevelRenderer.Animation.easing.QuadraticIn
  26340. * @description 二次方的缓动(t^2)
  26341. * @param {number} k - 参数
  26342. * @return {number} 二次方的缓动的值
  26343. */
  26344. QuadraticIn(k) {
  26345. return k * k;
  26346. }
  26347. /**
  26348. * @function LevelRenderer.Animation.easing.QuadraticOut
  26349. * @description 返回按二次方缓动退出的值
  26350. * @param {number} k - 参数
  26351. * @return {number} 按二次方缓动退出的值
  26352. */
  26353. QuadraticOut(k) {
  26354. return k * (2 - k);
  26355. }
  26356. /**
  26357. * @function LevelRenderer.Animation.easing.QuadraticInOut
  26358. * @description 返回按二次方缓动进入和退出的值
  26359. * @param {number} k - 参数
  26360. * @return {number} 按二次方缓动进入和退出的值
  26361. */
  26362. QuadraticInOut(k) {
  26363. if ((k *= 2) < 1) {
  26364. return 0.5 * k * k;
  26365. }
  26366. return -0.5 * (--k * (k - 2) - 1);
  26367. }
  26368. /**
  26369. * @function LevelRenderer.Animation.easing.CubicIn
  26370. * @description 三次方的缓动(t^3)
  26371. * @param {number} k - 参数
  26372. * @return {number} 按三次方缓动的值
  26373. */
  26374. CubicIn(k) {
  26375. return k * k * k;
  26376. }
  26377. /**
  26378. * @function LevelRenderer.Animation.easing.CubicOut
  26379. * @description 返回按三次方缓动退出的值
  26380. * @param {number} k - 参数
  26381. * @return {number} 按三次方缓动退出的值
  26382. */
  26383. CubicOut(k) {
  26384. return --k * k * k + 1;
  26385. }
  26386. /**
  26387. * @function LevelRenderer.Animation.easing.CubicInOut
  26388. * @description 返回按三次方缓动进入退出的值
  26389. * @param {number} k - 参数
  26390. * @return {number} 按三次方缓动进入退出的值
  26391. */
  26392. CubicInOut(k) {
  26393. if ((k *= 2) < 1) {
  26394. return 0.5 * k * k * k;
  26395. }
  26396. return 0.5 * ((k -= 2) * k * k + 2);
  26397. }
  26398. /**
  26399. * @function LevelRenderer.Animation.easing.QuarticIn
  26400. * @description 返回按四次方缓动进入的值
  26401. * @param {number} k - 参数
  26402. * @return {number} 按四次方缓动进入的值
  26403. */
  26404. QuarticIn(k) {
  26405. return k * k * k * k;
  26406. }
  26407. /**
  26408. * @function LevelRenderer.Animation.easing.QuarticOut
  26409. * @description 返回按四次方缓动退出的值
  26410. * @param {number} k - 参数
  26411. * @return {number} 按四次方缓动退出的值
  26412. */
  26413. QuarticOut(k) {
  26414. return 1 - (--k * k * k * k);
  26415. }
  26416. /**
  26417. * @function LevelRenderer.Animation.easing.QuarticInOut
  26418. * @description 返回按四次方缓动进入退出的值
  26419. * @param {number} k - 参数
  26420. * @return {number} 按四次方缓动进入退出的值
  26421. */
  26422. QuarticInOut(k) {
  26423. if ((k *= 2) < 1) {
  26424. return 0.5 * k * k * k * k;
  26425. }
  26426. return -0.5 * ((k -= 2) * k * k * k - 2);
  26427. }
  26428. // 五次方的缓动(t^5)
  26429. /**
  26430. * @function LevelRenderer.Animation.easing.QuinticIn
  26431. * @description 返回按五次方缓动的值
  26432. * @param {number} k - 参数
  26433. * @return {number} 按五次方缓动的值
  26434. */
  26435. QuinticIn(k) {
  26436. return k * k * k * k * k;
  26437. }
  26438. /**
  26439. * @function LevelRenderer.Animation.easing.QuinticOut
  26440. * @description 返回按五次方缓动退出的值
  26441. * @param {number} k - 参数
  26442. * @return {number} 按五次方缓动退出的值
  26443. */
  26444. QuinticOut(k) {
  26445. return --k * k * k * k * k + 1;
  26446. }
  26447. /**
  26448. * @function LevelRenderer.Animation.easing.QuinticInOut
  26449. * @description 返回按五次方缓动进入退出的值
  26450. * @param {number} k - 参数
  26451. * @return {number} 按五次方缓动进入退出的值
  26452. */
  26453. QuinticInOut(k) {
  26454. if ((k *= 2) < 1) {
  26455. return 0.5 * k * k * k * k * k;
  26456. }
  26457. return 0.5 * ((k -= 2) * k * k * k * k + 2);
  26458. }
  26459. // 正弦曲线的缓动(sin(t))
  26460. /**
  26461. * @function LevelRenderer.Animation.easing.SinusoidalIn
  26462. * @description 返回按正弦曲线的缓动进入的值
  26463. * @param {number} k - 参数
  26464. * @return {number} 按正弦曲线的缓动进入的值
  26465. */
  26466. SinusoidalIn(k) {
  26467. return 1 - Math.cos(k * Math.PI / 2);
  26468. }
  26469. /**
  26470. * @function LevelRenderer.Animation.easing.SinusoidalOut
  26471. * @description 返回按正弦曲线的缓动退出的值
  26472. * @param {number} k - 参数
  26473. * @return {number} 按正弦曲线的缓动退出的值
  26474. */
  26475. SinusoidalOut(k) {
  26476. return Math.sin(k * Math.PI / 2);
  26477. }
  26478. /**
  26479. * @function LevelRenderer.Animation.easing.SinusoidalInOut
  26480. * @description 返回按正弦曲线的缓动进入退出的值
  26481. * @param {number} k - 参数
  26482. * @return {number} 按正弦曲线的缓动进入退出的值
  26483. */
  26484. SinusoidalInOut(k) {
  26485. return 0.5 * (1 - Math.cos(Math.PI * k));
  26486. }
  26487. // 指数曲线的缓动(2^t)
  26488. /**
  26489. * @function LevelRenderer.Animation.easing.ExponentialIn
  26490. * @description 返回按指数曲线的缓动进入的值
  26491. * @param {number} k - 参数
  26492. * @return {number} 按指数曲线的缓动进入的值
  26493. */
  26494. ExponentialIn(k) {
  26495. return k === 0 ? 0 : Math.pow(1024, k - 1);
  26496. }
  26497. /**
  26498. * @function LevelRenderer.Animation.easing.ExponentialOut
  26499. * @description 返回按指数曲线的缓动退出的值
  26500. * @param {number} k - 参数
  26501. * @return {number} 按指数曲线的缓动退出的值
  26502. */
  26503. ExponentialOut(k) {
  26504. return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);
  26505. }
  26506. /**
  26507. * @function LevelRenderer.Animation.easing.ExponentialInOut
  26508. * @description 返回按指数曲线的缓动进入退出的值
  26509. * @param {number} k - 参数
  26510. * @return {number} 按指数曲线的缓动进入退出的值
  26511. */
  26512. ExponentialInOut(k) {
  26513. if (k === 0) {
  26514. return 0;
  26515. }
  26516. if (k === 1) {
  26517. return 1;
  26518. }
  26519. if ((k *= 2) < 1) {
  26520. return 0.5 * Math.pow(1024, k - 1);
  26521. }
  26522. return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);
  26523. }
  26524. // 圆形曲线的缓动(sqrt(1-t^2))
  26525. /**
  26526. * @function LevelRenderer.Animation.easing.CircularIn
  26527. * @description 返回按圆形曲线的缓动进入的值
  26528. * @param {number} k - 参数
  26529. * @return {number} 按圆形曲线的缓动进入的值
  26530. */
  26531. CircularIn(k) {
  26532. return 1 - Math.sqrt(1 - k * k);
  26533. }
  26534. /**
  26535. * @function LevelRenderer.Animation.easing.CircularOut
  26536. * @description 返回按圆形曲线的缓动退出的值
  26537. * @param {number} k - 参数
  26538. * @return {number} 按圆形曲线的缓动退出的值
  26539. */
  26540. CircularOut(k) {
  26541. return Math.sqrt(1 - (--k * k));
  26542. }
  26543. /**
  26544. * @function LevelRenderer.Animation.easing.CircularInOut
  26545. * @description 返回按圆形曲线的缓动进入退出的值
  26546. * @param {number} k - 参数
  26547. * @return {number} 按圆形曲线的缓动进入退出的值
  26548. */
  26549. CircularInOut(k) {
  26550. if ((k *= 2) < 1) {
  26551. return -0.5 * (Math.sqrt(1 - k * k) - 1);
  26552. }
  26553. return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
  26554. }
  26555. // 创建类似于弹簧在停止前来回振荡的动画
  26556. /**
  26557. * @function LevelRenderer.Animation.easing.ElasticIn
  26558. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入的值
  26559. * @param {number} k - 参数
  26560. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入的值
  26561. */
  26562. ElasticIn(k) {
  26563. var s;
  26564. var a = 0.1;
  26565. var p = 0.4;
  26566. if (k === 0) {
  26567. return 0;
  26568. }
  26569. if (k === 1) {
  26570. return 1;
  26571. }
  26572. if (a < 1) {
  26573. a = 1;
  26574. s = p / 4;
  26575. } else {
  26576. s = p * Math.asin(1 / a) / (2 * Math.PI);
  26577. }
  26578. return -(a * Math.pow(2, 10 * (k -= 1)) *
  26579. Math.sin((k - s) * (2 * Math.PI) / p));
  26580. }
  26581. /**
  26582. * @function LevelRenderer.Animation.easing.ElasticOut
  26583. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动退出的值
  26584. * @param {number} k - 参数
  26585. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动退出的值
  26586. */
  26587. ElasticOut(k) {
  26588. var s;
  26589. var a = 0.1;
  26590. var p = 0.4;
  26591. if (k === 0) {
  26592. return 0;
  26593. }
  26594. if (k === 1) {
  26595. return 1;
  26596. }
  26597. if (a < 1) {
  26598. a = 1;
  26599. s = p / 4;
  26600. } else {
  26601. s = p * Math.asin(1 / a) / (2 * Math.PI);
  26602. }
  26603. return (a * Math.pow(2, -10 * k) *
  26604. Math.sin((k - s) * (2 * Math.PI) / p) + 1);
  26605. }
  26606. /**
  26607. * @function LevelRenderer.Animation.easing.ElasticInOut
  26608. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
  26609. * @param {number} k - 参数
  26610. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
  26611. */
  26612. ElasticInOut(k) {
  26613. var s;
  26614. var a = 0.1;
  26615. var p = 0.4;
  26616. if (k === 0) {
  26617. return 0;
  26618. }
  26619. if (k === 1) {
  26620. return 1;
  26621. }
  26622. if (a < 1) {
  26623. a = 1;
  26624. s = p / 4;
  26625. } else {
  26626. s = p * Math.asin(1 / a) / (2 * Math.PI);
  26627. }
  26628. if ((k *= 2) < 1) {
  26629. return -0.5 * (a * Math.pow(2, 10 * (k -= 1))
  26630. * Math.sin((k - s) * (2 * Math.PI) / p));
  26631. }
  26632. return a * Math.pow(2, -10 * (k -= 1))
  26633. * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1;
  26634. }
  26635. // 在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动
  26636. /**
  26637. * @function LevelRenderer.Animation.easing.BackIn
  26638. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
  26639. * @param {number} k - 参数
  26640. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
  26641. */
  26642. BackIn(k) {
  26643. var s = 1.70158;
  26644. return k * k * ((s + 1) * k - s);
  26645. }
  26646. /**
  26647. * @function LevelRenderer.Animation.easing.BackOut
  26648. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
  26649. * @param {number} k - 参数
  26650. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
  26651. */
  26652. BackOut(k) {
  26653. var s = 1.70158;
  26654. return --k * k * ((s + 1) * k + s) + 1;
  26655. }
  26656. /**
  26657. * @function LevelRenderer.Animation.easing.BackInOut
  26658. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
  26659. * @param {number} k - 参数
  26660. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
  26661. */
  26662. BackInOut(k) {
  26663. var s = 1.70158 * 1.525;
  26664. if ((k *= 2) < 1) {
  26665. return 0.5 * (k * k * ((s + 1) * k - s));
  26666. }
  26667. return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);
  26668. }
  26669. // 创建弹跳效果
  26670. /**
  26671. * @function LevelRenderer.Animation.easing.BounceIn
  26672. * @description 返回按弹跳效果的缓动进入的值
  26673. * @param {number} k - 参数
  26674. * @return {number} 按弹跳效果的缓动进入的值
  26675. */
  26676. BounceIn(k) {
  26677. return 1 - this.BounceOut(1 - k);
  26678. }
  26679. /**
  26680. * @function LevelRenderer.Animation.easing.BounceOut
  26681. * @description 返回按弹跳效果的缓动退出的值
  26682. * @param {number} k - 参数
  26683. * @return {number} 按弹跳效果的缓动退出的值
  26684. */
  26685. BounceOut(k) {
  26686. if (k < (1 / 2.75)) {
  26687. return 7.5625 * k * k;
  26688. } else if (k < (2 / 2.75)) {
  26689. return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;
  26690. } else if (k < (2.5 / 2.75)) {
  26691. return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;
  26692. } else {
  26693. return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;
  26694. }
  26695. }
  26696. /**
  26697. * @function LevelRenderer.Animation.easing.BounceInOut
  26698. * @description 返回按弹跳效果的缓动进入退出的值
  26699. * @param {number} k - 参数
  26700. * @return {number} 按弹跳效果的缓动进入退出的值
  26701. */
  26702. BounceInOut(k) {
  26703. if (k < 0.5) {
  26704. return this.BounceIn(k * 2) * 0.5;
  26705. }
  26706. return this.BounceOut(k * 2 - 1) * 0.5 + 0.5;
  26707. }
  26708. }
  26709. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Clip.js
  26710. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26711. * This program are made available under the terms of the Apache License, Version 2.0
  26712. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26713. /**
  26714. * @class LevelRenderer.Animation.Clip
  26715. * @category Visualization Theme
  26716. * @classdesc 动画片段
  26717. * @param {Object} options - 参数。
  26718. * @param {Object} options.target - 动画对象,可以是数组,如果是数组的话会批量分发 onframe 等事件。
  26719. * @param {number} [options.life=1000] - 动画时长。
  26720. * @param {number} [options.delay=0] - 动画延迟时间。
  26721. * @param {boolean} [options.loop=true] - 是否循环。
  26722. * @param {number} [options.gap=0] - 循环的间隔时间。
  26723. * @param {Object} options.onframe - 帧。
  26724. * @param {boolean} options.easing - 是否消除。
  26725. * @param {boolean} options.ondestroy - 是否销毁。
  26726. * @param {boolean} options.onrestart - 是否重播。
  26727. * @private
  26728. */
  26729. class Clip {
  26730. constructor(options) {
  26731. this._targetPool = options.target || {};
  26732. if (!(this._targetPool instanceof Array)) {
  26733. this._targetPool = [this._targetPool];
  26734. }
  26735. // 生命周期
  26736. this._life = options.life || 1000;
  26737. // 延时
  26738. this._delay = options.delay || 0;
  26739. // 开始时间
  26740. this._startTime = new Date().getTime() + this._delay;// 单位毫秒
  26741. // 结束时间
  26742. this._endTime = this._startTime + this._life * 1000;
  26743. // 是否循环
  26744. this.loop = typeof options.loop == 'undefined'
  26745. ? false : options.loop;
  26746. this.gap = options.gap || 0;
  26747. this.easing = options.easing || 'Linear';
  26748. this.onframe = options.onframe;
  26749. this.ondestroy = options.ondestroy;
  26750. this.onrestart = options.onrestart;
  26751. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Clip";
  26752. }
  26753. /**
  26754. * @function LevelRenderer.Animation.Clip.prototype.destroy
  26755. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  26756. */
  26757. destroy() {
  26758. }
  26759. step(time) {
  26760. var easing = new Easing();
  26761. var percent = (time - this._startTime) / this._life;
  26762. // 还没开始
  26763. if (percent < 0) {
  26764. return;
  26765. }
  26766. percent = Math.min(percent, 1);
  26767. var easingFunc = typeof this.easing == 'string'
  26768. ? easing[this.easing]
  26769. : this.easing;
  26770. var schedule = typeof easingFunc === 'function'
  26771. ? easingFunc(percent)
  26772. : percent;
  26773. this.fire('frame', schedule);
  26774. // 结束
  26775. if (percent == 1) {
  26776. if (this.loop) {
  26777. this.restart();
  26778. // 重新开始周期
  26779. // 抛出而不是直接调用事件直到 stage.update 后再统一调用这些事件
  26780. return 'restart';
  26781. }
  26782. // 动画完成将这个控制器标识为待删除
  26783. // 在Animation.update中进行批量删除
  26784. this._needsRemove = true;
  26785. return 'destroy';
  26786. }
  26787. return null;
  26788. }
  26789. restart() {
  26790. var time = new Date().getTime();
  26791. var remainder = (time - this._startTime) % this._life;
  26792. this._startTime = new Date().getTime() - remainder + this.gap;
  26793. }
  26794. fire(eventType, arg) {
  26795. for (var i = 0, len = this._targetPool.length; i < len; i++) {
  26796. if (this['on' + eventType]) {
  26797. this['on' + eventType](this._targetPool[i], arg);
  26798. }
  26799. }
  26800. }
  26801. }
  26802. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Animation.js
  26803. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26804. * This program are made available under the terms of the Apache License, Version 2.0
  26805. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26806. /**
  26807. * @class LevelRenderer.Animation
  26808. * @classdesc 动画主类, 调度和管理所有动画控制器
  26809. * @category Visualization Theme
  26810. * @extends {LevelRenderer.Eventful}
  26811. * @param {Object} options - 动画参数。
  26812. * @param {Object} options.onframe - onframe。
  26813. * @param {Object} options.stage - stage。
  26814. * @example 例如:
  26815. * (start code)
  26816. * var animation = new LevelRenderer.Animation();
  26817. * var obj = {
  26818. * x: 100,
  26819. * y: 100
  26820. * };
  26821. * animation.animate(node.position)
  26822. * .when(1000, {
  26823. * x: 500,
  26824. * y: 500
  26825. * })
  26826. * .when(2000, {
  26827. * x: 100,
  26828. * y: 100
  26829. * })
  26830. * .start('spline');
  26831. * (end)
  26832. * @private
  26833. */
  26834. class Animation extends Eventful {
  26835. constructor(options) {
  26836. super(options);
  26837. options = options || {};
  26838. /**
  26839. * @member {Object} LevelRenderer.Animation.prototype.stage
  26840. * @description stage。
  26841. */
  26842. this.stage = {};
  26843. /**
  26844. * @member {Object} LevelRenderer.Animation.prototype.onframe
  26845. * @description onframe。
  26846. */
  26847. this.onframe = function () {
  26848. };
  26849. /**
  26850. * @member {Array} LevelRenderer.Animation.prototype._clips
  26851. * @description _clips。
  26852. */
  26853. this._clips = [];
  26854. /**
  26855. * @member {boolean} LevelRenderer.Animation.prototype._running
  26856. * @description _running。
  26857. */
  26858. this._running = false;
  26859. /**
  26860. * @member {number} LevelRenderer.Animation.prototype._time
  26861. * @description _time。
  26862. */
  26863. this._time = 0;
  26864. Util_Util.extend(this, options);
  26865. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation";
  26866. }
  26867. /**
  26868. * @function LevelRenderer.Animation.prototype.add
  26869. * @description 添加动画片段。
  26870. * @param {LevelRenderer.Animation.Clip} clip - 动画片段。
  26871. */
  26872. add(clip) {
  26873. this._clips.push(clip);
  26874. }
  26875. /**
  26876. * @function LevelRenderer.Animation.prototype.remove
  26877. * @description 删除动画片段。
  26878. * @param {LevelRenderer.Animation.Clip} clip - 动画片段。
  26879. */
  26880. remove(clip) {
  26881. var idx = new levelRenderer_Util_Util().indexOf(this._clips, clip);
  26882. if (idx >= 0) {
  26883. this._clips.splice(idx, 1);
  26884. }
  26885. }
  26886. /**
  26887. * @function LevelRenderer.Animation.prototype.update
  26888. * @description 更新动画片段。
  26889. */
  26890. _update() {
  26891. var time = new Date().getTime();
  26892. var delta = time - this._time;
  26893. var clips = this._clips;
  26894. var len = clips.length;
  26895. var deferredEvents = [];
  26896. var deferredClips = [];
  26897. for (let i = 0; i < len; i++) {
  26898. var clip = clips[i];
  26899. var e = clip.step(time);
  26900. // Throw out the events need to be called after
  26901. // stage.update, like destroy
  26902. if (e) {
  26903. deferredEvents.push(e);
  26904. deferredClips.push(clip);
  26905. }
  26906. }
  26907. if (this.stage.update) {
  26908. this.stage.update();
  26909. }
  26910. // Remove the finished clip
  26911. for (let i = 0; i < len;) {
  26912. if (clips[i]._needsRemove) {
  26913. clips[i] = clips[len - 1];
  26914. clips.pop();
  26915. len--;
  26916. } else {
  26917. i++;
  26918. }
  26919. }
  26920. len = deferredEvents.length;
  26921. for (let i = 0; i < len; i++) {
  26922. deferredClips[i].fire(deferredEvents[i]);
  26923. }
  26924. this._time = time;
  26925. this.onframe(delta);
  26926. this.dispatch('frame', delta);
  26927. }
  26928. /**
  26929. * @function LevelRenderer.Animation.prototype.start
  26930. * @description 开始运行动画。
  26931. */
  26932. start() {
  26933. var requestAnimationFrame = window.requestAnimationFrame
  26934. || window.msRequestAnimationFrame
  26935. || window.mozRequestAnimationFrame
  26936. || window.webkitRequestAnimationFrame
  26937. || function (func) {
  26938. setTimeout(func, 16);
  26939. };
  26940. var self = this;
  26941. this._running = true;
  26942. function step() {
  26943. if (self._running) {
  26944. self._update();
  26945. requestAnimationFrame(step);
  26946. }
  26947. }
  26948. this._time = new Date().getTime();
  26949. requestAnimationFrame(step);
  26950. }
  26951. /**
  26952. * @function LevelRenderer.Animation.prototype.stop
  26953. * @description 停止运行动画。
  26954. */
  26955. stop() {
  26956. this._running = false;
  26957. }
  26958. /**
  26959. * @function LevelRenderer.Animation.prototype.clear
  26960. * @description 清除所有动画片段。
  26961. */
  26962. clear() {
  26963. this._clips = [];
  26964. }
  26965. /**
  26966. * @function LevelRenderer.Animation.prototype.animate
  26967. * @description 对一个目标创建一个animator对象,可以指定目标中的属性使用动画。
  26968. * @param {Object} target - 目标对象。
  26969. * @param {Object} options - 动画参数选项。
  26970. * @param {boolean} [options.loop=false] - 是否循环播放动画。
  26971. * @param {function} [options.getter] - 如果指定getter函数,会通过getter函数取属性值。
  26972. * @param {function} [options.setter] - 如果指定setter函数,会通过setter函数设置属性值。
  26973. * @returns {LevelRenderer.Animation.Animator} Animator。
  26974. */
  26975. animate(target, options) {
  26976. options = options || {};
  26977. var deferred = new Animator(
  26978. target,
  26979. options.loop,
  26980. options.getter,
  26981. options.setter
  26982. );
  26983. deferred.animation = this;
  26984. return deferred;
  26985. }
  26986. static _interpolateNumber(p0, p1, percent) {
  26987. return (p1 - p0) * percent + p0;
  26988. }
  26989. static _interpolateArray(p0, p1, percent, out, arrDim) {
  26990. var len = p0.length;
  26991. if (arrDim == 1) {
  26992. for (let i = 0; i < len; i++) {
  26993. out[i] = Animation._interpolateNumber(p0[i], p1[i], percent);
  26994. }
  26995. } else {
  26996. var len2 = p0[0].length;
  26997. for (let i = 0; i < len; i++) {
  26998. for (let j = 0; j < len2; j++) {
  26999. out[i][j] = Animation._interpolateNumber(
  27000. p0[i][j], p1[i][j], percent
  27001. );
  27002. }
  27003. }
  27004. }
  27005. }
  27006. static _isArrayLike(data) {
  27007. switch (typeof data) {
  27008. case 'undefined':
  27009. case 'string':
  27010. return false;
  27011. }
  27012. return typeof data.length !== 'undefined';
  27013. }
  27014. static _catmullRomInterpolateArray(p0, p1, p2, p3, t, t2, t3, out, arrDim) {
  27015. var len = p0.length;
  27016. if (arrDim == 1) {
  27017. for (let i = 0; i < len; i++) {
  27018. out[i] = Animation._catmullRomInterpolate(
  27019. p0[i], p1[i], p2[i], p3[i], t, t2, t3
  27020. );
  27021. }
  27022. } else {
  27023. var len2 = p0[0].length;
  27024. for (let i = 0; i < len; i++) {
  27025. for (var j = 0; j < len2; j++) {
  27026. out[i][j] = Animation._catmullRomInterpolate(
  27027. p0[i][j], p1[i][j], p2[i][j], p3[i][j],
  27028. t, t2, t3
  27029. );
  27030. }
  27031. }
  27032. }
  27033. }
  27034. static _catmullRomInterpolate(p0, p1, p2, p3, t, t2, t3) {
  27035. var v0 = (p2 - p0) * 0.5;
  27036. var v1 = (p3 - p1) * 0.5;
  27037. return (2 * (p1 - p2) + v0 + v1) * t3
  27038. + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
  27039. + v0 * t + p1;
  27040. }
  27041. static _cloneValue(value) {
  27042. var arraySlice = Array.prototype.slice;
  27043. if (Animation._isArrayLike(value)) {
  27044. var len = value.length;
  27045. if (Animation._isArrayLike(value[0])) {
  27046. var ret = [];
  27047. for (var i = 0; i < len; i++) {
  27048. ret.push(arraySlice.call(value[i]));
  27049. }
  27050. return ret;
  27051. } else {
  27052. return arraySlice.call(value);
  27053. }
  27054. } else {
  27055. return value;
  27056. }
  27057. }
  27058. static rgba2String(rgba) {
  27059. rgba[0] = Math.floor(rgba[0]);
  27060. rgba[1] = Math.floor(rgba[1]);
  27061. rgba[2] = Math.floor(rgba[2]);
  27062. return 'rgba(' + rgba.join(',') + ')';
  27063. }
  27064. }
  27065. /**
  27066. * @class LevelRenderer.Animation.Animator
  27067. */
  27068. class Animator {
  27069. /**
  27070. * @function LevelRenderer.Animation.Animator.prototype.animate
  27071. * @description 构造函数
  27072. * @param {Object} target - 目标对象。
  27073. * @param {Object} options - 动画参数选项。
  27074. * @param {boolean} [loop=false] - 是否循环播放动画。
  27075. * @param {function} [getterl] - 如果指定getter函数,会通过getter函数取属性值。
  27076. * @param {function} [setter] - 如果指定setter函数,会通过setter函数设置属性值。
  27077. */
  27078. constructor(target, loop, getter, setter) {
  27079. /**
  27080. * @member {Object} LevelRenderer.Animation.Animator.prototype._tracks
  27081. * @description _tracks。
  27082. */
  27083. this._tracks = {};
  27084. /**
  27085. * @member {Object} LevelRenderer.Animation.Animator.prototype._target
  27086. * @description _target。
  27087. */
  27088. this._target = target;
  27089. /**
  27090. * @member {boolean} LevelRenderer.Animation.Animator.prototype._loop
  27091. * @description _loop。
  27092. */
  27093. this._loop = loop || false;
  27094. /**
  27095. * @member {function} LevelRenderer.Animation.Animator.prototype._getter
  27096. * @description _getter。
  27097. */
  27098. this._getter = getter || _defaultGetter;
  27099. /**
  27100. * @member {function} LevelRenderer.Animation.Animator.prototype._setter
  27101. * @description _setter。
  27102. */
  27103. this._setter = setter || _defaultSetter;
  27104. /**
  27105. * @member {number} LevelRenderer.Animation.Animator.prototype._clipCount
  27106. * @description _clipCount。
  27107. */
  27108. this._clipCount = 0;
  27109. /**
  27110. * @member {number} LevelRenderer.Animation.Animator.prototype._delay
  27111. * @description _delay。
  27112. */
  27113. this._delay = 0;
  27114. /**
  27115. * @member {Array} LevelRenderer.Animation.Animator.prototype._doneList
  27116. * @description _doneList。
  27117. */
  27118. this._doneList = [];
  27119. /**
  27120. * @member {Array} LevelRenderer.Animation.Animator.prototype._onframeList
  27121. * @description _onframeList。
  27122. */
  27123. this._onframeList = [];
  27124. /**
  27125. * @member {Array} LevelRenderer.Animation.Animator.prototype._clipList
  27126. * @description _clipList。
  27127. */
  27128. this._clipList = [];
  27129. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Animator";
  27130. //Function
  27131. function _defaultGetter(target, key) {
  27132. return target[key];
  27133. }
  27134. function _defaultSetter(target, key, value) {
  27135. target[key] = value;
  27136. }
  27137. }
  27138. /**
  27139. * @function LevelRenderer.Animation.Animator.prototype.when
  27140. * @description 设置动画关键帧
  27141. * @param {number} time - 关键帧时间,单位是ms
  27142. * @param {Object} props - 关键帧的属性值,key-value表示
  27143. * @returns {LevelRenderer.Animation.Animator} Animator
  27144. */
  27145. when(time /* ms */, props) {
  27146. for (var propName in props) {
  27147. if (!this._tracks[propName]) {
  27148. this._tracks[propName] = [];
  27149. // If time is 0
  27150. // Then props is given initialize value
  27151. // Else
  27152. // Initialize value from current prop value
  27153. if (time !== 0) {
  27154. this._tracks[propName].push({
  27155. time: 0,
  27156. value: Animation._cloneValue(
  27157. this._getter(this._target, propName)
  27158. )
  27159. });
  27160. }
  27161. }
  27162. this._tracks[propName].push({
  27163. time: parseInt(time, 10),
  27164. value: props[propName]
  27165. });
  27166. }
  27167. return this;
  27168. }
  27169. /**
  27170. * @function LevelRenderer.Animation.Animator.prototype.during
  27171. * @description 添加动画每一帧的回调函数
  27172. * @param {RequestCallback} callback - 回调函数
  27173. * @returns {LevelRenderer.Animation.Animator} Animator
  27174. */
  27175. during(callback) {
  27176. this._onframeList.push(callback);
  27177. return this;
  27178. }
  27179. /**
  27180. * @function LevelRenderer.Animation.Animator.prototype.start
  27181. * @description 开始执行动画
  27182. * @param {(string|function)} easing - 动画缓动函数。详见:<{@link LevelRenderer.Animation.easing}>。
  27183. * @returns {LevelRenderer.Animation.Animator} Animator
  27184. */
  27185. start(easing) {
  27186. var self = this;
  27187. var setter = this._setter;
  27188. var getter = this._getter;
  27189. var onFrameListLen = self._onframeList.length;
  27190. var useSpline = easing === 'spline';
  27191. var ondestroy = function () {
  27192. self._clipCount--;
  27193. if (self._clipCount === 0) {
  27194. // Clear all tracks
  27195. self._tracks = {};
  27196. var len = self._doneList.length;
  27197. for (var i = 0; i < len; i++) {
  27198. self._doneList[i].call(self);
  27199. }
  27200. }
  27201. };
  27202. var createTrackClip = function (keyframes, propName) {
  27203. var trackLen = keyframes.length;
  27204. if (!trackLen) {
  27205. return;
  27206. }
  27207. // Guess data type
  27208. var firstVal = keyframes[0].value;
  27209. var isValueArray = Animation._isArrayLike(firstVal);
  27210. var isValueColor = false;
  27211. // For vertices morphing
  27212. var arrDim = (
  27213. isValueArray
  27214. && Animation._isArrayLike(firstVal[0])
  27215. )
  27216. ? 2 : 1;
  27217. // Sort keyframe as ascending
  27218. keyframes.sort(function (a, b) {
  27219. return a.time - b.time;
  27220. });
  27221. var trackMaxTime = keyframes[trackLen - 1].time;
  27222. // Percents of each keyframe
  27223. var kfPercents = [];
  27224. // Value of each keyframe
  27225. var kfValues = [];
  27226. for (let i = 0; i < trackLen; i++) {
  27227. kfPercents.push(keyframes[i].time / trackMaxTime);
  27228. // Assume value is a color when it is a string
  27229. var value = keyframes[i].value;
  27230. if (typeof(value) == 'string') {
  27231. value = SUtil_SUtil.Util_color.toArray(value);
  27232. if (value.length === 0) { // Invalid color
  27233. value[0] = value[1] = value[2] = 0;
  27234. value[3] = 1;
  27235. }
  27236. isValueColor = true;
  27237. }
  27238. kfValues.push(value);
  27239. }
  27240. // Cache the key of last frame to speed up when
  27241. // animation playback is sequency
  27242. var cacheKey = 0;
  27243. var cachePercent = 0;
  27244. var start;
  27245. var i;
  27246. var w;
  27247. var p0;
  27248. var p1;
  27249. var p2;
  27250. var p3;
  27251. if (isValueColor) {
  27252. var rgba = [0, 0, 0, 0];
  27253. }
  27254. var onframe = function (target, percent) {
  27255. // Find the range keyframes
  27256. // kf1-----kf2---------current--------kf3
  27257. // find kf2 and kf3 and do interpolation
  27258. if (percent < cachePercent) {
  27259. // Start from next key
  27260. start = Math.min(cacheKey + 1, trackLen - 1);
  27261. for (i = start; i >= 0; i--) {
  27262. if (kfPercents[i] <= percent) {
  27263. break;
  27264. }
  27265. }
  27266. i = Math.min(i, trackLen - 2);
  27267. } else {
  27268. for (i = cacheKey; i < trackLen; i++) {
  27269. if (kfPercents[i] > percent) {
  27270. break;
  27271. }
  27272. }
  27273. i = Math.min(i - 1, trackLen - 2);
  27274. }
  27275. cacheKey = i;
  27276. cachePercent = percent;
  27277. var range = (kfPercents[i + 1] - kfPercents[i]);
  27278. if (range === 0) {
  27279. return;
  27280. } else {
  27281. w = (percent - kfPercents[i]) / range;
  27282. }
  27283. if (useSpline) {
  27284. p1 = kfValues[i];
  27285. p0 = kfValues[i === 0 ? i : i - 1];
  27286. p2 = kfValues[i > trackLen - 2 ? trackLen - 1 : i + 1];
  27287. p3 = kfValues[i > trackLen - 3 ? trackLen - 1 : i + 2];
  27288. if (isValueArray) {
  27289. Animation._catmullRomInterpolateArray(
  27290. p0, p1, p2, p3, w, w * w, w * w * w,
  27291. getter(target, propName),
  27292. arrDim
  27293. );
  27294. } else {
  27295. let value;
  27296. if (isValueColor) {
  27297. // value = LevelRenderer.Animation._catmullRomInterpolateArray(
  27298. // p0, p1, p2, p3, w, w * w, w * w * w,
  27299. // rgba, 1
  27300. // );
  27301. value = Animation.rgba2String(rgba);
  27302. } else {
  27303. value = Animation._catmullRomInterpolate(
  27304. p0, p1, p2, p3, w, w * w, w * w * w
  27305. );
  27306. }
  27307. setter(
  27308. target,
  27309. propName,
  27310. value
  27311. );
  27312. }
  27313. } else {
  27314. if (isValueArray) {
  27315. Animation._interpolateArray(
  27316. kfValues[i], kfValues[i + 1], w,
  27317. getter(target, propName),
  27318. arrDim
  27319. );
  27320. } else {
  27321. let value;
  27322. if (isValueColor) {
  27323. Animation._interpolateArray(
  27324. kfValues[i], kfValues[i + 1], w,
  27325. rgba, 1
  27326. );
  27327. value = Animation.rgba2String(rgba);
  27328. } else {
  27329. value = Animation._interpolateNumber(kfValues[i], kfValues[i + 1], w);
  27330. }
  27331. setter(
  27332. target,
  27333. propName,
  27334. value
  27335. );
  27336. }
  27337. }
  27338. for (i = 0; i < onFrameListLen; i++) {
  27339. self._onframeList[i](target, percent);
  27340. }
  27341. };
  27342. var clip = new Clip({
  27343. target: self._target,
  27344. life: trackMaxTime,
  27345. loop: self._loop,
  27346. delay: self._delay,
  27347. onframe: onframe,
  27348. ondestroy: ondestroy
  27349. });
  27350. if (easing && easing !== 'spline') {
  27351. clip.easing = easing;
  27352. }
  27353. self._clipList.push(clip);
  27354. self._clipCount++;
  27355. self.animation.add(clip);
  27356. };
  27357. for (var propName in this._tracks) {
  27358. createTrackClip(this._tracks[propName], propName);
  27359. }
  27360. return this;
  27361. }
  27362. /**
  27363. * @function LevelRenderer.Animation.Animator.prototype.stop
  27364. * @description 停止动画
  27365. */
  27366. stop() {
  27367. for (var i = 0; i < this._clipList.length; i++) {
  27368. var clip = this._clipList[i];
  27369. this.animation.remove(clip);
  27370. }
  27371. this._clipList = [];
  27372. }
  27373. /**
  27374. * @function LevelRenderer.Animation.Animator.prototype.delay
  27375. * @description 设置动画延迟开始的时间
  27376. * @param {number} time - 时间,单位ms
  27377. * @returns {LevelRenderer.Animation.Animator} Animator
  27378. */
  27379. delay(time) {
  27380. this._delay = time;
  27381. return this;
  27382. }
  27383. /**
  27384. * @function LevelRenderer.Animation.Animator.prototype.done
  27385. * @description 添加动画结束的回调
  27386. * @param {function} cb - Function
  27387. * @returns {LevelRenderer.Animation.Animator} Animator
  27388. */
  27389. done(cb) {
  27390. if (cb) {
  27391. this._doneList.push(cb);
  27392. }
  27393. return this;
  27394. }
  27395. }
  27396. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Render.js
  27397. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27398. * This program are made available under the terms of the Apache License, Version 2.0
  27399. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27400. /**
  27401. * @private
  27402. * @class LevelRenderer.Render
  27403. * @category Visualization Theme
  27404. * @classdesc Render 接口类,对外可用的所有接口都在这里。内部使用非 get 接口统一返回 this 对象,支持链式调用。
  27405. * @param {string} id - 唯一标识。
  27406. * @param {HTMLElement} dom - Dom 对象。
  27407. */
  27408. class Render {
  27409. constructor(id, dom) {
  27410. /**
  27411. * @member {string} LevelRenderer.Render.prototype.id
  27412. * @description 唯一标识。
  27413. */
  27414. this.id = id;
  27415. /**
  27416. * @member {LevelRenderer.Storage} LevelRenderer.Render.prototype.storage
  27417. * @description 图形仓库对象。
  27418. */
  27419. this.storage = new Storage();
  27420. /**
  27421. * @member {LevelRenderer.Painter} LevelRenderer.Render.prototype.painter
  27422. * @description 绘制器对象。
  27423. *
  27424. */
  27425. this.painter = new Painter(dom, this.storage);
  27426. /**
  27427. * @member {LevelRenderer.Handler} LevelRenderer.Render.prototype.handler
  27428. * @description 事件处理对象。
  27429. *
  27430. */
  27431. this.handler = new Handler(dom, this.storage, this.painter);
  27432. /**
  27433. * @member {Array} LevelRenderer.Render.prototype.animatingElements
  27434. * @description 动画控制数组。
  27435. *
  27436. */
  27437. this.animatingElements = [];
  27438. /**
  27439. * @member {LevelRenderer.animation.Animation} LevelRenderer.Render.prototype.animation
  27440. * @description 动画对象。
  27441. *
  27442. */
  27443. this.animation = new Animation({
  27444. stage: {
  27445. update: Render.getFrameCallback(this)
  27446. }
  27447. });
  27448. /**
  27449. * @member {boolean} LevelRenderer.Render.prototype._needsRefreshNextFrame
  27450. * @description 是否需要刷新下一帧。
  27451. *
  27452. */
  27453. this._needsRefreshNextFrame = false;
  27454. this.animation.start();
  27455. this.CLASS_NAME = "SuperMap.LevelRenderer.Render";
  27456. }
  27457. /**
  27458. * @function LevelRenderer.Render.prototype.destory
  27459. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  27460. */
  27461. destroy() {
  27462. this.id = null;
  27463. this.storage = null;
  27464. this.painter = null;
  27465. this.handler = null;
  27466. this.animatingElements = null;
  27467. this.animation = null;
  27468. this._needsRefreshNextFrame = null;
  27469. }
  27470. /**
  27471. * @function LevelRenderer.Render.prototype.getId
  27472. * @description 获取实例唯一标识。
  27473. * @return {string} 实例唯一标识。
  27474. */
  27475. getId() {
  27476. return this.id;
  27477. }
  27478. /**
  27479. * @function LevelRenderer.Render.prototype.addShape
  27480. * @description 添加图形形状到根节点。
  27481. *
  27482. * @param {LevelRenderer.Shape} shape - 图形对象,可用属性全集,详见各 shape。
  27483. * @return {LevelRenderer.Render} this。
  27484. */
  27485. addShape(shape) {
  27486. this.storage.addRoot(shape);
  27487. return this;
  27488. }
  27489. /**
  27490. * @function LevelRenderer.Render.prototype.addGroup
  27491. * @description 添加组到根节点。
  27492. *
  27493. * (code)
  27494. * //添加组到根节点例子
  27495. * var render = new LevelRenderer.Render("Render",document.getElementById('lRendertest'));
  27496. * render.clear();
  27497. * var g = new LevelRenderer.Group();
  27498. * g.addChild(new LevelRenderer.Shape.Circle({
  27499. * style: {
  27500. * x: 100,
  27501. * y: 100,
  27502. * r: 20,
  27503. * brushType: 'fill'
  27504. * }
  27505. * }));
  27506. * render.addGroup(g);
  27507. * render.render();
  27508. * (end)
  27509. *
  27510. * @param {LevelRenderer.Group} group - 组对象。
  27511. * @return {LevelRenderer.Render} this。
  27512. */
  27513. addGroup(group) {
  27514. this.storage.addRoot(group);
  27515. return this;
  27516. }
  27517. /**
  27518. * @function LevelRenderer.Render.prototype.delShape
  27519. * @description 从根节点删除图形形状。
  27520. *
  27521. * @param {string} shapeId - 图形对象唯一标识。
  27522. * @return {LevelRenderer.Render} this。
  27523. */
  27524. delShape(shapeId) {
  27525. this.storage.delRoot(shapeId);
  27526. return this;
  27527. }
  27528. /**
  27529. * @function LevelRenderer.Render.prototype.delGroup
  27530. * @description 从根节点删除组。
  27531. *
  27532. * @param {string} groupId - 组对象唯一标识。
  27533. * @return {LevelRenderer.Render} this。
  27534. */
  27535. delGroup(groupId) {
  27536. this.storage.delRoot(groupId);
  27537. return this;
  27538. }
  27539. /**
  27540. * @function LevelRenderer.Render.prototype.modShape
  27541. * @description 修改图形形状。
  27542. *
  27543. * @param {string} shapeId - 图形对象唯一标识。
  27544. * @param {LevelRenderer.Shape} shape - 图形对象。
  27545. * @return {LevelRenderer.Render} this。
  27546. */
  27547. modShape(shapeId, shape) {
  27548. this.storage.mod(shapeId, shape);
  27549. return this;
  27550. }
  27551. /**
  27552. * @function LevelRenderer.Render.prototype.modGroup
  27553. * @description 修改组。
  27554. *
  27555. * @param {string} groupId - 组对象唯一标识。
  27556. * @param {LevelRenderer.Group} group - 组对象。
  27557. * @return {LevelRenderer.Render} this。
  27558. */
  27559. modGroup(groupId, group) {
  27560. this.storage.mod(groupId, group);
  27561. return this;
  27562. }
  27563. /**
  27564. * @function LevelRenderer.Render.prototype.modLayer
  27565. * @description 修改指定 zlevel 的绘制配置项。
  27566. *
  27567. * @param {string} zLevel - 组对象唯一标识。
  27568. * @param {Object} config - 配置对象。
  27569. * @param {string} clearColor - 每次清空画布的颜色。默认值:0。
  27570. * @param {noolean} motionBlur - 是否开启动态模糊。默认值:false。
  27571. * @param {number} lastFrameAlpha - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
  27572. * @param {Array.<number>} position - 层的平移。
  27573. * @param {Array.<number>} rotation - 层的旋转。
  27574. * @param {Array.<number>} scale - 层的缩放。
  27575. * @param {boolean} zoomable - 层是否支持鼠标缩放操作。默认值:false。
  27576. * @param {boolean} panable - 层是否支持鼠标平移操作。默认值:false。
  27577. * @return {LevelRenderer.Render} this。
  27578. */
  27579. modLayer(zLevel, config) {
  27580. this.painter.modLayer(zLevel, config);
  27581. return this;
  27582. }
  27583. /**
  27584. * @function LevelRenderer.Render.prototype.addHoverShape
  27585. * @description 添加额外高亮层显示,仅提供添加方法,每次刷新后高亮层图形均被清空。
  27586. *
  27587. * @param {LevelRenderer.Shape} shape - 图形对象。
  27588. * @return {LevelRenderer.Render} this。
  27589. */
  27590. addHoverShape(shape) {
  27591. this.storage.addHover(shape);
  27592. return this;
  27593. }
  27594. /**
  27595. * @function LevelRenderer.Render.prototype.render
  27596. * @description 渲染。
  27597. *
  27598. * @callback {function} callback - 渲染结束后回调函数。
  27599. * @return {LevelRenderer.Render} this。
  27600. */
  27601. render(callback) {
  27602. this.painter.render(callback);
  27603. this._needsRefreshNextFrame = false;
  27604. return this;
  27605. }
  27606. /**
  27607. * @function LevelRenderer.Render.prototype.refresh
  27608. * @description 视图更新。
  27609. *
  27610. * @callback {function} callback - 视图更新后回调函数。
  27611. * @return {LevelRenderer.Render} this。
  27612. */
  27613. refresh(callback) {
  27614. this.painter.refresh(callback);
  27615. this._needsRefreshNextFrame = false;
  27616. return this;
  27617. }
  27618. /**
  27619. * @function LevelRenderer.Render.prototype.refreshNextFrame
  27620. * @description 标记视图在浏览器下一帧需要绘制。
  27621. * @return {LevelRenderer.Render} this。
  27622. */
  27623. refreshNextFrame() {
  27624. this._needsRefreshNextFrame = true;
  27625. return this;
  27626. }
  27627. /**
  27628. * @function LevelRenderer.Render.prototype.refreshHover
  27629. * @description 绘制(视图更新)高亮层。
  27630. * @callback {function} callback - 视图更新后回调函数。
  27631. * @return {LevelRenderer.Render} this。
  27632. */
  27633. refreshHover(callback) {
  27634. this.painter.refreshHover(callback);
  27635. return this;
  27636. }
  27637. /**
  27638. * @function LevelRenderer.Render.prototype.refreshShapes
  27639. * @description 视图更新。
  27640. *
  27641. * @param {Array.<LevelRenderer.Shape>} shapeList - 需要更新的图形列表。
  27642. * @callback {function} callback - 视图更新后回调函数。
  27643. * @return {LevelRenderer.Render} this。
  27644. */
  27645. refreshShapes(shapeList, callback) {
  27646. this.painter.refreshShapes(shapeList, callback);
  27647. return this;
  27648. }
  27649. /**
  27650. * @function LevelRenderer.Render.prototype.resize
  27651. * @description 调整视图大小。
  27652. * @return {LevelRenderer.Render} this。
  27653. */
  27654. resize() {
  27655. this.painter.resize();
  27656. return this;
  27657. }
  27658. /**
  27659. * @function LevelRenderer.Render.prototype.animate
  27660. * @description 动画。
  27661. *
  27662. * @example
  27663. * zr.animate(circle.id, 'style', false)
  27664. * .when(1000, {x: 10} )
  27665. * .done(function(){ // Animation done })
  27666. * .start()
  27667. *
  27668. *
  27669. * @param {Array.<(LevelRenderer.Shape/LevelRenderer.Group)>} el - 动画对象。
  27670. * @param {string} path - 需要添加动画的属性获取路径,可以通过 a.b.c 来获取深层的属性。若传入对象为<LevelRenderer.Group>,path需为空字符串。
  27671. * @param {function} loop - 动画是否循环。
  27672. * @return {LevelRenderer.animation.Animator} Animator。
  27673. */
  27674. animate(el, path, loop) {
  27675. if (typeof(el) === 'string') {
  27676. el = this.storage.get(el);
  27677. }
  27678. if (el) {
  27679. var target;
  27680. if (path) {
  27681. var pathSplitted = path.split('.');
  27682. var prop = el;
  27683. for (var i = 0, l = pathSplitted.length; i < l; i++) {
  27684. if (!prop) {
  27685. continue;
  27686. }
  27687. prop = prop[pathSplitted[i]];
  27688. }
  27689. if (prop) {
  27690. target = prop;
  27691. }
  27692. } else {
  27693. target = el;
  27694. }
  27695. if (!target) {
  27696. SUtil_SUtil.Util_log(
  27697. 'Property "'
  27698. + path
  27699. + '" is not existed in element '
  27700. + el.id
  27701. );
  27702. return;
  27703. }
  27704. var animatingElements = this.animatingElements;
  27705. if (typeof el.__aniCount === 'undefined') {
  27706. // 正在进行的动画记数
  27707. el.__aniCount = 0;
  27708. }
  27709. if (el.__aniCount === 0) {
  27710. animatingElements.push(el);
  27711. }
  27712. el.__aniCount++;
  27713. return this.animation.animate(target, {loop: loop})
  27714. .done(function () {
  27715. el.__aniCount--;
  27716. if (el.__aniCount === 0) {
  27717. // 从animatingElements里移除
  27718. var idx = new levelRenderer_Util_Util().indexOf(animatingElements, el);
  27719. animatingElements.splice(idx, 1);
  27720. }
  27721. });
  27722. } else {
  27723. SUtil_SUtil.Util_log('Element not existed');
  27724. }
  27725. }
  27726. /**
  27727. * @function LevelRenderer.Render.prototype.clearAnimation
  27728. * @description 停止所有动画。
  27729. *
  27730. */
  27731. clearAnimation() {
  27732. this.animation.clear();
  27733. }
  27734. /**
  27735. * @function LevelRenderer.Render.prototype.getWidth
  27736. * @description 获取视图宽度。
  27737. * @return {number} 视图宽度。
  27738. */
  27739. getWidth() {
  27740. return this.painter.getWidth();
  27741. }
  27742. /**
  27743. * @function LevelRenderer.Render.prototype.getHeight
  27744. * @description 获取视图高度。
  27745. * @return {number} 视图高度。
  27746. */
  27747. getHeight() {
  27748. return this.painter.getHeight();
  27749. }
  27750. /**
  27751. * @function LevelRenderer.Render.prototype.toDataURL
  27752. * @description 图像导出。
  27753. *
  27754. * @param {string} type - 类型。
  27755. * @param {string} backgroundColor - 背景色,默认值:"#FFFFFF"。
  27756. * @param {string} args - 参数。
  27757. * @return {string} 图片的 Base64 url。
  27758. */
  27759. toDataURL(type, backgroundColor, args) {
  27760. return this.painter.toDataURL(type, backgroundColor, args);
  27761. }
  27762. /**
  27763. * @function LevelRenderer.Render.prototype.shapeToImage
  27764. * @description 将常规 shape 转成 image shape。
  27765. *
  27766. * @param {LevelRenderer.Shape} e - 图形。
  27767. * @param {number} width - 宽度。
  27768. * @param {number} height - 高度。
  27769. * @return {Object} image shape。
  27770. */
  27771. shapeToImage(e, width, height) {
  27772. var id = Util_Util.createUniqueID("SuperMap.LevelRenderer.ToImage_");
  27773. return this.painter.shapeToImage(id, e, width, height);
  27774. }
  27775. /**
  27776. * @function LevelRenderer.Render.prototype.on
  27777. * @description 事件绑定。
  27778. *
  27779. * @param {string} eventName - 事件名称。
  27780. * @param {function} eventHandler - 响应函数。
  27781. * @return {LevelRenderer.Render} this。
  27782. */
  27783. on(eventName, eventHandler) {
  27784. this.handler.on(eventName, eventHandler);
  27785. return this;
  27786. }
  27787. /**
  27788. * @function LevelRenderer.Render.prototype.un
  27789. * @description 事件解绑定,参数为空则解绑所有自定义事件。
  27790. *
  27791. * @param {string} eventName - 事件名称。
  27792. * @param {function} eventHandler - 响应函数。
  27793. * @return {LevelRenderer.Render} this。
  27794. */
  27795. un(eventName, eventHandler) {
  27796. this.handler.un(eventName, eventHandler);
  27797. return this;
  27798. }
  27799. /**
  27800. * @function LevelRenderer.Render.prototype.trigger
  27801. * @description 事件触发。
  27802. *
  27803. * @param {string} eventName - 事件名称,resize,hover,drag,etc。
  27804. * @param {event} event - event dom事件对象。
  27805. * @return {LevelRenderer.Render} this。
  27806. */
  27807. trigger(eventName, event) {
  27808. this.handler.trigger(eventName, event);
  27809. this.handler.dispatch(eventName, event);
  27810. return this;
  27811. }
  27812. /**
  27813. * @function LevelRenderer.Render.prototype.clear
  27814. * @description 清除当前 Render 下所有类图的数据和显示,clear 后 MVC 和已绑定事件均还存在在,Render 可用。
  27815. * @return {LevelRenderer.Render} this。
  27816. */
  27817. clear() {
  27818. this.storage.delRoot();
  27819. this.painter.clear();
  27820. return this;
  27821. }
  27822. /**
  27823. * @function LevelRenderer.Render.prototype.dispose
  27824. * @description 释放当前 Render 实例(删除包括 dom,数据、显示和事件绑定),dispose后 Render 不可用。
  27825. */
  27826. dispose() {
  27827. this.animation.stop();
  27828. this.clear();
  27829. this.storage.dispose();
  27830. this.painter.dispose();
  27831. this.handler.dispose();
  27832. this.animation = null;
  27833. this.animatingElements = null;
  27834. this.storage = null;
  27835. this.painter = null;
  27836. this.handler = null;
  27837. // 释放后告诉全局删除对自己的索引,没想到啥好方法
  27838. // zrender.delInstance(this.id);
  27839. }
  27840. // SMIC-方法扩展 - start
  27841. /**
  27842. * @function LevelRenderer.Render.prototype.updateHoverShapes
  27843. * @description 更新设置显示高亮图层。
  27844. *
  27845. * @param {Array.<LevelRenderer.Shape>} shapes - 图形数组。
  27846. * @return {LevelRenderer.Render} this。
  27847. */
  27848. updateHoverShapes(shapes) {
  27849. this.painter.updateHoverLayer(shapes);
  27850. return this;
  27851. }
  27852. /**
  27853. * @function LevelRenderer.Render.prototype.getAllShapes
  27854. * @description 获取所有图形。
  27855. * @return {Array.<LevelRenderer.Shape>} 图形数组。
  27856. */
  27857. getAllShapes() {
  27858. return this.storage._shapeList;
  27859. }
  27860. /**
  27861. * @function LevelRenderer.Render.prototype.clearAll
  27862. * @description 清除高亮和图形图层。
  27863. * @return {LevelRenderer.Render} this。
  27864. */
  27865. clearAll() {
  27866. this.clear();
  27867. this.painter.clearHover();
  27868. return this;
  27869. }
  27870. /**
  27871. * @function LevelRenderer.Render.prototype.getHoverOne
  27872. * @description 获取单个高亮图形,当前鼠标对应。
  27873. * @return {LevelRenderer.Shape} 高亮图形。
  27874. */
  27875. getHoverOne() {
  27876. return this.handler.getLastHoverOne();
  27877. }
  27878. static getFrameCallback(renderInstance) {
  27879. return function () {
  27880. var animatingElements = renderInstance.animatingElements;
  27881. //animatingElements instanceof Array 临时解决 destory 报错
  27882. if (animatingElements instanceof Array) {
  27883. for (var i = 0, l = animatingElements.length; i < l; i++) {
  27884. renderInstance.storage.mod(animatingElements[i].id);
  27885. }
  27886. if (animatingElements.length || renderInstance._needsRefreshNextFrame) {
  27887. renderInstance.refresh();
  27888. }
  27889. }
  27890. };
  27891. }
  27892. // SMIC-方法扩展 - end
  27893. }
  27894. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/LevelRenderer.js
  27895. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27896. * This program are made available under the terms of the Apache License, Version 2.0
  27897. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27898. /**
  27899. * @class LevelRenderer
  27900. * @deprecatedclass SuperMap.LevelRenderer
  27901. * @category Visualization Theme
  27902. * @classdesc LevelRenderer 渲染器
  27903. * @example
  27904. * //在渲染器上加上图形
  27905. * var levelRenderer = new LevelRenderer();
  27906. * var zr = levelRenderer.init(document.getElementById('lRendertest'));
  27907. * zr.clear();
  27908. * zr.addShape(new LevelRenderer.Shape.Circle({
  27909. * style:{
  27910. * x : 100,
  27911. * y : 100,
  27912. * r : 50,
  27913. * brushType: 'fill'
  27914. * }
  27915. * }));
  27916. * zr.render();
  27917. * @private
  27918. */
  27919. class LevelRenderer {
  27920. constructor() {
  27921. /**
  27922. * @member {Object} LevelRenderer.prototype._instances
  27923. * @description LevelRenderer 实例 map 索引
  27924. */
  27925. LevelRenderer._instances = {};
  27926. // 工具
  27927. LevelRenderer.Tool = {};
  27928. /**
  27929. * @member {string} LevelRenderer.prototype.version
  27930. * @description 版本。zRender(Baidu)的版本号
  27931. * 记录当前 LevelRenderer 是在 zRender 的那个版本上构建而来。
  27932. * 在每次完整评判和实施由 zRender(Baidu)升级带来的 LevelRenderer 升级后修改。
  27933. */
  27934. this.version = '2.0.4';
  27935. this.CLASS_NAME = "SuperMap.LevelRenderer";
  27936. }
  27937. /**
  27938. * @function LevelRenderer.prototype.destroy
  27939. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
  27940. */
  27941. destroy() {
  27942. this.dispose();
  27943. this.version = null;
  27944. }
  27945. /**
  27946. * @function LevelRenderer.prototype.init
  27947. * @description 创建 LevelRenderer 实例。
  27948. * @param {HTMLElement} dom - 绘图容器。
  27949. * @returns {LevelRenderer} LevelRenderer 实例。
  27950. */
  27951. init(dom) {
  27952. var zr = new Render(Util_Util.createUniqueID("LRenderer_"), dom);
  27953. LevelRenderer._instances[zr.id] = zr;
  27954. return zr;
  27955. }
  27956. /**
  27957. * @function LevelRenderer.prototype.dispose
  27958. * @description LevelRenderer 实例销毁。
  27959. * 可以通过 zrender.dispose(zr) 销毁指定 LevelRenderer.Render 实例。
  27960. * 也可以通过 zr.dispose() 直接销毁
  27961. * @param {LevelRenderer.Render} zr - ZRender对象,不传此参数则销毁全部。
  27962. * @returns {LevelRenderer} this。
  27963. */
  27964. dispose(zr) {
  27965. if (zr) {
  27966. zr.dispose();
  27967. this.delInstance(zr.id);
  27968. } else {
  27969. for (var key in LevelRenderer._instances) {
  27970. LevelRenderer._instances[key].dispose();
  27971. }
  27972. LevelRenderer._instances = {};
  27973. }
  27974. return this;
  27975. }
  27976. /**
  27977. * @function LevelRenderer.prototype.getInstance
  27978. * @description 获取 LevelRenderer.Render 实例。
  27979. * @param {string} id - ZRender对象索引。
  27980. * @returns {LevelRenderer.Render} LevelRenderer.Render 实例。
  27981. */
  27982. getInstance(id) {
  27983. return LevelRenderer._instances[id];
  27984. }
  27985. /**
  27986. * @function LevelRenderer.prototype.delInstance
  27987. * @description 删除 zrender 实例,LevelRenderer.Render 实例 dispose 时会调用,删除后 getInstance 则返回 undefined
  27988. * @param {string} id - ZRender对象索引。
  27989. * @param {string} id - LevelRenderer.Render 对象索引。
  27990. * @returns {LevelRenderer} this。
  27991. */
  27992. delInstance(id) {
  27993. delete LevelRenderer._instances[id];
  27994. return this;
  27995. }
  27996. }
  27997. ;// CONCATENATED MODULE: ./src/common/iServer/ServerFeature.js
  27998. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27999. * This program are made available under the terms of the Apache License, Version 2.0
  28000. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28001. /**
  28002. * @class ServerFeature
  28003. * @deprecatedclass SuperMap.ServerFeature
  28004. * @category iServer Data Feature
  28005. * @classdesc 服务端矢量要素类。该类描述了服务端返回的矢量要素的相关信息,包括字段和几何信息。
  28006. * @param {ServerGeometry} geometry - 矢量要素的几何信息。
  28007. * @param {Object} options - 参数。
  28008. * @param {Array.<string>} [options.fieldNames] - 矢量要素的属性字段名集合。
  28009. * @param {Array.<string>} [options.fieldValues] - 矢量要素的属性字段值集合。
  28010. * @usage
  28011. */
  28012. class ServerFeature {
  28013. constructor(options) {
  28014. /**
  28015. * @member {Array.<string>} [ServerFeature.prototype.fieldNames]
  28016. * @description 矢量要素的属性字段名集合。
  28017. */
  28018. this.fieldNames = null;
  28019. /**
  28020. * @member {Array.<string>} [ServerFeature.prototype.fieldValues]
  28021. * @description 矢量要素的属性字段值集合。
  28022. */
  28023. this.fieldValues = null;
  28024. /**
  28025. * @member {ServerGeometry} ServerFeature.prototype.geometry
  28026. * @description 矢量要素的几何信息。
  28027. */
  28028. this.geometry = null;
  28029. if (options) {
  28030. Util_Util.extend(this, options);
  28031. }
  28032. this.CLASS_NAME = "SuperMap.ServerFeature";
  28033. }
  28034. /**
  28035. * @function ServerFeature.prototype.destroy
  28036. * @description 释放资源,将引用资源的属性置空。
  28037. */
  28038. destroy() {
  28039. var me = this;
  28040. me.fieldNames = null;
  28041. me.fieldValues = null;
  28042. if (me.geometry) {
  28043. me.geometry.destroy();
  28044. me.geometry = null;
  28045. }
  28046. }
  28047. /**
  28048. * @function ServerFeature.prototype.toFeature
  28049. * @description 将服务端矢量要素 ServerFeature 转换为客户端矢量要素 Feature。
  28050. * @returns {Vector} 转换后的客户端矢量要素。
  28051. */
  28052. toFeature() {
  28053. var names, values, geo,
  28054. attr = {},
  28055. me = this,
  28056. feature;
  28057. names = me.fieldNames;
  28058. values = me.fieldValues;
  28059. for (var i in names) {
  28060. attr[names[i]] = values[i];
  28061. }
  28062. if (me.geometry) {
  28063. geo = me.geometry.toGeometry();
  28064. }
  28065. feature = new Vector(geo, attr);
  28066. if (me.geometry && me.geometry.id) {
  28067. feature.fid = me.geometry.id;
  28068. }
  28069. return feature;
  28070. }
  28071. /**
  28072. * @function ServerFeature.prototype.fromJson
  28073. * @description 将 JSON 对象表示服务端矢量要素转换为 ServerFeature。
  28074. * @param {Object} jsonObject - 要转换的 JSON 对象。
  28075. * @returns {ServerFeature} 转化后的 ServerFeature 对象。
  28076. */
  28077. static fromJson(jsonObject) {
  28078. var geo = null;
  28079. if (!jsonObject) {
  28080. return;
  28081. }
  28082. geo = jsonObject.geometry;
  28083. if (geo) {
  28084. geo = ServerGeometry.fromJson(geo);
  28085. }
  28086. return new ServerFeature({
  28087. fieldNames: jsonObject.fieldNames,
  28088. fieldValues: jsonObject.fieldValues,
  28089. geometry: geo
  28090. });
  28091. }
  28092. }
  28093. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/theme/ThemeLayer.js
  28094. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28095. * This program are made available under the terms of the Apache License, Version 2.0
  28096. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28097. /**
  28098. * @class ThemeLayer
  28099. * @category Visualization Theme
  28100. * @classdesc 专题图基类。
  28101. * @modulecategory Overlay
  28102. * @param {string} name - 专题图图层名。
  28103. * @param {Object} options -可选参数。
  28104. * @param {mapboxgl.Map} options.map - MapBoxGL Map 对象,将在下个版本弃用,请用 map.addLayer()方法添加图层。
  28105. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  28106. * @param {boolean} [options.loadWhileAnimating=true] - 是否实时重绘。
  28107. * @param {boolean} [options.visibility=true] - 图层是否可见。
  28108. * @param {number} [options.opacity=1] - 图层不透明度。
  28109. * @fires ThemeLayer#changelayer
  28110. * @fires ThemeLayer#featuresremoved
  28111. * @usage
  28112. */
  28113. class ThemeLayer_Theme {
  28114. constructor(name, opt_options) {
  28115. var options = opt_options ? opt_options : {};
  28116. /**
  28117. * @member {string} ThemeLayer.prototype.name
  28118. * @description 专题图图层名称。
  28119. */
  28120. this.name = name;
  28121. /**
  28122. * @member {string} [ThemeLayer.prototype.id]
  28123. * @description 专题图图层 ID。
  28124. */
  28125. this.id = options.id ? options.id : Util_Util.createUniqueID("themeLayer_");
  28126. /**
  28127. * @member {number} [ThemeLayer.prototype.opacity=1]
  28128. * @description 图层不透明度。
  28129. */
  28130. this.opacity = options.opacity ? options.opacity : 1;
  28131. /**
  28132. * @member {boolean} [ThemeLayer.prototype.visibility=true]
  28133. * @description 图层是否可见。
  28134. */
  28135. this.visibility = true;
  28136. /**
  28137. * @member {boolean} [ThemeLayer.prototype.loadWhileAnimating=true]
  28138. * @description 是否实时重绘。(当绘制大数据量要素的情况下会出现卡顿,建议把该参数设为 false)。
  28139. */
  28140. this.loadWhileAnimating = options.loadWhileAnimating === undefined ? true : options.loadWhileAnimating;
  28141. /**
  28142. * @member {mapboxgl.Map} ThemeLayer.prototype.map
  28143. * @description MapBoxGL Map 对象。
  28144. */
  28145. this.map = options.map ? options.map : null;
  28146. this.features = [];
  28147. this.TFEvents = [];
  28148. //todo 保留之前创建图层同时添加到图层的用法,在下个版本遗弃
  28149. if (this.map) {
  28150. this.map.addLayer(this);
  28151. }
  28152. }
  28153. /**
  28154. * @function ThemeLayer.prototype.onAdd
  28155. * @description 添加该图层。
  28156. */
  28157. onAdd(map) {
  28158. this.map = map;
  28159. this._createCanvasContainer();
  28160. //处理用户预先(在图层添加到 map 前)监听的事件
  28161. this.addTFEvents();
  28162. this.map.on('resize', this.resizeEvent.bind(this));
  28163. this.map.on('zoomstart', this.zoomStartEvent.bind(this));
  28164. this.map.on('zoomend', this.zoomEndEvent.bind(this));
  28165. this.map.on('rotatestart', this.rotateStartEvent.bind(this));
  28166. this.map.on('rotate', this.rotateEvent.bind(this));
  28167. this.map.on('rotateend', this.rotateEndEvent.bind(this));
  28168. this.map.on('dragend', this.dragEndEvent.bind(this));
  28169. this.map.on('movestart', this.moveStartEvent.bind(this));
  28170. this.map.on('move', this.moveEvent.bind(this));
  28171. this.map.on('moveend', this.moveEndEvent.bind(this));
  28172. this.map.on('remove', this.removeFromMap.bind(this));
  28173. this.refresh();
  28174. }
  28175. /**
  28176. * @function ThemeLayer.prototype.refresh
  28177. * @description 强制刷新当前热点显示,在图层热点数组发生变化后调用,更新显示。
  28178. */
  28179. refresh() {
  28180. if (this.features.length === 0) {
  28181. return;
  28182. }
  28183. if (this.map) {
  28184. this.redrawThematicFeatures(this.map.getBounds());
  28185. }
  28186. }
  28187. _createCanvasContainer() {
  28188. this.movingOffset = [0, 0];
  28189. this.mapContainer = this.map.getCanvasContainer();
  28190. this.div = document.createElement('div');
  28191. this.div.id = this.id;
  28192. this.div.style.position = 'absolute';
  28193. var container = this.map.getCanvasContainer();
  28194. var canvas = this.map.getCanvas();
  28195. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  28196. this.div.style.width = canvas.style.width;
  28197. this.div.style.height = canvas.style.height;
  28198. this.div.className = "themeLayer";
  28199. this.div.width = parseInt(canvas.width);
  28200. this.div.height = parseInt(canvas.height);
  28201. container.appendChild(this.div);
  28202. this.setOpacity(this.opacity);
  28203. this.levelRenderer = new LevelRenderer();
  28204. this.renderer = this.levelRenderer.init(this.div);
  28205. this.renderer.clear();
  28206. }
  28207. /**
  28208. * @function ThemeLayer.prototype.destroyFeatures
  28209. * @description 销毁要素。
  28210. * @param {Array.<FeatureVector>|FeatureVector} features - 将被销毁的要素。
  28211. */
  28212. destroyFeatures(features) {
  28213. var all = (features === undefined);
  28214. if (all) {
  28215. features = this.features;
  28216. }
  28217. if (features) {
  28218. this.removeFeatures(features);
  28219. if (!Array.isArray(features)) {
  28220. features = [features];
  28221. }
  28222. for (var i = features.length - 1; i >= 0; i--) {
  28223. features[i].destroy();
  28224. }
  28225. }
  28226. }
  28227. /**
  28228. * @function ThemeLayer.prototype.setVisibility
  28229. * @description 设置图层可见性。
  28230. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  28231. */
  28232. setVisibility(visibility) {
  28233. if (visibility !== this.visibility) {
  28234. this.visibility = visibility;
  28235. this.display(visibility);
  28236. this.redrawThematicFeatures(this.map.getBounds());
  28237. }
  28238. }
  28239. /**
  28240. * @function ThemeLayer.prototype.display
  28241. * @description 隐藏或者显示图层。(通过对 CSS 控制产生即时效果,重新渲染失效。)
  28242. * @param {boolean} [display] - 是否显示图层。
  28243. */
  28244. display(display) {
  28245. this.div.style.display = display ? "block" : "none";
  28246. }
  28247. /**
  28248. * @function ThemeLayer.prototype.setOpacity
  28249. * @description 设置图层的不透明度。
  28250. * @param {number} [opacity] - 不透明度,取值[0-1]之间。
  28251. */
  28252. setOpacity(opacity) {
  28253. if (opacity !== this.opacity) {
  28254. this.opacity = opacity;
  28255. var element = this.div;
  28256. Util_Util.modifyDOMElement(element, null, null, null,
  28257. null, null, null, opacity);
  28258. if (this.map !== null) {
  28259. /**
  28260. * @event ThemeLayer#changelayer
  28261. * @description 图层属性改变之后触发。
  28262. * @property {Object} layer - 图层。
  28263. * @property {string} property - 被改变的属性。
  28264. */
  28265. external_mapboxgl_default().Evented.prototype.fire('changelayer', {layer: this, property: "opacity"});
  28266. }
  28267. }
  28268. }
  28269. /**
  28270. * @function ThemeLayer.prototype.addFeatures
  28271. * @param {ThemeFeature|ServerFeature|GeoJSONObject} features - 待添加要素。
  28272. * @description 向专题图图层中添加数据
  28273. */
  28274. addFeatures(features) { // eslint-disable-line no-unused-vars
  28275. }
  28276. /**
  28277. * @function ThemeLayer.prototype.removeFeatures
  28278. * @param {(Array.<FeatureVector>|FeatureVector|Function)} features - 待删除 feature 的数组或用来过滤的回调函数。
  28279. * @description 删除专题图中的features。
  28280. * 参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature,
  28281. * 如果要删除的 features 数组中的元素过多,推荐使用 removeAllFeatures删除所有 feature后,再重新添加。这样效率会更高。
  28282. */
  28283. removeFeatures(features) {
  28284. var me = this;
  28285. if (!features) {
  28286. return;
  28287. }
  28288. if (features === me.features) {
  28289. return me.removeAllFeatures();
  28290. }
  28291. if (!Util_Util.isArray(features) && !(typeof features === 'function')) {
  28292. features = [features];
  28293. }
  28294. var featuresFailRemoved = [];
  28295. for (var i = 0; i < me.features.length; i++) {
  28296. var feature = me.features[i];
  28297. //如果我们传入的feature在features数组中没有的话,则不进行删除,
  28298. //并将其放入未删除的数组中。
  28299. if (features && typeof features === 'function') {
  28300. if (features(feature)) {
  28301. me.features.splice(i--, 1);
  28302. }
  28303. } else {
  28304. var findex = Util_Util.indexOf(features, feature);
  28305. if (findex === -1) {
  28306. featuresFailRemoved.push(feature);
  28307. } else {
  28308. me.features.splice(i--, 1);
  28309. }
  28310. }
  28311. }
  28312. var drawFeatures = [];
  28313. for (var hex = 0, len = this.features.length; hex < len; hex++) {
  28314. feature = this.features[hex];
  28315. drawFeatures.push(feature);
  28316. }
  28317. this.features = [];
  28318. this.addFeatures(drawFeatures);
  28319. //绘制专题要素
  28320. if (this.renderer) {
  28321. this.redrawThematicFeatures(this.map.getBounds());
  28322. }
  28323. var succeed = featuresFailRemoved.length == 0 ? true : false;
  28324. /**
  28325. * @event ThemeLayer#featuresremoved
  28326. * @description 要素删除之后触发。
  28327. * @property {Array.<FeatureVector>} features - 未被成功删除的要素。
  28328. * @property {boolean} succeed - 删除成功与否。
  28329. */
  28330. external_mapboxgl_default().Evented.prototype.fire("featuresremoved", {features: featuresFailRemoved, succeed: succeed});
  28331. }
  28332. /**
  28333. * @function ThemeLayer.prototype.removeAllFeatures
  28334. * @description 清除当前图层所有的矢量要素。
  28335. */
  28336. removeAllFeatures() {
  28337. if (this.renderer) {
  28338. this.renderer.clear();
  28339. }
  28340. this.features = [];
  28341. external_mapboxgl_default().Evented.prototype.fire('featuresremoved', {features: [], succeed: true});
  28342. }
  28343. /**
  28344. * @function ThemeLayer.prototype.getFeatures
  28345. * @description 查看当前图层中的有效数据。
  28346. * @param {Function} [filter] - 根据条件过滤要素的回调函数。
  28347. * @returns {Array.<FeatureVector>} 用户加入图层的有效数据。
  28348. */
  28349. getFeatures(filter) {
  28350. var len = this.features.length;
  28351. var clonedFeatures = [];
  28352. for (var i = 0; i < len; ++i) {
  28353. if (!filter || (filter && typeof filter === 'function' && filter(this.features[i]))) {
  28354. clonedFeatures.push(this.features[i]);
  28355. }
  28356. }
  28357. return clonedFeatures;
  28358. }
  28359. /**
  28360. * @function ThemeLayer.prototype.getFeatureBy
  28361. * @description 在专题图的要素中,获取第一个feature[property] === value的矢量要素。
  28362. * @param {string} property - 属性名称。
  28363. * @param {string} value - 属性值。
  28364. * @returns {FeatureVector} 矢量要素。
  28365. */
  28366. getFeatureBy(property, value) {
  28367. var feature = null;
  28368. for (var id in this.features) {
  28369. if (this.features[id][property] === value) {
  28370. feature = this.features[id];
  28371. break;
  28372. }
  28373. }
  28374. return feature;
  28375. }
  28376. /**
  28377. * @function ThemeLayer.prototype.getFeatureById
  28378. * @description 获取指定featureId的矢量要素。
  28379. * @param {string} featureId - 矢量要素的属性 ID。
  28380. * @returns {FeatureVector} 对应featureId的矢量要素,不存在则返回 null。
  28381. */
  28382. getFeatureById(featureId) {
  28383. return this.getFeatureBy('id', featureId);
  28384. }
  28385. /**
  28386. * @function ThemeLayer.prototype.getFeaturesByAttribute
  28387. * @description 通过属性的 key 值和 value 值,获取匹配的要素数组。
  28388. * @param {string} attrName - 属性的 key。
  28389. * @param {string} attrValue - 属性的 value。
  28390. * @returns {Array.<FeatureVector>} 要素数组。
  28391. */
  28392. getFeaturesByAttribute(attrName, attrValue) {
  28393. var feature,
  28394. foundFeatures = [];
  28395. for (var id in this.features) {
  28396. feature = this.features[id];
  28397. if (feature && feature.attributes) {
  28398. if (feature.attributes[attrName] === attrValue) {
  28399. foundFeatures.push(feature);
  28400. }
  28401. }
  28402. }
  28403. return foundFeatures;
  28404. }
  28405. /**
  28406. * @function ThemeLayer.prototype.redrawThematicFeatures
  28407. * @description 重绘专题要素。
  28408. * @param {mapboxgl.LngLatBounds} extent - 重绘的范围。
  28409. */
  28410. redrawThematicFeatures(extent) { // eslint-disable-line no-unused-vars
  28411. }
  28412. /**
  28413. * @function ThemeLayer.prototype.on
  28414. * @description 添加专题要素事件监听。
  28415. * @param {Event} event - 监听事件。
  28416. * @param {function} callback - 回调函数。
  28417. * @param {string} context - 信息。
  28418. */
  28419. on(event, callback, context) { // eslint-disable-line no-unused-vars
  28420. if (this.renderer) {
  28421. this.renderer.on(event, callback);
  28422. } else {
  28423. this.map.on(event, callback);
  28424. }
  28425. return this;
  28426. }
  28427. /**
  28428. * @function ThemeLayer.prototype.off
  28429. * @description 移除专题要素事件监听。
  28430. * @param {Event} event - 监听事件。
  28431. * @param {function} callback - 回调函数。
  28432. * @param {string} context - 信息。
  28433. */
  28434. off(event, callback, context) { // eslint-disable-line no-unused-vars
  28435. var me = this;
  28436. if (me.renderer) {
  28437. me.renderer.un(event, callback);
  28438. } else {
  28439. this.map.off(event, callback);
  28440. }
  28441. return this;
  28442. }
  28443. /**
  28444. * @function ThemeLayer.prototype.addTFEvents
  28445. * @description 将事件监听添加到图层。
  28446. * @private
  28447. */
  28448. addTFEvents() {
  28449. var tfEs = this.TFEvents;
  28450. var len = tfEs.length;
  28451. for (var i = 0; i < len; i++) {
  28452. this.renderer.on(tfEs[i][0], tfEs[i][1]);
  28453. }
  28454. }
  28455. /**
  28456. * @function ThemeLayer.prototype.getLocalXY
  28457. * @description 地理坐标转为像素坐标。
  28458. * @param {Object} [coordinate] - 坐标位置。
  28459. * @returns {Array} 像素坐标数组。
  28460. */
  28461. getLocalXY(coordinate) {
  28462. var pixelP, map = this.map;
  28463. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  28464. let tempPoint = map.project(new (external_mapboxgl_default()).LngLat(coordinate.x, coordinate.y));
  28465. pixelP = [tempPoint.x, tempPoint.y];
  28466. }
  28467. if (coordinate instanceof LonLat) {
  28468. let tempPoint = map.project(new (external_mapboxgl_default()).LngLat(coordinate.lon, coordinate.lat));
  28469. pixelP = [tempPoint.x, tempPoint.y];
  28470. }
  28471. return pixelP;
  28472. }
  28473. /**
  28474. * @function ThemeLayer.prototype.toiClientFeature
  28475. * @description 转为 iClient 要素。
  28476. * @param {(Array.<ServerFeature>|Array.<ThemeFeature>|Array.<GeoJSONObject>|ServerFeature|ThemeFeature|GeoJSONObject)} features - 待转要素。
  28477. * @returns {Array.<FeatureVector>} 转换后的 iClient 要素。
  28478. */
  28479. toiClientFeature(features) {
  28480. if (!Util_Util.isArray(features)) {
  28481. features = [features];
  28482. }
  28483. let featuresTemp = [];
  28484. for (let i = 0; i < features.length; i++) {
  28485. //ThemeFeature 类型
  28486. if (features[i] instanceof ThemeFeature) {
  28487. featuresTemp.push(features[i].toFeature());
  28488. } else if (features[i] instanceof Vector) {
  28489. // 若是 FeatureVector 直接返回
  28490. featuresTemp.push(features[i]);
  28491. } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
  28492. //GeoJSON 规范数据类型
  28493. let format = new GeoJSON();
  28494. featuresTemp = featuresTemp.concat(format.read(features[i]));
  28495. } else if (features[i].geometry && features[i].geometry.parts) {
  28496. //iServer服务器返回数据格式
  28497. featuresTemp.push(ServerFeature.fromJson(features[i]).toFeature());
  28498. } else {
  28499. throw new Error(`features's type is not be supported.`);
  28500. }
  28501. }
  28502. return featuresTemp;
  28503. }
  28504. /**
  28505. * @function ThemeLayer.prototype.toFeature
  28506. * @deprecated
  28507. * @description 转为 iClient 要素,该方法将被弃用,由 {@link ThemeLayer#toiClientFeature} 代替。
  28508. * @param {(Array.<ServerFeature>|Array.<ThemeFeature>|Array.<GeoJSONObject>|ServerFeature|ThemeFeature|GeoJSONObject)} features - 待转要素。
  28509. * @returns {FeatureVector} 转换后的 iClient 要素。
  28510. */
  28511. toFeature(features) {
  28512. return this.toiClientFeature(features);
  28513. }
  28514. moveEndEvent() {
  28515. if (this.loadWhileAnimating || !this.visibility) {
  28516. return;
  28517. }
  28518. this.div.style.transform = '';
  28519. this.redrawThematicFeatures(this.map.getBounds());
  28520. this._show();
  28521. }
  28522. moveStartEvent() {
  28523. if (this.loadWhileAnimating || !this.visibility) {
  28524. return;
  28525. }
  28526. this.startPitch = this.map.getPitch();
  28527. this.startBearing = this.map.getBearing();
  28528. var startMovePoint = this.map.project(new (external_mapboxgl_default()).LngLat(0, 0));
  28529. this.startMoveX = startMovePoint.x;
  28530. this.startMoveY = startMovePoint.y;
  28531. }
  28532. moveEvent() {
  28533. if (this.loadWhileAnimating || !this.visibility) {
  28534. this.redrawThematicFeatures(this.map.getBounds());
  28535. return;
  28536. }
  28537. if (this.rotating || this.zooming) {
  28538. return;
  28539. }
  28540. if (this.map.getPitch() !== 0) {
  28541. this._hide();
  28542. }
  28543. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  28544. var tPitch = this.map.getPitch() - this.startPitch;
  28545. var tBearing = -this.map.getBearing() + this.startBearing;
  28546. var endMovePoint = this.map.project(new (external_mapboxgl_default()).LngLat(0, 0));
  28547. var tMoveX = endMovePoint.x - this.startMoveX;
  28548. var tMoveY = endMovePoint.y - this.startMoveY;
  28549. this.div.style.transform = 'rotateX(' + tPitch + 'deg)' + ' rotateZ(' + tBearing + 'deg)' + ' translate3d(' + tMoveX + 'px, ' + tMoveY + 'px, 0px)';
  28550. }
  28551. zoomStartEvent() {
  28552. if (this.loadWhileAnimating || !this.visibility) {
  28553. return;
  28554. }
  28555. this.zooming = true;
  28556. this._hide();
  28557. }
  28558. zoomEndEvent() {
  28559. if (this.loadWhileAnimating || !this.visibility) {
  28560. return;
  28561. }
  28562. this.zooming = false;
  28563. this._show();
  28564. }
  28565. rotateStartEvent() {
  28566. if (this.loadWhileAnimating || !this.visibility) {
  28567. return;
  28568. }
  28569. this.rotating = true;
  28570. }
  28571. rotateEvent() {
  28572. if (this.loadWhileAnimating || !this.visibility) {
  28573. return;
  28574. }
  28575. if (this.map.getPitch() !== 0) {
  28576. this._hide();
  28577. }
  28578. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  28579. var tPitch = this.map.getPitch() - this.startPitch;
  28580. var tBearing = -this.map.getBearing() + this.startBearing;
  28581. this.div.style.transform = 'rotateX(' + tPitch + 'deg)' + ' rotateZ(' + tBearing + 'deg)'
  28582. }
  28583. rotateEndEvent() {
  28584. if (this.loadWhileAnimating || !this.visibility) {
  28585. return;
  28586. }
  28587. this.rotating = false;
  28588. this._show();
  28589. }
  28590. dragEndEvent() {
  28591. if (this.loadWhileAnimating || !this.visibility) {
  28592. return;
  28593. }
  28594. this._hide();
  28595. }
  28596. resizeEvent() {
  28597. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  28598. var canvas = this.map.getCanvas();
  28599. this.div.style.width = canvas.style.width;
  28600. this.div.style.height = canvas.style.height;
  28601. this.div.width = parseInt(canvas.width);
  28602. this.div.height = parseInt(canvas.height);
  28603. this.renderer.resize();
  28604. }
  28605. /**
  28606. * @function ThemeLayer.prototype.removeFromMap
  28607. * @description 移除图层。
  28608. */
  28609. removeFromMap() {
  28610. this.mapContainer.removeChild(this.div);
  28611. this.removeAllFeatures();
  28612. }
  28613. /**
  28614. * @function ThemeLayer.prototype.moveTo
  28615. * @description 将图层移动到某个图层之前。
  28616. * @param {string} layerID - 待插入的图层 ID。
  28617. * @param {boolean} [before=true] - 是否将本图层插入到图层 ID 为 layerID 的图层之前。
  28618. */
  28619. moveTo(layerID, before) {
  28620. const layer = document.getElementById(this.div.id);
  28621. before = before !== undefined ? before : true;
  28622. if (before) {
  28623. const beforeLayer = document.getElementById(layerID);
  28624. if (layer && beforeLayer) {
  28625. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  28626. }
  28627. return;
  28628. }
  28629. const nextLayer = document.getElementById(layerID);
  28630. if (layer) {
  28631. if (nextLayer.nextSibling) {
  28632. nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
  28633. return;
  28634. }
  28635. nextLayer.parentNode.appendChild(layer);
  28636. }
  28637. }
  28638. _hide() {
  28639. this.renderer.painter.root.style.display = 'none';
  28640. }
  28641. _show() {
  28642. this.renderer.painter.root.style.display = 'block';
  28643. }
  28644. }
  28645. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/GraphThemeLayer.js
  28646. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28647. * This program are made available under the terms of the Apache License, Version 2.0
  28648. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28649. /**
  28650. * @class GraphThemeLayer
  28651. * @category Visualization Theme
  28652. * @classdesc 统计专题图层类。
  28653. * @modulecategory Overlay
  28654. * @param {string} name - 图层名。
  28655. * @param {string} chartsType - 图表类别。
  28656. * @param {Object} options - 参数。
  28657. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  28658. * @param {boolean} [options.loadWhileAnimating=true] - 是否实时重绘。
  28659. * @param {mapboxgl.Map} options.map - MapBoxGL Map 对象。
  28660. * @param {number} [options.opacity=1] - 图层不透明度。
  28661. * @param {string} options.themeFields - 指定创建专题图字段。
  28662. * @param {boolean} [options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  28663. * @param {string} [options.chartsType] - 图表类型。目前可用:"Bar", "Line", "Pie"。
  28664. * @param {Object} options.chartsSetting - 符号 Circle 配置对象。
  28665. * @param {Array.<number>} options.chartsSetting.codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  28666. * @param {number} [options.chartsSetting.maxR] - 圆形的最大半径。
  28667. * @param {number} [options.chartsSetting.minR] - 圆形的最小半径。
  28668. * @param {string} options.chartsSetting.fillColor - 圆形的填充色,如:fillColor: "#FFB980"。
  28669. * @param {Object} options.chartsSetting.circleStyle - 圆形的基础 style,此参数控制圆形基础样式,优先级低于 circleStyleByFields 和 circleStyleByCodomain。
  28670. * @param {number} options.chartsSetting.decimalNumber - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。默认不对数据做小数位处理。
  28671. * @param {Object} options.chartsSetting.circleHoverStyle - 圆形 hover 状态时的样式,circleHoverAble 为 true 时有效。
  28672. * @param {boolean} [options.chartsSetting.circleHoverAble=true] - 是否允许圆形使用 hover 状态。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  28673. * @param {boolean} [options.chartsSetting.circleClickAble=true] - 是否允许圆形被点击。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  28674. * @extends {ThemeLayer}
  28675. * @fires GraphThemeLayer#beforefeaturesadded
  28676. * @usage
  28677. */
  28678. class Graph extends ThemeLayer_Theme {
  28679. constructor(name, chartsType, options) {
  28680. super(name, options);
  28681. this.chartsSetting = options.chartsSetting || {};
  28682. this.themeFields = options.themeFields || null;
  28683. this.overlayWeightField = options.overlayWeightField || null;
  28684. this.isOverLay = options.isOverLay === undefined ? true : options.isOverLay;
  28685. this.charts = options.charts || [];
  28686. this.cache = options.cache || {};
  28687. this.chartsType = chartsType;
  28688. }
  28689. /**
  28690. * @function GraphThemeLayer.prototype.setChartsType
  28691. * @description 设置图表类型,此函数可动态改变图表类型。在调用此函数前请通过 chartsSetting 为新类型的图表做相关配置。
  28692. * @param {string} [chartsType] - 图表类型。目前可用:"Bar", "Line", "Pie"。
  28693. */
  28694. setChartsType(chartsType) {
  28695. this.chartsType = chartsType;
  28696. this.redraw();
  28697. }
  28698. /**
  28699. * @function GraphThemeLayer.prototype.addFeatures
  28700. * @description 向专题图图层中添加数据,支持的 feature 类型为:iServer 返回的 feature JSON 对象。
  28701. * @param {ServerFeature} features - 待添加的要素。
  28702. */
  28703. addFeatures(features) {
  28704. /**
  28705. * @event GraphThemeLayer#beforefeaturesadded
  28706. * @description 要素添加之前触发。
  28707. * @property {ServerFeature} features - 要被添加的要素。
  28708. */
  28709. var ret = external_mapboxgl_default().Evented.prototype.fire('beforefeaturesadded', {
  28710. features: features
  28711. });
  28712. if (ret === false) {
  28713. return;
  28714. }
  28715. //转换 features 形式
  28716. this.features = this.toiClientFeature(features);
  28717. //绘制专题要素
  28718. if (this.renderer) {
  28719. this.redrawThematicFeatures(this.map.getBounds());
  28720. }
  28721. }
  28722. /**
  28723. * @function GraphThemeLayer.prototype.redrawThematicFeatures
  28724. * @description 重绘所有专题要素。
  28725. * 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。
  28726. * 地图漫游时调用此方法进行图层刷新。
  28727. */
  28728. redrawThematicFeatures() {
  28729. this.clearCache();
  28730. //清除当前所有可视元素
  28731. this.renderer.clearAll();
  28732. var features = this.features;
  28733. for (var i = 0, len = features.length; i < len; i++) {
  28734. var feature = features[i];
  28735. // // 要素范围判断
  28736. // var feaBounds = feature.geometry.getBounds();
  28737. // //剔除当前视图(地理)范围以外的数据
  28738. // if (extent) {
  28739. // var bounds = new Bounds(extent.getWest(), extent.getSouth(), extent.getEast(), extent.getNorth());
  28740. // // if (!bounds.intersectsBounds(feaBounds)) continue;
  28741. // }
  28742. var cache = this.cache;
  28743. // 用 feature id 做缓存标识
  28744. var cacheField = feature.id;
  28745. // 数据对应的图表是否已缓存,没缓存则重新创建图表
  28746. if (cache[cacheField]) {
  28747. continue;
  28748. }
  28749. cache[cacheField] = cacheField;
  28750. var chart = this.createThematicFeature(feature);
  28751. // 压盖处理权重值
  28752. if (chart && this.overlayWeightField) {
  28753. if (feature.attributes[this.overlayWeightField] && !isNaN(feature.attributes[this.overlayWeightField])) {
  28754. chart["__overlayWeight"] = feature.attributes[this.overlayWeightField];
  28755. }
  28756. }
  28757. if (chart) {
  28758. this.charts.push(chart);
  28759. }
  28760. }
  28761. this.drawCharts();
  28762. }
  28763. /**
  28764. * @function GraphThemeLayer.prototype.createThematicFeature
  28765. * @description 向专题图图层中添加数据, 支持的 feature 类型为:iServer 返回的 feature json 对象。
  28766. * @param {Object} feature - 待添加的要素。
  28767. *
  28768. */
  28769. createThematicFeature(feature) {
  28770. var thematicFeature;
  28771. // 检查图表创建条件并创建图形
  28772. if (Theme[this.chartsType] && this.themeFields && this.chartsSetting) {
  28773. thematicFeature = new Theme[this.chartsType](feature, this, this.themeFields, this.chartsSetting);
  28774. }
  28775. // thematicFeature 是否创建成功
  28776. if (!thematicFeature) {
  28777. return false;
  28778. }
  28779. // 对专题要素执行图形装载
  28780. thematicFeature.assembleShapes();
  28781. return thematicFeature;
  28782. }
  28783. /**
  28784. * @function GraphThemeLayer.prototype.drawCharts
  28785. * @description 绘制图表。包含压盖处理。
  28786. *
  28787. */
  28788. drawCharts() {
  28789. // 判断 rendere r就绪
  28790. if (!this.renderer) {
  28791. return;
  28792. }
  28793. var charts = this.charts;
  28794. // 图表权重值处理des
  28795. if (this.overlayWeightField) {
  28796. charts.sort(function (cs, ce) {
  28797. if (typeof (cs["__overlayWeight"]) == "undefined" && typeof (ce["__overlayWeight"]) == "undefined") {
  28798. return 0;
  28799. } else if (typeof (cs["__overlayWeight"]) != "undefined" && typeof (ce["__overlayWeight"]) == "undefined") {
  28800. return -1;
  28801. } else if (typeof (cs["__overlayWeight"]) == "undefined" && typeof (ce["__overlayWeight"]) != "undefined") {
  28802. return 1;
  28803. } else if (typeof (cs["__overlayWeight"]) != "undefined" && typeof (ce["__overlayWeight"]) != "undefined") {
  28804. if (parseFloat(cs["__overlayWeight"]) < parseFloat(ce["__overlayWeight"])) {
  28805. return 1;
  28806. } else {
  28807. return -1;
  28808. }
  28809. }
  28810. return 0;
  28811. });
  28812. }
  28813. // 不进行避让
  28814. if (!this.isOverLay) {
  28815. for (var m = 0, len_m = charts.length; m < len_m; m++) {
  28816. var chart_m = charts[m];
  28817. // 图形参考位置 (reSetLocation 会更新 chartBounds)
  28818. var shapeROP_m = chart_m.resetLocation();
  28819. // 添加图形
  28820. var shapes_m = chart_m.shapes;
  28821. for (var n = 0, slen_n = shapes_m.length; n < slen_n; n++) {
  28822. shapes_m[n].refOriginalPosition = shapeROP_m;
  28823. this.renderer.addShape(shapes_m[n]);
  28824. }
  28825. }
  28826. } else {
  28827. // 压盖判断所需 chartsBounds 集合
  28828. var chartsBounds = [];
  28829. //var extent = this.map.getBounds();
  28830. //var mapBounds = new Bounds(extent.getWest(), extent.getSouth(), extent.getEast(), extent.getNorth());
  28831. // 获取地图像素 bounds
  28832. //var mapPxLT = this.getLocalXY(new LonLat(mapBounds.left, mapBounds.top));
  28833. //var mapPxRB = this.getLocalXY(new LonLat(mapBounds.right, mapBounds.bottom));
  28834. //var mBounds = new Bounds(mapPxLT[0], mapPxRB[1], mapPxRB[0], mapPxLT[1]);
  28835. // 压盖处理 & 添加图形
  28836. for (let i = 0, len = charts.length; i < len; i++) {
  28837. var chart = charts[i];
  28838. // 图形参考位置 (reSetLocation 会更新 chartBounds)
  28839. var shapeROP = chart.resetLocation();
  28840. // 图表框
  28841. var cbs = chart.chartBounds;
  28842. var cBounds = [{
  28843. "x": cbs.left,
  28844. "y": cbs.top
  28845. }, {
  28846. "x": cbs.left,
  28847. "y": cbs.bottom
  28848. }, {
  28849. "x": cbs.right,
  28850. "y": cbs.bottom
  28851. }, {
  28852. "x": cbs.right,
  28853. "y": cbs.top
  28854. }, {
  28855. "x": cbs.left,
  28856. "y": cbs.top
  28857. }];
  28858. // // 地图范围外不绘制
  28859. // if (mBounds) {
  28860. // // if (!this.isChartInMap(mBounds, cBounds)) continue;
  28861. // }
  28862. // 是否压盖
  28863. var isOL = false;
  28864. if (i !== 0) {
  28865. for (let j = 0; j < chartsBounds.length; j++) {
  28866. //压盖判断
  28867. if (this.isQuadrilateralOverLap(cBounds, chartsBounds[j])) {
  28868. isOL = true;
  28869. break;
  28870. }
  28871. }
  28872. }
  28873. if (isOL) {
  28874. continue;
  28875. } else {
  28876. chartsBounds.push(cBounds);
  28877. }
  28878. // 添加图形
  28879. var shapes = chart.shapes;
  28880. for (let j = 0, slen = shapes.length; j < slen; j++) {
  28881. shapes[j].refOriginalPosition = shapeROP;
  28882. this.renderer.addShape(shapes[j]);
  28883. }
  28884. }
  28885. }
  28886. // 绘制图形
  28887. this.renderer.render();
  28888. }
  28889. /**
  28890. * @function GraphThemeLayer.prototype.getShapesByFeatureID
  28891. * @description 通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
  28892. * @param {number} featureID - 要素 ID。
  28893. */
  28894. getShapesByFeatureID(featureID) {
  28895. var list = [];
  28896. var shapeList = this.renderer.getAllShapes();
  28897. if (!featureID) {
  28898. return shapeList
  28899. }
  28900. for (var i = 0, len = shapeList.length; i < len; i++) {
  28901. var si = shapeList[i];
  28902. if (si.refDataID && featureID === si.refDataID) {
  28903. list.push(si);
  28904. }
  28905. }
  28906. return list;
  28907. }
  28908. /**
  28909. * @function GraphThemeLayer.prototype.isQuadrilateralOverLap
  28910. * @description 判断两个四边形是否有压盖。
  28911. * @param {Array.<Object>} quadrilateral - 四边形节点数组。
  28912. * @param {Array.<Object>} quadrilateral2 - 第二个四边形节点数组。
  28913. */
  28914. isQuadrilateralOverLap(quadrilateral, quadrilateral2) {
  28915. var quadLen = quadrilateral.length,
  28916. quad2Len = quadrilateral2.length;
  28917. if (quadLen !== 5 || quad2Len !== 5) {
  28918. return null;
  28919. } //不是四边形
  28920. var OverLap = false;
  28921. //如果两四边形互不包含对方的节点,则两个四边形不相交
  28922. for (let i = 0; i < quadLen; i++) {
  28923. if (this.isPointInPoly(quadrilateral[i], quadrilateral2)) {
  28924. OverLap = true;
  28925. break;
  28926. }
  28927. }
  28928. for (let i = 0; i < quad2Len; i++) {
  28929. if (this.isPointInPoly(quadrilateral2[i], quadrilateral)) {
  28930. OverLap = true;
  28931. break;
  28932. }
  28933. }
  28934. //加上两矩形十字相交的情况
  28935. for (let i = 0; i < quadLen - 1; i++) {
  28936. if (OverLap) {
  28937. break;
  28938. }
  28939. for (let j = 0; j < quad2Len - 1; j++) {
  28940. var isLineIn = Util_Util.lineIntersection(quadrilateral[i], quadrilateral[i + 1], quadrilateral2[j], quadrilateral2[j + 1]);
  28941. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  28942. OverLap = true;
  28943. break;
  28944. }
  28945. }
  28946. }
  28947. return OverLap;
  28948. }
  28949. /**
  28950. * @function GraphThemeLayer.prototype.isPointInPoly
  28951. * @description 判断一个点是否在多边形里面(射线法)。
  28952. * @param {Object} pt - 需要判定的点对象,该对象含有属性 x (横坐标),属性 y (纵坐标)。
  28953. * @param {Array.<Object>} poly - 多边形节点数组。
  28954. */
  28955. isPointInPoly(pt, poly) {
  28956. for (var isIn = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
  28957. ((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y)) &&
  28958. (pt.x < (poly[j].x - poly[i].x) * (pt.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x) &&
  28959. (isIn = !isIn);
  28960. }
  28961. return isIn;
  28962. }
  28963. /**
  28964. * @function GraphThemeLayer.prototype.isChartInMap
  28965. * @description 判断图表是否在地图里。
  28966. * @param {Bounds} mapPxBounds - 地图像素范围。
  28967. * @param {Array.<Object>} chartPxBounds - 图表范围的四边形节点数组。
  28968. */
  28969. isChartInMap(mapPxBounds, chartPxBounds) {
  28970. var mb = mapPxBounds;
  28971. var isIn = false;
  28972. for (var i = 0, len = chartPxBounds.length; i < len; i++) {
  28973. var cb = chartPxBounds[i];
  28974. if (cb.x >= mb.left && cb.x <= mb.right && cb.y >= mb.top && cb.y <= mb.bottom) {
  28975. isIn = true;
  28976. break;
  28977. }
  28978. }
  28979. return isIn;
  28980. }
  28981. /**
  28982. * @function GraphThemeLayer.prototype.clearCache
  28983. * @description 清除缓存。
  28984. */
  28985. clearCache() {
  28986. this.cache = {};
  28987. this.charts = [];
  28988. }
  28989. /**
  28990. * @function GraphThemeLayer.prototype.removeFeatures
  28991. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature。
  28992. * @param {Array.<FeatureVector>|FeatureVector|Function} features - 要删除的要素。
  28993. */
  28994. removeFeatures(features) {
  28995. this.clearCache();
  28996. super.removeFeatures(features);
  28997. }
  28998. /**
  28999. * @function GraphThemeLayer.prototype.removeAllFeatures
  29000. * @description 移除所有的要素。
  29001. */
  29002. removeAllFeatures() {
  29003. this.clearCache();
  29004. super.removeAllFeatures();
  29005. }
  29006. /**
  29007. * @function GraphThemeLayer.prototype.redraw
  29008. * @description 重绘该图层。
  29009. */
  29010. redraw() {
  29011. this.clearCache();
  29012. if (this.renderer) {
  29013. this.redrawThematicFeatures(this.map.getBounds());
  29014. return true;
  29015. }
  29016. return false
  29017. }
  29018. /**
  29019. * @function GraphThemeLayer.prototype.clear
  29020. * @description 清除的内容包括数据(features) 、专题要素、缓存。
  29021. */
  29022. clear() {
  29023. if (this.renderer) {
  29024. this.renderer.clearAll();
  29025. this.renderer.refresh();
  29026. }
  29027. this.removeAllFeatures();
  29028. this.clearCache();
  29029. }
  29030. }
  29031. ;// CONCATENATED MODULE: ./src/common/overlay/feature/ShapeParameters.js
  29032. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29033. * This program are made available under the terms of the Apache License, Version 2.0
  29034. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29035. /**
  29036. * @class ShapeParameters
  29037. * @aliasclass Feature.ShapeParameters
  29038. * @deprecatedclass SuperMap.Feature.ShapeParameters
  29039. * @category Visualization Theme
  29040. * @classdesc 图形参数基类
  29041. * @usage
  29042. */
  29043. class ShapeParameters {
  29044. constructor() {
  29045. /**
  29046. * @member {Array.<number>} [ShapeParameters.prototype.refOriginalPosition=[0,0]]
  29047. * @description 图形参考原点位置,图形的参考中心位置。
  29048. * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  29049. * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
  29050. * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
  29051. * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
  29052. * 图形(Shape)的所有位置相关属性都是以 refOriginalPosition 为参考中心,
  29053. * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
  29054. * refOriginalPosition 的值为 [0, 0] 时,图形的位置信息才是 canvas 绝对位置。
  29055. * 图形的位置信息通常有:style.pointList,style.x,style.y。
  29056. */
  29057. this.refOriginalPosition = [0, 0];
  29058. /**
  29059. * @member {string} ShapeParameters.prototype.refDataID
  29060. * @description 图形所关联数据的 ID(<{@link FeatureVector}> 的 ID)。
  29061. */
  29062. this.refDataID = null;
  29063. /**
  29064. * @member {boolean} ShapeParameters.prototype.isHoverByRefDataID
  29065. * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
  29066. */
  29067. this.isHoverByRefDataID = false;
  29068. /**
  29069. * @member {string} ShapeParameters.prototype.refDataHoverGroup
  29070. * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
  29071. * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
  29072. */
  29073. this.refDataHoverGroup = null;
  29074. /**
  29075. * @member {Object} ShapeParameters.prototype.dataInfo
  29076. * @description 图形携带的附加数据。
  29077. */
  29078. this.dataInfo = null;
  29079. /**
  29080. * @member {boolean} ShapeParameters.prototype.clickable
  29081. * @description 是否可点击。
  29082. */
  29083. this.clickable = true;
  29084. /**
  29085. * @member {boolean} ShapeParameters.prototype.hoverable
  29086. * @description 是否可点击。
  29087. */
  29088. this.hoverable = true;
  29089. /**
  29090. * @member {Object} ShapeParameters.prototype.style
  29091. * @description 图形样式对象,可设样式属性在子类中确定。
  29092. */
  29093. this.style = null;
  29094. /**
  29095. * @member {Object} ShapeParameters.prototype.highlightStyle
  29096. * @description 高亮样式对象,可设样式属性与 style 的可设样式属性相同。
  29097. */
  29098. this.highlightStyle = {};
  29099. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters";
  29100. }
  29101. /**
  29102. * @function ShapeParameters.prototype.destroy
  29103. * @description 销毁对象。
  29104. */
  29105. destroy() {
  29106. this.refOriginalPosition = null;
  29107. this.refDataID = null;
  29108. this.isHoverByRefDataID = null;
  29109. this.refDataHoverGroup = null;
  29110. this.dataInfo = null;
  29111. this.clickable = null;
  29112. this.hoverable = null;
  29113. this.style = null;
  29114. this.highlightStyle = null;
  29115. }
  29116. }
  29117. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Point.js
  29118. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29119. * This program are made available under the terms of the Apache License, Version 2.0
  29120. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29121. /**
  29122. * @class ShapeParametersPoint
  29123. * @aliasclass Feature.ShapeParameters.Point
  29124. * @deprecatedclass SuperMap.Feature.ShapeParameters.Point
  29125. * @category Visualization Theme
  29126. * @classdesc 点参数对象。
  29127. * @extends {ShapeParameters}
  29128. * @param {number} x - 点 x 坐标。
  29129. * @param {number} y - 点 y 坐标。
  29130. * @usage
  29131. */
  29132. class Point_Point extends ShapeParameters {
  29133. constructor(x, y) {
  29134. super(x, y);
  29135. /**
  29136. * @member {number} ShapeParametersPoint.prototype.x
  29137. * @description 点 x 坐标。
  29138. */
  29139. this.x = !isNaN(x) ? x : 0;
  29140. /**
  29141. * @member {number} ShapeParametersPoint.prototype.y
  29142. * @description 点 y 坐标。
  29143. */
  29144. this.y = !isNaN(y) ? y : 0;
  29145. /**
  29146. * @member {number} ShapeParametersPoint.prototype.r
  29147. * @description 点的半径。
  29148. */
  29149. this.r = 6;
  29150. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Point";
  29151. }
  29152. /**
  29153. * @function ShapeParametersPoint.prototype.destroy
  29154. * @description 销毁对象。
  29155. */
  29156. destroy() {
  29157. this.x = null;
  29158. this.y = null;
  29159. this.r = null;
  29160. super.destroy();
  29161. }
  29162. }
  29163. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Line.js
  29164. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29165. * This program are made available under the terms of the Apache License, Version 2.0
  29166. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29167. /**
  29168. * @class ShapeParametersLine
  29169. * @aliasclass Feature.ShapeParameters.Line
  29170. * @deprecatedclass SuperMap.Feature.ShapeParameters.Line
  29171. * @category Visualization Theme
  29172. * @classdesc 线参数对象。
  29173. * @extends {ShapeParameters}
  29174. * @param {Array} pointList - 线要素节点数组,二维数组。
  29175. * @usage
  29176. */
  29177. class Line_Line extends ShapeParameters {
  29178. constructor(pointList) {
  29179. super(pointList);
  29180. /**
  29181. * @member {Array} ShapeParametersLine.prototype.pointList
  29182. * @description 线要素节点数组,二维数组。
  29183. * 数组形如:
  29184. * (start code)
  29185. * [
  29186. * [10, 20], //节点
  29187. * [30, 40],
  29188. * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
  29189. * ]
  29190. * (end)
  29191. */
  29192. this.pointList = pointList;
  29193. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Line";
  29194. }
  29195. /**
  29196. * @function ShapeParametersLine.prototype.destroy
  29197. * @description 销毁对象。
  29198. */
  29199. destroy() {
  29200. this.pointList = null;
  29201. super.destroy();
  29202. }
  29203. }
  29204. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Polygon.js
  29205. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29206. * This program are made available under the terms of the Apache License, Version 2.0
  29207. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29208. /**
  29209. * @class ShapeParametersPolygon
  29210. * @aliasclass Feature.ShapeParameters.Polygon
  29211. * @deprecatedclass SuperMap.Feature.ShapeParameters.Polygon
  29212. * @category Visualization Theme
  29213. * @classdesc 面参数对象。
  29214. * @extends {ShapeParameters}
  29215. * @param {Array} pointList - 横坐标。
  29216. * @usage
  29217. */
  29218. class feature_Polygon_Polygon extends ShapeParameters {
  29219. constructor(pointList) {
  29220. super(pointList);
  29221. /**
  29222. * @member {Array} ShapeParametersPolygon.prototype.pointList
  29223. * @description 面要素节点数组,二维数组。
  29224. * 数组形如:
  29225. * (start code)
  29226. * [
  29227. * [10, 20], //节点
  29228. * [30, 40],
  29229. * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
  29230. * ]
  29231. * (end)
  29232. */
  29233. this.pointList = pointList;
  29234. /**
  29235. * @member {Array} ShapeParametersPolygon.prototype.holePolygonPointLists
  29236. * @description 岛洞面多边形顶点数组(三维数组)
  29237. */
  29238. this.holePolygonPointLists = null;
  29239. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Polygon";
  29240. }
  29241. /**
  29242. * @function ShapeParametersPolygon.prototype.destroy
  29243. * @description 销毁对象。
  29244. */
  29245. destroy() {
  29246. this.pointList = null;
  29247. this.holePolygonPointLists = null;
  29248. super.destroy();
  29249. }
  29250. }
  29251. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Rectangle.js
  29252. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29253. * This program are made available under the terms of the Apache License, Version 2.0
  29254. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29255. /**
  29256. * @class ShapeParametersRectangle
  29257. * @aliasclass Feature.ShapeParameters.Rectangle
  29258. * @deprecatedclass SuperMap.Feature.ShapeParameters.Rectangle
  29259. * @category Visualization Theme
  29260. * @classdesc 矩形参数对象。
  29261. * @extends {ShapeParameters}
  29262. * @param {number} x - 矩形 x 坐标。
  29263. * @param {number} y - 矩形 y 坐标。
  29264. * @param {number} width - 矩形 width 宽度。
  29265. * @param {number} height - 矩形 height 高度。
  29266. * @usage
  29267. */
  29268. class Rectangle_Rectangle extends ShapeParameters {
  29269. constructor(x, y, width, height) {
  29270. super(x, y, width, height);
  29271. /**
  29272. * @member {number} ShapeParametersRectangle.prototype.x
  29273. * @description 左上角 x 坐标。
  29274. */
  29275. this.x = !isNaN(x) ? x : 0;
  29276. /**
  29277. * @member {number} ShapeParametersRectangle.prototype.y
  29278. * @description 左上角 y 坐标。
  29279. */
  29280. this.y = !isNaN(x) ? y : 0;
  29281. /**
  29282. * @member {number} ShapeParametersRectangle.prototype.width
  29283. * @description 宽度。
  29284. */
  29285. this.width = !isNaN(width) ? width : 0;
  29286. /**
  29287. * @member {number} ShapeParametersRectangle.prototype.height
  29288. * @description 高度。
  29289. */
  29290. this.height = !isNaN(height) ? height : 0;
  29291. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Rectangle";
  29292. }
  29293. /**
  29294. * @function ShapeParametersRectangle.prototype.destroy
  29295. * @description 销毁对象。
  29296. */
  29297. destroy() {
  29298. this.x = null;
  29299. this.y = null;
  29300. this.width = null;
  29301. this.height = null;
  29302. super.destroy();
  29303. }
  29304. }
  29305. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Sector.js
  29306. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29307. * This program are made available under the terms of the Apache License, Version 2.0
  29308. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29309. /**
  29310. * @class ShapeParametersSector
  29311. * @aliasclass Feature.ShapeParameters.Sector
  29312. * @deprecatedclass SuperMap.Feature.ShapeParameters.Sector
  29313. * @category Visualization Theme
  29314. * @classdesc 扇形参数对象。
  29315. * @extends {ShapeParameters}
  29316. * @param {number} x - 圆心 x 坐标。
  29317. * @param {number} y - 圆心 y 坐标。
  29318. * @param {number} r - 外圆半径。
  29319. * @param {number} startAngle - 起始角度。取值范围[0, 360)。
  29320. * @param {number} endAngle - 结束角度。取值范围(0, 360]。
  29321. * @param {number} [r0=0] - 内圆半径,指定后将出现内弧,同时扇边长度为'r - r0'。取值范围[0, r)。
  29322. * @usage
  29323. */
  29324. class Sector extends ShapeParameters {
  29325. constructor(x, y, r, startAngle, endAngle, r0, clockWise) {
  29326. super(x, y, r, startAngle, endAngle, r0, clockWise);
  29327. /**
  29328. * @member {number} ShapeParametersSector.prototype.x
  29329. * @description 圆心 x 坐标。
  29330. */
  29331. this.x = !isNaN(x) ? x : 0;
  29332. /**
  29333. * @member {number} ShapeParametersSector.prototype.Y
  29334. * @description 圆心 Y 坐标。
  29335. */
  29336. this.y = !isNaN(y) ? y : 0;
  29337. /**
  29338. * @member {number} ShapeParametersSector.prototype.r
  29339. * @description 外圆半径。
  29340. */
  29341. this.r = !isNaN(r) ? r : 0;
  29342. /**
  29343. * @member {number} ShapeParametersSector.prototype.startAngle
  29344. * @description 起始角度。取值范围[0, 360),默认值:null。
  29345. */
  29346. this.startAngle = !isNaN(startAngle) ? startAngle : 0;
  29347. /**
  29348. * @member {number} ShapeParametersSector.prototype.endAngle
  29349. * @description 结束角度。取值范围(0, 360],默认值:null。
  29350. */
  29351. this.endAngle = !isNaN(endAngle) ? endAngle : 0;
  29352. /**
  29353. * @member {number} [ShapeParametersSector.prototype.r0=0]
  29354. * @description 内圆半径,指定后将出现内弧,同时扇边长度为 r 减 r0。取值范围[0, r)。
  29355. */
  29356. this.r0 = !isNaN(r0) ? r0 : 0;
  29357. /**
  29358. * @member {number} [ShapeParametersSector.prototype.clockWise=false]
  29359. * @description 是否是顺时针。默认值:false。
  29360. */
  29361. this.clockWise = clockWise;
  29362. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Sector";
  29363. }
  29364. /**
  29365. * @function ShapeParametersSector.prototype.destroy
  29366. * @description 销毁对象。
  29367. */
  29368. destroy() {
  29369. this.x = null;
  29370. this.y = null;
  29371. this.r = null;
  29372. this.startAngle = null;
  29373. this.endAngle = null;
  29374. this.r0 = null;
  29375. this.clockWise = null;
  29376. super.destroy();
  29377. }
  29378. }
  29379. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Label.js
  29380. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29381. * This program are made available under the terms of the Apache License, Version 2.0
  29382. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29383. /**
  29384. * @class ShapeParametersLabel
  29385. * @aliasclass Feature.ShapeParameters.Label
  29386. * @deprecatedclass SuperMap.Feature.ShapeParameters.Label
  29387. * @category Visualization Theme
  29388. * @classdesc 标签参数对象。
  29389. * @extends {ShapeParameters}
  29390. * @param {number} x - 横坐标。
  29391. * @param {number} y - 纵坐标。
  29392. * @param {string} text - 图形中的附加文本。
  29393. * @usage
  29394. * ```
  29395. * // 浏览器
  29396. * <script type="text/javascript" src="{cdn}"></script>
  29397. * <script>
  29398. * new {namespace}.Feature.ShapeParameters.Label(x, y, text);
  29399. *
  29400. * // 弃用的写法
  29401. * new SuperMap.Feature.ShapeParameters.Label(x, y, text);
  29402. *
  29403. * </script>
  29404. * // ES6 Import
  29405. * import { ShapeParametersLabel } from '{npm}';
  29406. * new ShapeParametersLabel(x, y, text);
  29407. *
  29408. * // 弃用的写法
  29409. * import { Label } from '{npm}';
  29410. * new Label(x, y, text);
  29411. *
  29412. * ```
  29413. */
  29414. class Label extends ShapeParameters {
  29415. constructor(x, y, text) {
  29416. super(x, y, text);
  29417. /**
  29418. * @member {number} ShapeParametersLabel.prototype.x
  29419. * @description 标签 x 坐标。
  29420. */
  29421. this.x = x;
  29422. /**
  29423. * @member {number} ShapeParametersLabel.prototype.y
  29424. * @description 标签 y 坐标。
  29425. */
  29426. this.y = y;
  29427. /**
  29428. * @member {number} ShapeParametersLabel.prototype.text
  29429. * @description 标签的文本内容。
  29430. */
  29431. this.text = text;
  29432. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Label";
  29433. }
  29434. /**
  29435. * @function ShapeParametersLabel.prototype.destroy
  29436. * @description 销毁对象。
  29437. */
  29438. destroy() {
  29439. this.x = null;
  29440. this.y = null;
  29441. this.text = null;
  29442. super.destroy();
  29443. }
  29444. }
  29445. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Image.js
  29446. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29447. * This program are made available under the terms of the Apache License, Version 2.0
  29448. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29449. /**
  29450. * @class ShapeParametersImage
  29451. * @aliasclass Feature.ShapeParameters.Image
  29452. * @deprecatedclass SuperMap.Feature.ShapeParameters.Image
  29453. * @category Visualization Theme
  29454. * @classdesc 图片参数对象。
  29455. * @extends {ShapeParameters}
  29456. * @param {number} x - 左上角横坐标。
  29457. * @param {number} y - 左上角纵坐标。
  29458. * @param {(string|Object)} image - 图片地址或Cavans对象。
  29459. * @param {number} width - 绘制到画布上的宽度,默认为图片高度。
  29460. * @param {number} height - 绘制到画布上的高度,默认为图片高度。
  29461. * @param {number} sx - 从图片中裁剪的左上角横坐标。
  29462. * @param {number} sy - 从图片中裁剪的左上角纵坐标。
  29463. * @param {number} sWidth - 从图片中裁剪的宽度,默认为图片高度。
  29464. * @param {number} sHeight - 绘制到画布上的高度,默认为图片高度。
  29465. * @usage
  29466. */
  29467. class Image_Image extends ShapeParameters {
  29468. constructor(x, y, image, width, height, sx, sy, sWidth, sHeight) {
  29469. super(x, y, image, width, height, sx, sy, sWidth, sHeight);
  29470. /**
  29471. * @member {number} ShapeParametersImage.prototype.x
  29472. * @description 左上角横坐标,必设参数。
  29473. */
  29474. this.x = x;
  29475. /**
  29476. * @member {number} ShapeParametersImage.prototype.y
  29477. * @description 左上角纵坐标,必设参数。
  29478. */
  29479. this.y = y;
  29480. /**
  29481. * @member {(string|Object)} ShapeParametersImage.prototype.image
  29482. * @description 图片地址。
  29483. */
  29484. this.image = image;
  29485. /**
  29486. * @member {number} ShapeParametersImage.prototype.width
  29487. * @description 绘制到画布上的宽度,默认为图片高度。
  29488. */
  29489. this.width = width;
  29490. /**
  29491. * @member {number} ShapeParametersImage.prototype.height
  29492. * @description 绘制到画布上的高度,默认为图片高度。
  29493. */
  29494. this.height = height;
  29495. /**
  29496. * @member {number} ShapeParametersImage.prototype.sx
  29497. * @description 从图片中裁剪的左上角横坐标。
  29498. */
  29499. this.sx = sx;
  29500. /**
  29501. * @member {number} ShapeParametersImage.prototype.sy
  29502. * @description 从图片中裁剪的左上角纵坐标。
  29503. */
  29504. this.sy = sy;
  29505. /**
  29506. * @member {number} ShapeParametersImage.prototype.sWidth
  29507. * @description 从图片中裁剪的宽度,默认为图片高度。
  29508. */
  29509. this.sWidth = sWidth;
  29510. /**
  29511. * @member {number} ShapeParametersImage.prototype.sHeight
  29512. * @description 绘制到画布上的高度,默认为图片高度。
  29513. */
  29514. this.sHeight = sHeight;
  29515. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Image";
  29516. }
  29517. /**
  29518. * @function ShapeParametersImage.prototype.destroy
  29519. * @description 销毁对象。
  29520. */
  29521. destroy() {
  29522. this.x = null;
  29523. this.y = null;
  29524. this.image = null;
  29525. this.width = null;
  29526. this.height = null;
  29527. this.sx = null;
  29528. this.sy = null;
  29529. this.sWidth = null;
  29530. this.sHeight = null;
  29531. super.destroy();
  29532. }
  29533. }
  29534. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Circle.js
  29535. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29536. * This program are made available under the terms of the Apache License, Version 2.0
  29537. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29538. /**
  29539. * @class ShapeParametersCircle
  29540. * @aliasclass Feature.ShapeParameters.Circle
  29541. * @deprecatedclass SuperMap.Feature.ShapeParameters.Circle
  29542. * @classdesc 圆形参数对象。
  29543. * @category Visualization Theme
  29544. * @extends {ShapeParameters}
  29545. * @param {number} x - 圆心 x 坐标。
  29546. * @param {number} y - 圆心 y 坐标。
  29547. * @param {number} r - 圆半径。
  29548. * @usage
  29549. */
  29550. class Circle_Circle extends ShapeParameters {
  29551. constructor(x, y, r) {
  29552. super(x, y, r);
  29553. /**
  29554. * @member {number} ShapeParametersCircle.prototype.x
  29555. * @description 圆心 x 坐标。
  29556. */
  29557. this.x = !isNaN(x) ? x : 0;
  29558. /**
  29559. * @member {number} ShapeParametersCircle.prototype.y
  29560. * @description 圆心 y 坐标。
  29561. */
  29562. this.y = !isNaN(y) ? y : 0;
  29563. /**
  29564. * @member {number} ShapeParametersCircle.prototype.r
  29565. * @description 圆半径。
  29566. */
  29567. this.r = !isNaN(r) ? r : 0;
  29568. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Circle";
  29569. }
  29570. /**
  29571. * @function ShapeParametersCircle.prototype.destroy
  29572. * @description 销毁对象。
  29573. */
  29574. destroy() {
  29575. this.x = null;
  29576. this.y = null;
  29577. this.r = null;
  29578. super.destroy();
  29579. }
  29580. }
  29581. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPoint.js
  29582. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29583. * This program are made available under the terms of the Apache License, Version 2.0
  29584. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29585. /**
  29586. * @private
  29587. * @class LevelRenderer.Shape.SmicPoint
  29588. * @category Visualization Theme
  29589. * @classdesc 点。
  29590. * @extends LevelRenderer.Shape
  29591. * @example
  29592. * var shape = new LevelRenderer.Shape.SmicPoint({
  29593. * style: {
  29594. * x: 100,
  29595. * y: 100,
  29596. * r: 40,
  29597. * brushType: 'both',
  29598. * color: 'blue',
  29599. * strokeColor: 'red',
  29600. * lineWidth: 3,
  29601. * text: 'point'
  29602. * }
  29603. * });
  29604. * levelRenderer.addShape(shape);
  29605. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  29606. *
  29607. */
  29608. class SmicPoint extends Shape_Shape {
  29609. constructor(options) {
  29610. super(options);
  29611. /**
  29612. * @member {string} LevelRenderer.Shape.SmicPoint.prototype.type
  29613. * @description 图形类型。
  29614. */
  29615. this.type = 'smicpoint';
  29616. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  29617. this.refOriginalPosition = [0, 0];
  29618. }
  29619. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPoint";
  29620. }
  29621. /**
  29622. * @function cdestroy
  29623. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  29624. */
  29625. destroy() {
  29626. this.type = null;
  29627. super.destroy();
  29628. }
  29629. /**
  29630. * @function LevelRenderer.Shape.SmicPoint.prototype.buildPath
  29631. * @description 创建点触。
  29632. *
  29633. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  29634. * @param {Object} style - style。
  29635. *
  29636. */
  29637. buildPath(ctx, style) {
  29638. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  29639. this.refOriginalPosition = [0, 0];
  29640. }
  29641. var __OP = this.refOriginalPosition;
  29642. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, true);
  29643. return;
  29644. }
  29645. /**
  29646. * @function LevelRenderer.Shape.SmicPoint.prototype.getRect
  29647. * @description 计算返回点的包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
  29648. *
  29649. * @param {Object} style - style
  29650. * @return {Object} 边框对象。包含属性:x,y,width,height。
  29651. */
  29652. getRect(style) {
  29653. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  29654. this.refOriginalPosition = [0, 0];
  29655. }
  29656. var __OP = this.refOriginalPosition;
  29657. if (style.__rect) {
  29658. return style.__rect;
  29659. }
  29660. var lineWidth;
  29661. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  29662. lineWidth = style.lineWidth || 1;
  29663. } else {
  29664. lineWidth = 0;
  29665. }
  29666. style.__rect = {
  29667. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  29668. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  29669. width: style.r * 2 + lineWidth,
  29670. height: style.r * 2 + lineWidth
  29671. };
  29672. return style.__rect;
  29673. }
  29674. }
  29675. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicText.js
  29676. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29677. * This program are made available under the terms of the Apache License, Version 2.0
  29678. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29679. /**
  29680. * @private
  29681. * @class LevelRenderer.Shape.SmicText
  29682. * @category Visualization Theme
  29683. * @extends {LevelRenderer.Shape}
  29684. * @example
  29685. * var shape = new LevelRenderer.Shape.SmicText({
  29686. * style: {
  29687. * text: 'Label',
  29688. * x: 100,
  29689. * y: 100,
  29690. * textFont: '14px Arial'
  29691. * }
  29692. * });
  29693. * levelRenderer.addShape(shape);
  29694. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  29695. */
  29696. class SmicText extends Shape_Shape {
  29697. constructor(options) {
  29698. super(options);
  29699. /**
  29700. * @member {string} LevelRenderer.Shape.SmicText.prototype.type
  29701. * @description 图形类型.
  29702. */
  29703. this.type = 'smictext';
  29704. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  29705. this.refOriginalPosition = [0, 0];
  29706. }
  29707. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicText";
  29708. }
  29709. /**
  29710. * @function LevelRenderer.Shape.SmicText.prototype.destroy
  29711. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  29712. */
  29713. destroy() {
  29714. this.type = null;
  29715. super.destroy();
  29716. }
  29717. /**
  29718. * @function LevelRenderer.Shape.SmicText.prototype.brush
  29719. * @description 笔触。
  29720. *
  29721. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  29722. * @param {boolean} isHighlight - 是否使用高亮属性。
  29723. *
  29724. */
  29725. brush(ctx, isHighlight) {
  29726. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  29727. this.refOriginalPosition = [0, 0];
  29728. }
  29729. var __OP = this.refOriginalPosition;
  29730. var style = this.style;
  29731. if (isHighlight) {
  29732. // 根据style扩展默认高亮样式
  29733. style = this.getHighlightStyle(
  29734. style, this.highlightStyle || {}
  29735. );
  29736. }
  29737. if (typeof(style.text) == 'undefined' || style.text === false) {
  29738. return;
  29739. }
  29740. ctx.save();
  29741. this.doClip(ctx);
  29742. this.setContext(ctx, style);
  29743. // 设置transform
  29744. this.setTransform(ctx);
  29745. if (style.textFont) {
  29746. ctx.font = style.textFont;
  29747. }
  29748. ctx.textAlign = style.textAlign || 'start';
  29749. ctx.textBaseline = style.textBaseline || 'middle';
  29750. var text = (style.text + '').split('\n');
  29751. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', style.textFont);
  29752. var rect = this.getRectNoRotation(style);
  29753. // var x = style.x;
  29754. var x = style.x + __OP[0];
  29755. var y;
  29756. if (style.textBaseline == 'top') {
  29757. y = rect.y;
  29758. } else if (style.textBaseline == 'bottom') {
  29759. y = rect.y + lineHeight;
  29760. } else {
  29761. y = rect.y + lineHeight / 2;
  29762. }
  29763. var ox = style.x + __OP[0];
  29764. var oy = style.y + __OP[1];
  29765. //文本绘制
  29766. for (var i = 0, l = text.length; i < l; i++) {
  29767. //是否渲染矩形背景及颜色
  29768. if (style.labelRect) {
  29769. //+4,-2是为了让文字距边框左右边缘有点间隔
  29770. ctx.fillRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
  29771. ctx.fillStyle = style.strokeColor;
  29772. ctx.strokeRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
  29773. ctx.fillStyle = style.textColor;
  29774. }
  29775. switch (style.brushType) {
  29776. case 'stroke':
  29777. this.setCtxGlobalAlpha(ctx, "stroke", style);
  29778. if (style.textRotation && style.textRotation !== 0) {
  29779. ctx.save();
  29780. ctx.translate(ox, oy);
  29781. ctx.rotate(style.textRotation * Math.PI / 180);
  29782. if (style.textBaseline == 'top') {
  29783. if (style.maxWidth) {
  29784. ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
  29785. } else {
  29786. ctx.strokeText(text[i], 0, lineHeight * i);
  29787. }
  29788. } else if (style.textBaseline == 'bottom') {
  29789. if (style.maxWidth) {
  29790. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  29791. } else {
  29792. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
  29793. }
  29794. } else {
  29795. if (style.maxWidth) {
  29796. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  29797. } else {
  29798. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  29799. }
  29800. }
  29801. ctx.restore();
  29802. } else {
  29803. if (style.maxWidth) {
  29804. ctx.strokeText(text[i], x, y, style.maxWidth);
  29805. } else {
  29806. ctx.strokeText(text[i], x, y);
  29807. }
  29808. }
  29809. this.setCtxGlobalAlpha(ctx, "reset", style);
  29810. break;
  29811. case 'both':
  29812. if (style.textRotation && style.textRotation !== 0) {
  29813. ctx.save();
  29814. ctx.translate(ox, oy);
  29815. ctx.rotate(style.textRotation * Math.PI / 180);
  29816. if (style.textBaseline == 'top') {
  29817. if (style.maxWidth) {
  29818. this.setCtxGlobalAlpha(ctx, "fill", style);
  29819. ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
  29820. this.setCtxGlobalAlpha(ctx, "reset", style);
  29821. this.setCtxGlobalAlpha(ctx, "stroke", style);
  29822. ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
  29823. this.setCtxGlobalAlpha(ctx, "reset", style);
  29824. } else {
  29825. this.setCtxGlobalAlpha(ctx, "fill", style);
  29826. ctx.fillText(text[i], 0, lineHeight * i);
  29827. this.setCtxGlobalAlpha(ctx, "reset", style);
  29828. this.setCtxGlobalAlpha(ctx, "stroke", style);
  29829. ctx.strokeText(text[i], 0, lineHeight * i);
  29830. this.setCtxGlobalAlpha(ctx, "reset", style);
  29831. }
  29832. } else if (style.textBaseline == 'bottom') {
  29833. if (style.maxWidth) {
  29834. this.setCtxGlobalAlpha(ctx, "fill", style);
  29835. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  29836. this.setCtxGlobalAlpha(ctx, "reset", style);
  29837. this.setCtxGlobalAlpha(ctx, "stroke", style);
  29838. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  29839. this.setCtxGlobalAlpha(ctx, "reset", style);
  29840. } else {
  29841. this.setCtxGlobalAlpha(ctx, "fill", style);
  29842. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
  29843. this.setCtxGlobalAlpha(ctx, "reset", style);
  29844. this.setCtxGlobalAlpha(ctx, "stroke", style);
  29845. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
  29846. this.setCtxGlobalAlpha(ctx, "reset", style);
  29847. }
  29848. } else {
  29849. if (style.maxWidth) {
  29850. this.setCtxGlobalAlpha(ctx, "fill", style);
  29851. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  29852. this.setCtxGlobalAlpha(ctx, "reset", style);
  29853. this.setCtxGlobalAlpha(ctx, "stroke", style);
  29854. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  29855. this.setCtxGlobalAlpha(ctx, "reset", style);
  29856. } else {
  29857. this.setCtxGlobalAlpha(ctx, "fill", style);
  29858. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  29859. this.setCtxGlobalAlpha(ctx, "reset", style);
  29860. this.setCtxGlobalAlpha(ctx, "stroke", style);
  29861. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  29862. this.setCtxGlobalAlpha(ctx, "reset", style);
  29863. }
  29864. }
  29865. ctx.restore();
  29866. } else {
  29867. if (style.maxWidth) {
  29868. this.setCtxGlobalAlpha(ctx, "fill", style);
  29869. ctx.fillText(text[i], x, y, style.maxWidth);
  29870. this.setCtxGlobalAlpha(ctx, "reset", style);
  29871. this.setCtxGlobalAlpha(ctx, "stroke", style);
  29872. ctx.strokeText(text[i], x, y, style.maxWidth);
  29873. this.setCtxGlobalAlpha(ctx, "reset", style);
  29874. } else {
  29875. this.setCtxGlobalAlpha(ctx, "fill", style);
  29876. ctx.fillText(text[i], x, y);
  29877. this.setCtxGlobalAlpha(ctx, "reset", style);
  29878. this.setCtxGlobalAlpha(ctx, "stroke", style);
  29879. ctx.strokeText(text[i], x, y);
  29880. this.setCtxGlobalAlpha(ctx, "reset", style);
  29881. }
  29882. }
  29883. break;
  29884. default:
  29885. //fill or others
  29886. this.setCtxGlobalAlpha(ctx, "fill", style);
  29887. if (style.textRotation && style.textRotation !== 0) {
  29888. ctx.save();
  29889. ctx.translate(ox, oy);
  29890. ctx.rotate(style.textRotation * Math.PI / 180);
  29891. if (style.textBaseline == 'top') {
  29892. if (style.maxWidth) {
  29893. ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
  29894. } else {
  29895. ctx.fillText(text[i], 0, lineHeight * i);
  29896. }
  29897. } else if (style.textBaseline == 'bottom') {
  29898. if (style.maxWidth) {
  29899. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  29900. } else {
  29901. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
  29902. }
  29903. } else {
  29904. if (style.maxWidth) {
  29905. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  29906. } else {
  29907. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  29908. }
  29909. }
  29910. ctx.restore();
  29911. } else {
  29912. if (style.maxWidth) {
  29913. ctx.fillText(text[i], x, y, style.maxWidth);
  29914. } else {
  29915. ctx.fillText(text[i], x, y);
  29916. }
  29917. }
  29918. this.setCtxGlobalAlpha(ctx, "reset", style);
  29919. }
  29920. y += lineHeight;
  29921. }
  29922. ctx.restore();
  29923. return;
  29924. }
  29925. /**
  29926. * @function LevelRenderer.Shape.SmicText.prototype.getRect
  29927. * @description 返回文字包围盒矩形
  29928. */
  29929. getRect(style) {
  29930. if (style.__rect) {
  29931. return style.__rect;
  29932. }
  29933. var left, top, right, bottom
  29934. var tbg = this.getTextBackground(style, true);
  29935. for (var i = 0, len = tbg.length; i < len; i++) {
  29936. var poi = tbg[i];
  29937. //用第一个点初始化
  29938. if (i == 0) {
  29939. left = poi[0];
  29940. right = poi[0];
  29941. top = poi[1];
  29942. bottom = poi[1];
  29943. } else {
  29944. if (poi[0] < left) {
  29945. left = poi[0]
  29946. }
  29947. if (poi[0] > right) {
  29948. right = poi[0]
  29949. }
  29950. if (poi[1] < top) {
  29951. top = poi[1]
  29952. }
  29953. if (poi[1] > bottom) {
  29954. bottom = poi[1]
  29955. }
  29956. }
  29957. }
  29958. style.__rect = {
  29959. x: left,
  29960. y: top,
  29961. width: right - left,
  29962. height: bottom - top
  29963. };
  29964. return style.__rect;
  29965. }
  29966. /**
  29967. * @function LevelRenderer.Shape.SmicText.prototype.getRectNoRotation
  29968. * @description 返回忽略旋转和maxWidth时文字包围盒矩形
  29969. */
  29970. getRectNoRotation(style) {
  29971. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  29972. this.refOriginalPosition = [0, 0];
  29973. }
  29974. var __OP = this.refOriginalPosition;
  29975. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', style.textFont);
  29976. var width = SUtil_SUtil.Util_area.getTextWidth(style.text, style.textFont);
  29977. var height = SUtil_SUtil.Util_area.getTextHeight(style.text, style.textFont);
  29978. //处理文字位置,注:文本的绘制是由此 rect 决定
  29979. var textX = style.x + __OP[0]; // 默认start == left
  29980. if (style.textAlign == 'end' || style.textAlign == 'right') {
  29981. textX -= width;
  29982. } else if (style.textAlign == 'center') {
  29983. textX -= (width / 2);
  29984. }
  29985. var textY;
  29986. if (style.textBaseline == 'top') {
  29987. // textY = style.y;
  29988. textY = style.y + __OP[1];
  29989. } else if (style.textBaseline == 'bottom') {
  29990. textY = (style.y + __OP[1]) - height;
  29991. } else {
  29992. // middle
  29993. textY = (style.y + __OP[1]) - height / 2;
  29994. }
  29995. var isWidthChangeByMaxWidth = false;
  29996. var widthBeforeChangeByMaxWidth;
  29997. //处理 maxWidth
  29998. if (style.maxWidth) {
  29999. var maxWidth = parseInt(style.maxWidth);
  30000. if (maxWidth < width) {
  30001. widthBeforeChangeByMaxWidth = width;
  30002. isWidthChangeByMaxWidth = true;
  30003. width = maxWidth;
  30004. }
  30005. textX = style.x + __OP[0];
  30006. if (style.textAlign == 'end' || style.textAlign == 'right') {
  30007. textX -= width;
  30008. } else if (style.textAlign == 'center') {
  30009. textX -= (width / 2);
  30010. }
  30011. }
  30012. //处理斜体字
  30013. if (style.textFont) {
  30014. var textFont = style.textFont;
  30015. var textFontStr = textFont.toLowerCase()
  30016. if (textFontStr.indexOf("italic") > -1) {
  30017. if (isWidthChangeByMaxWidth === true) {
  30018. width += (lineHeight / 3) * (width / widthBeforeChangeByMaxWidth);
  30019. } else {
  30020. width += lineHeight / 3;
  30021. }
  30022. }
  30023. }
  30024. var rect = {
  30025. x: textX,
  30026. y: textY,
  30027. width: width,
  30028. height: height
  30029. };
  30030. return rect;
  30031. }
  30032. /**
  30033. * @function LevelRenderer.Shape.SmicText.prototype.getTextBackground
  30034. * @description 获取文本背景框范围
  30035. *
  30036. * @param {Object} style - 样式。
  30037. * @param {boolean} redo - 是否强制重新计算 textBackground。
  30038. */
  30039. getTextBackground(style, redo) {
  30040. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  30041. this.refOriginalPosition = [0, 0];
  30042. }
  30043. var __OP = this.refOriginalPosition;
  30044. if ((!redo) && style.__textBackground) {
  30045. return style.__textBackground;
  30046. }
  30047. //不旋转时矩形框
  30048. var rect = this.getRectNoRotation(style);
  30049. //旋转中心点
  30050. var ox = style.x + __OP[0];
  30051. var oy = style.y + __OP[1];
  30052. //背景框
  30053. var background = [];
  30054. if (style.textRotation && style.textRotation !== 0) {
  30055. let textRotation = style.textRotation;
  30056. let ltPoi = this.getRotatedLocation(rect.x, rect.y, ox, oy, textRotation);
  30057. let rtPoi = this.getRotatedLocation(rect.x + rect.width, rect.y, ox, oy, textRotation);
  30058. let rbPoi = this.getRotatedLocation(rect.x + rect.width, rect.y + rect.height, ox, oy, textRotation);
  30059. let lbPoi = this.getRotatedLocation(rect.x, rect.y + rect.height, ox, oy, textRotation);
  30060. background.push(ltPoi);
  30061. background.push(rtPoi);
  30062. background.push(rbPoi);
  30063. background.push(lbPoi);
  30064. } else {
  30065. let ltPoi = [rect.x, rect.y];
  30066. let rtPoi = [rect.x + rect.width, rect.y];
  30067. let rbPoi = [rect.x + rect.width, rect.y + rect.height];
  30068. let lbPoi = [rect.x, rect.y + rect.height];
  30069. background.push(ltPoi);
  30070. background.push(rtPoi);
  30071. background.push(rbPoi);
  30072. background.push(lbPoi);
  30073. }
  30074. style.__textBackground = background;
  30075. return style.__textBackground;
  30076. }
  30077. /**
  30078. * @function LevelRenderer.Shape.SmicText.prototype.getRotatedLocation
  30079. * @description 获取一个点绕旋转中心顺时针旋转后的位置。(此方法用于屏幕坐标)
  30080. *
  30081. * @param {number} x - 旋转点横坐标。
  30082. * @param {number} y - 旋转点纵坐标。
  30083. * @param {number} rx - 旋转中心点横坐标。
  30084. * @param {number} ry - 旋转中心点纵坐标。
  30085. * @param {number} angle - 旋转角度(度)。
  30086. * @return {Array.<number>} 旋转后的坐标位置,长度为 2 的一维数组,数组第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  30087. */
  30088. getRotatedLocation(x, y, rx, ry, angle) {
  30089. var loc = new Array(), x0, y0;
  30090. y = -y;
  30091. ry = -ry;
  30092. angle = -angle;//顺时针旋转
  30093. x0 = (x - rx) * Math.cos((angle / 180) * Math.PI) - (y - ry) * Math.sin((angle / 180) * Math.PI) + rx;
  30094. y0 = (x - rx) * Math.sin((angle / 180) * Math.PI) + (y - ry) * Math.cos((angle / 180) * Math.PI) + ry;
  30095. loc[0] = x0;
  30096. loc[1] = -y0;
  30097. return loc;
  30098. }
  30099. }
  30100. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicCircle.js
  30101. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30102. * This program are made available under the terms of the Apache License, Version 2.0
  30103. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30104. /**
  30105. * @private
  30106. * @class LevelRenderer.Shape.SmicCircle
  30107. * @category Visualization Theme
  30108. * @classdesc 圆形
  30109. * @extends LevelRenderer.Shape
  30110. * @example
  30111. * var shape = new LevelRenderer.Shape.SmicCircle({
  30112. * style: {
  30113. * x: 100,
  30114. * y: 100,
  30115. * r: 60,
  30116. * brushType: "both",
  30117. * color: "blue",
  30118. * strokeColor: "red",
  30119. * lineWidth: 3,
  30120. * text: "Circle"
  30121. * }
  30122. * });
  30123. * levelRenderer.addShape(shape);
  30124. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  30125. *
  30126. */
  30127. class SmicCircle extends Shape_Shape {
  30128. constructor(options) {
  30129. super(options);
  30130. /**
  30131. * @member {string} LevelRenderer.Shape.SmicCircle.prototype.type
  30132. * @description 图形类型。
  30133. */
  30134. this.type = 'smiccircle';
  30135. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  30136. this.refOriginalPosition = [0, 0];
  30137. }
  30138. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicCircle";
  30139. }
  30140. /**
  30141. * @function LevelRenderer.Shape.SmicCircle.prototype.destroy
  30142. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  30143. */
  30144. destroy() {
  30145. this.type = null;
  30146. super.destroy();
  30147. }
  30148. /**
  30149. * @function LevelRenderer.Shape.SmicCircle.prototype.buildPath
  30150. * @description 创建图形路径。
  30151. *
  30152. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  30153. * @param {Object} style - style。
  30154. *
  30155. */
  30156. buildPath(ctx, style) {
  30157. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  30158. this.refOriginalPosition = [0, 0];
  30159. }
  30160. var __OP = this.refOriginalPosition;
  30161. var x = style.x + __OP[0]; // 圆心x
  30162. var y = style.y + __OP[1]; // 圆心y
  30163. ctx.moveTo(x + style.r, y);
  30164. ctx.arc(x, y, style.r, 0, Math.PI * 2, true);
  30165. return true;
  30166. }
  30167. /**
  30168. * @function LevelRenderer.Shape.SmicCircle.prototype.getRect
  30169. * @description 返回圆形包围盒矩形
  30170. *
  30171. * @param {Object} style - style
  30172. * @return {Object} 边框对象。包含属性:x,y,width,height。
  30173. *
  30174. */
  30175. getRect(style) {
  30176. if (style.__rect) {
  30177. return style.__rect;
  30178. }
  30179. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  30180. this.refOriginalPosition = [0, 0];
  30181. }
  30182. var __OP = this.refOriginalPosition;
  30183. var x = style.x + __OP[0]; // 圆心x
  30184. var y = style.y + __OP[1]; // 圆心y
  30185. var r = style.r; // 圆r
  30186. var lineWidth;
  30187. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  30188. lineWidth = style.lineWidth || 1;
  30189. } else {
  30190. lineWidth = 0;
  30191. }
  30192. style.__rect = {
  30193. x: Math.round(x - r - lineWidth / 2),
  30194. y: Math.round(y - r - lineWidth / 2),
  30195. width: r * 2 + lineWidth,
  30196. height: r * 2 + lineWidth
  30197. };
  30198. return style.__rect;
  30199. }
  30200. }
  30201. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPolygon.js
  30202. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30203. * This program are made available under the terms of the Apache License, Version 2.0
  30204. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30205. /**
  30206. * @private
  30207. * @class LevelRenderer.Shape.SmicPolygon
  30208. * @category Visualization Theme
  30209. * @classdesc 多边形。
  30210. * @extends LevelRenderer.Shape
  30211. * @example
  30212. * var shape = new LevelRenderer.Shape.SmicPolygon({
  30213. * style: {
  30214. * // 100x100 的正方形
  30215. * pointList: [[0, 0], [100, 0], [100, 100], [0, 100]],
  30216. * color: 'blue'
  30217. * }
  30218. * });
  30219. * levelRenderer.addShape(shape);
  30220. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  30221. */
  30222. class SmicPolygon extends Shape_Shape {
  30223. constructor(options) {
  30224. super(options);
  30225. /**
  30226. * @member {string} LevelRenderer.Shape.SmicPolygon.prototype.type
  30227. * @description 图形类型.
  30228. */
  30229. this.type = 'smicpolygon';
  30230. /**
  30231. * @member {Array} LevelRenderer.Shape.SmicPolygon.prototype._holePolygonPointList
  30232. * @description 岛洞面多边形顶点数组(三维数组)
  30233. *
  30234. */
  30235. this.holePolygonPointLists = null;
  30236. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  30237. this.refOriginalPosition = [0, 0];
  30238. }
  30239. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPolygon";
  30240. }
  30241. /**
  30242. * @function LevelRenderer.Shape.SmicPolygon.prototype.destroy
  30243. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  30244. */
  30245. destroy() {
  30246. this.type = null;
  30247. this.holePolygonPointLists = null;
  30248. super.destroy();
  30249. }
  30250. /**
  30251. * @function LevelRenderer.Shape.SmicPolygon.prototype.brush
  30252. * @description 笔触。
  30253. *
  30254. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  30255. * @param {boolean} isHighlight - 是否使用高亮属性。
  30256. *
  30257. */
  30258. brush(ctx, isHighlight) {
  30259. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  30260. this.refOriginalPosition = [0, 0];
  30261. }
  30262. var style = this.style;
  30263. if (isHighlight) {
  30264. // 根据style扩展默认高亮样式
  30265. style = this.getHighlightStyle(
  30266. style,
  30267. this.highlightStyle || {}
  30268. );
  30269. }
  30270. ctx.save();
  30271. this.setContext(ctx, style);
  30272. // 设置 transform
  30273. this.setTransform(ctx);
  30274. // 先 fill 再stroke
  30275. var hasPath = false;
  30276. if (style.brushType == 'fill' || style.brushType == 'both' || typeof style.brushType == 'undefined') { // 默认为fill
  30277. ctx.beginPath();
  30278. if (style.lineType == 'dashed'
  30279. || style.lineType == 'dotted'
  30280. || style.lineType == 'dot'
  30281. || style.lineType == 'dash'
  30282. || style.lineType == 'dashdot'
  30283. || style.lineType == 'longdash'
  30284. || style.lineType == 'longdashdot'
  30285. ) {
  30286. // 特殊处理,虚线围不成path,实线再build一次
  30287. this.buildPath(ctx, {
  30288. lineType: 'solid',
  30289. lineWidth: style.lineWidth,
  30290. pointList: style.pointList
  30291. }
  30292. );
  30293. } else {
  30294. this.buildPath(ctx, style);
  30295. hasPath = true; // 这个path能用
  30296. }
  30297. ctx.closePath();
  30298. this.setCtxGlobalAlpha(ctx, "fill", style);
  30299. ctx.fill();
  30300. this.setCtxGlobalAlpha(ctx, "reset", style);
  30301. }
  30302. if (style.lineWidth > 0 && (style.brushType == 'stroke' || style.brushType == 'both')) {
  30303. if (!hasPath) {
  30304. ctx.beginPath();
  30305. this.buildPath(ctx, style);
  30306. }
  30307. this.setCtxGlobalAlpha(ctx, "stroke", style);
  30308. ctx.stroke();
  30309. this.setCtxGlobalAlpha(ctx, "reset", style);
  30310. }
  30311. this.drawText(ctx, style, this.style);
  30312. //岛洞
  30313. var hpStyle = Util_Util.cloneObject(style);
  30314. if (hpStyle.pointList) {
  30315. if (this.holePolygonPointLists && this.holePolygonPointLists.length > 0) {
  30316. var holePLS = this.holePolygonPointLists;
  30317. var holePLSen = holePLS.length;
  30318. for (var i = 0; i < holePLSen; i++) {
  30319. var holePL = holePLS[i];
  30320. //岛洞面
  30321. hpStyle.pointList = holePL;
  30322. ctx.globalCompositeOperation = "destination-out";
  30323. // 先 fill 再stroke
  30324. hasPath = false;
  30325. if (hpStyle.brushType == 'fill' || hpStyle.brushType == 'both' || typeof hpStyle.brushType == 'undefined') { // 默认为fill
  30326. ctx.beginPath();
  30327. if (hpStyle.lineType == 'dashed'
  30328. || hpStyle.lineType == 'dotted'
  30329. || hpStyle.lineType == 'dot'
  30330. || hpStyle.lineType == 'dash'
  30331. || hpStyle.lineType == 'dashdot'
  30332. || hpStyle.lineType == 'longdash'
  30333. || hpStyle.lineType == 'longdashdot'
  30334. ) {
  30335. // 特殊处理,虚线围不成path,实线再build一次
  30336. this.buildPath(ctx, {
  30337. lineType: 'solid',
  30338. lineWidth: hpStyle.lineWidth,
  30339. pointList: hpStyle.pointList
  30340. }
  30341. );
  30342. } else {
  30343. this.buildPath(ctx, hpStyle);
  30344. hasPath = true; // 这个path能用
  30345. }
  30346. ctx.closePath();
  30347. this.setCtxGlobalAlpha(ctx, "fill", hpStyle);
  30348. ctx.fill();
  30349. this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
  30350. }
  30351. if (hpStyle.lineWidth > 0 && (hpStyle.brushType == 'stroke' || hpStyle.brushType == 'both')) {
  30352. if (!hasPath) {
  30353. ctx.beginPath();
  30354. this.buildPath(ctx, hpStyle);
  30355. }
  30356. //如果描边,先回复 globalCompositeOperation 默认值再描边。
  30357. ctx.globalCompositeOperation = "source-over";
  30358. this.setCtxGlobalAlpha(ctx, "stroke", hpStyle);
  30359. ctx.stroke();
  30360. this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
  30361. } else {
  30362. ctx.globalCompositeOperation = "source-over";
  30363. }
  30364. }
  30365. }
  30366. }
  30367. ctx.restore();
  30368. return;
  30369. }
  30370. /**
  30371. * @function LevelRenderer.Shape.SmicPolygon.prototype.buildPath
  30372. * @description 创建多边形路径。
  30373. *
  30374. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  30375. * @param {Object} style - style。
  30376. *
  30377. */
  30378. buildPath(ctx, style) {
  30379. if (style.showShadow) {
  30380. ctx.shadowBlur = style.shadowBlur;
  30381. ctx.shadowColor = style.shadowColor;
  30382. ctx.shadowOffsetX = style.shadowOffsetX;
  30383. ctx.shadowOffsetY = style.shadowOffsetY;
  30384. }
  30385. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  30386. this.refOriginalPosition = [0, 0];
  30387. }
  30388. var __OP = this.refOriginalPosition;
  30389. // 虽然能重用 brokenLine,但底层图形基于性能考虑,重复代码减少调用吧
  30390. var pointList = style.pointList;
  30391. if (pointList.length < 2) {
  30392. // 少于2个点就不画了~
  30393. return;
  30394. }
  30395. if (style.smooth && style.smooth !== 'spline') {
  30396. var controlPoints = SUtil_SUtil.SUtil_smoothBezier(pointList, style.smooth, true, style.smoothConstraint, __OP);
  30397. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  30398. var cp1;
  30399. var cp2;
  30400. var p;
  30401. var len = pointList.length;
  30402. for (var i = 0; i < len; i++) {
  30403. cp1 = controlPoints[i * 2];
  30404. cp2 = controlPoints[i * 2 + 1];
  30405. p = [pointList[(i + 1) % len][0] + __OP[0], pointList[(i + 1) % len][1] + __OP[1]];
  30406. ctx.bezierCurveTo(
  30407. cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
  30408. );
  30409. }
  30410. } else {
  30411. if (style.smooth === 'spline') {
  30412. pointList = SUtil_SUtil.SUtil_smoothSpline(pointList, true, null, __OP);
  30413. }
  30414. if (!style.lineType || style.lineType == 'solid') {
  30415. // 默认为实线
  30416. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  30417. for (let i = 1; i < pointList.length; i++) {
  30418. ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
  30419. }
  30420. ctx.lineTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  30421. } else if (style.lineType === 'dashed'
  30422. || style.lineType === 'dotted'
  30423. || style.lineType === 'dot'
  30424. || style.lineType === 'dash'
  30425. || style.lineType === 'longdash'
  30426. ) {
  30427. // SMIC-方法修改 - start
  30428. let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
  30429. style._dashLength = dashLengthForStyle;
  30430. let dashLength = (style.lineWidth || 1);
  30431. let pattern1 = dashLength;
  30432. let pattern2 = dashLength;
  30433. //dashed
  30434. if (style.lineType === 'dashed') {
  30435. pattern1 *= 5;
  30436. pattern2 *= 5;
  30437. if (style.lineCap && style.lineCap !== "butt") {
  30438. pattern1 -= dashLength;
  30439. pattern2 += dashLength;
  30440. }
  30441. }
  30442. //dotted
  30443. if (style.lineType === 'dotted') {
  30444. if (style.lineCap && style.lineCap !== "butt") {
  30445. pattern1 = 1;
  30446. pattern2 += dashLength;
  30447. }
  30448. }
  30449. //dot
  30450. if (style.lineType === 'dot') {
  30451. pattern2 *= 4;
  30452. if (style.lineCap && style.lineCap !== "butt") {
  30453. pattern1 = 1;
  30454. pattern2 += dashLength;
  30455. }
  30456. }
  30457. //dash
  30458. if (style.lineType === 'dash') {
  30459. pattern1 *= 4;
  30460. pattern2 *= 4;
  30461. if (style.lineCap && style.lineCap !== "butt") {
  30462. pattern1 -= dashLength;
  30463. pattern2 += dashLength;
  30464. }
  30465. }
  30466. //longdash
  30467. if (style.lineType === 'longdash') {
  30468. pattern1 *= 8;
  30469. pattern2 *= 4;
  30470. if (style.lineCap && style.lineCap !== "butt") {
  30471. pattern1 -= dashLength;
  30472. pattern2 += dashLength;
  30473. }
  30474. }
  30475. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  30476. for (let i = 1; i < pointList.length; i++) {
  30477. SUtil_SUtil.SUtil_dashedLineTo(
  30478. ctx,
  30479. pointList[i - 1][0] + __OP[0],
  30480. pointList[i - 1][1] + __OP[1],
  30481. pointList[i][0] + __OP[0],
  30482. pointList[i][1] + __OP[1],
  30483. dashLength,
  30484. [pattern1, pattern2]
  30485. );
  30486. }
  30487. SUtil_SUtil.SUtil_dashedLineTo(
  30488. ctx,
  30489. pointList[pointList.length - 1][0] + __OP[0],
  30490. pointList[pointList.length - 1][1] + __OP[1],
  30491. pointList[0][0] + __OP[0],
  30492. pointList[0][1] + __OP[1],
  30493. dashLength,
  30494. [pattern1, pattern2]
  30495. );
  30496. } else if (style.lineType === 'dashdot'
  30497. || style.lineType === 'longdashdot'
  30498. ) {
  30499. let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
  30500. style._dashLength = dashLengthForStyle;
  30501. let dashLength = (style.lineWidth || 1);
  30502. let pattern1 = dashLength;
  30503. let pattern2 = dashLength;
  30504. let pattern3 = dashLength;
  30505. let pattern4 = dashLength;
  30506. //dashdot
  30507. if (style.lineType === 'dashdot') {
  30508. pattern1 *= 4;
  30509. pattern2 *= 4;
  30510. pattern4 *= 4;
  30511. if (style.lineCap && style.lineCap !== "butt") {
  30512. pattern1 -= dashLength;
  30513. pattern2 += dashLength;
  30514. pattern3 = 1;
  30515. pattern4 += dashLength;
  30516. }
  30517. }
  30518. //longdashdot
  30519. if (style.lineType === 'longdashdot') {
  30520. pattern1 *= 8;
  30521. pattern2 *= 4;
  30522. pattern4 *= 4;
  30523. if (style.lineCap && style.lineCap !== "butt") {
  30524. pattern1 -= dashLength;
  30525. pattern2 += dashLength;
  30526. pattern3 = 1;
  30527. pattern4 += dashLength;
  30528. }
  30529. }
  30530. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  30531. for (let i = 1; i < pointList.length; i++) {
  30532. SUtil_SUtil.SUtil_dashedLineTo(
  30533. ctx,
  30534. pointList[i - 1][0] + __OP[0],
  30535. pointList[i - 1][1] + __OP[1],
  30536. pointList[i][0] + __OP[0],
  30537. pointList[i][1] + __OP[1],
  30538. dashLength,
  30539. [pattern1, pattern2, pattern3, pattern4]
  30540. );
  30541. }
  30542. SUtil_SUtil.SUtil_dashedLineTo(
  30543. ctx,
  30544. pointList[pointList.length - 1][0] + __OP[0],
  30545. pointList[pointList.length - 1][1] + __OP[1],
  30546. pointList[0][0] + __OP[0],
  30547. pointList[0][1] + __OP[1],
  30548. dashLength,
  30549. [pattern1, pattern2, pattern3, pattern4]
  30550. );
  30551. }
  30552. }
  30553. return;
  30554. }
  30555. /**
  30556. * @function LevelRenderer.Shape.SmicPolygon.prototype.getRect
  30557. * @description 计算返回多边形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
  30558. *
  30559. * @param {Object} style - style
  30560. * @return {Object} 边框对象。包含属性:x,y,width,height。
  30561. *
  30562. */
  30563. getRect(style, refOriginalPosition) {
  30564. var __OP;
  30565. if (!refOriginalPosition) {
  30566. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  30567. this.refOriginalPosition = [0, 0];
  30568. }
  30569. __OP = this.refOriginalPosition;
  30570. } else {
  30571. __OP = refOriginalPosition;
  30572. }
  30573. if (style.__rect) {
  30574. return style.__rect;
  30575. }
  30576. var minX = Number.MAX_VALUE;
  30577. var maxX = Number.MIN_VALUE;
  30578. var minY = Number.MAX_VALUE;
  30579. var maxY = Number.MIN_VALUE;
  30580. var pointList = style.pointList;
  30581. for (var i = 0, l = pointList.length; i < l; i++) {
  30582. if (pointList[i][0] + __OP[0] < minX) {
  30583. minX = pointList[i][0] + __OP[0];
  30584. }
  30585. if (pointList[i][0] + __OP[0] > maxX) {
  30586. maxX = pointList[i][0] + __OP[0];
  30587. }
  30588. if (pointList[i][1] + __OP[1] < minY) {
  30589. minY = pointList[i][1] + __OP[1];
  30590. }
  30591. if (pointList[i][1] + __OP[1] > maxY) {
  30592. maxY = pointList[i][1] + __OP[1];
  30593. }
  30594. }
  30595. var lineWidth;
  30596. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  30597. lineWidth = style.lineWidth || 1;
  30598. } else {
  30599. lineWidth = 0;
  30600. }
  30601. style.__rect = {
  30602. x: Math.round(minX - lineWidth / 2),
  30603. y: Math.round(minY - lineWidth / 2),
  30604. width: maxX - minX + lineWidth,
  30605. height: maxY - minY + lineWidth
  30606. };
  30607. return style.__rect;
  30608. }
  30609. }
  30610. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicBrokenLine.js
  30611. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30612. * This program are made available under the terms of the Apache License, Version 2.0
  30613. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30614. /**
  30615. * @private
  30616. * @class LevelRenderer.Shape.SmicBrokenLine
  30617. * @category Visualization Theme
  30618. * @classdesc 折线(ic)。
  30619. * @extends LevelRenderer.Shape
  30620. * @example
  30621. * var shape = new LevelRenderer.Shape.SmicBrokenLine({
  30622. * style: {
  30623. * pointList: [[0, 0], [100, 100], [100, 0]],
  30624. * smooth: 'bezier',
  30625. * strokeColor: 'purple'
  30626. * }
  30627. * });
  30628. * levelRenderer.addShape(shape);
  30629. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  30630. *
  30631. */
  30632. class SmicBrokenLine extends Shape_Shape {
  30633. constructor(options) {
  30634. super(options);
  30635. /**
  30636. * @member {string} LevelRenderer.Shape.SmicBrokenLine.prototype.brushTypeOnly
  30637. * @description 线条只能描边。
  30638. */
  30639. this.brushTypeOnly = 'stroke';
  30640. /**
  30641. * @member {string} LevelRenderer.Shape.SmicBrokenLine.prototype.textPosition
  30642. * @description 文本位置。
  30643. */
  30644. this.textPosition = 'end';
  30645. /**
  30646. * @member {string} LevelRenderer.Shape.SmicBrokenLine.prototype.type
  30647. * @description 图形类型.
  30648. */
  30649. this.type = 'smicbroken-line';
  30650. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  30651. this.refOriginalPosition = [0, 0];
  30652. }
  30653. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicBrokenLine";
  30654. }
  30655. /**
  30656. * @function LevelRenderer.Shape.SmicBrokenLine.prototype.destroy
  30657. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  30658. */
  30659. destroy() {
  30660. this.brushTypeOnly = null;
  30661. this.textPosition = null;
  30662. this.type = null;
  30663. super.destroy();
  30664. }
  30665. /**
  30666. * @function LevelRenderer.Shape.SmicBrokenLine.prototype.buildPath
  30667. * @description 创建折线路径。
  30668. *
  30669. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  30670. * @param {Object} style - style。
  30671. *
  30672. */
  30673. buildPath(ctx, style) {
  30674. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  30675. this.refOriginalPosition = [0, 0];
  30676. }
  30677. var __OP = this.refOriginalPosition;
  30678. var pointList = style.pointList;
  30679. if (pointList.length < 2) {
  30680. // 少于2个点就不画了~
  30681. return;
  30682. }
  30683. var len = Math.min(style.pointList.length, Math.round(style.pointListLength || style.pointList.length));
  30684. if (style.smooth && style.smooth !== 'spline') {
  30685. var controlPoints = SUtil_SUtil.SUtil_smoothBezier(pointList, style.smooth, false, style.smoothConstraint, __OP);
  30686. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  30687. var cp1;
  30688. var cp2;
  30689. var p;
  30690. for (let i = 0; i < len - 1; i++) {
  30691. cp1 = controlPoints[i * 2];
  30692. cp2 = controlPoints[i * 2 + 1];
  30693. p = [pointList[i + 1][0] + __OP[0], pointList[i + 1][1] + __OP[1]];
  30694. ctx.bezierCurveTo(
  30695. cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
  30696. );
  30697. }
  30698. } else {
  30699. if (style.smooth === 'spline') {
  30700. pointList = SUtil_SUtil.SUtil_smoothSpline(pointList, null, null, __OP);
  30701. len = pointList.length;
  30702. }
  30703. if (!style.lineType || style.lineType === 'solid') {
  30704. // 默认为实线
  30705. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  30706. for (let i = 1; i < len; i++) {
  30707. ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
  30708. }
  30709. } else if (style.lineType === 'dashed'
  30710. || style.lineType === 'dotted'
  30711. || style.lineType === 'dot'
  30712. || style.lineType === 'dash'
  30713. || style.lineType === 'longdash'
  30714. ) {
  30715. let dashLength = (style.lineWidth || 1);
  30716. let pattern1 = dashLength;
  30717. let pattern2 = dashLength;
  30718. //dashed
  30719. if (style.lineType === 'dashed') {
  30720. pattern1 *= 5;
  30721. pattern2 *= 5;
  30722. if (style.lineCap && style.lineCap !== "butt") {
  30723. pattern1 -= dashLength;
  30724. pattern2 += dashLength;
  30725. }
  30726. }
  30727. //dotted
  30728. if (style.lineType === 'dotted') {
  30729. if (style.lineCap && style.lineCap !== "butt") {
  30730. pattern1 = 1;
  30731. pattern2 += dashLength;
  30732. }
  30733. }
  30734. //dot
  30735. if (style.lineType === 'dot') {
  30736. pattern2 *= 4;
  30737. if (style.lineCap && style.lineCap !== "butt") {
  30738. pattern1 = 1;
  30739. pattern2 += dashLength;
  30740. }
  30741. }
  30742. //dash
  30743. if (style.lineType === 'dash') {
  30744. pattern1 *= 4;
  30745. pattern2 *= 4;
  30746. if (style.lineCap && style.lineCap !== "butt") {
  30747. pattern1 -= dashLength;
  30748. pattern2 += dashLength;
  30749. }
  30750. }
  30751. //longdash
  30752. if (style.lineType === 'longdash') {
  30753. pattern1 *= 8;
  30754. pattern2 *= 4;
  30755. if (style.lineCap && style.lineCap !== "butt") {
  30756. pattern1 -= dashLength;
  30757. pattern2 += dashLength;
  30758. }
  30759. }
  30760. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  30761. for (var i = 1; i < len; i++) {
  30762. SUtil_SUtil.SUtil_dashedLineTo(
  30763. ctx,
  30764. pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
  30765. pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
  30766. dashLength,
  30767. [pattern1, pattern2]
  30768. );
  30769. }
  30770. } else if (style.lineType === 'dashdot'
  30771. || style.lineType === 'longdashdot'
  30772. ) {
  30773. let dashLength = (style.lineWidth || 1);
  30774. let pattern1 = dashLength;
  30775. let pattern2 = dashLength;
  30776. let pattern3 = dashLength;
  30777. let pattern4 = dashLength;
  30778. //dashdot
  30779. if (style.lineType === 'dashdot') {
  30780. pattern1 *= 4;
  30781. pattern2 *= 4;
  30782. pattern4 *= 4;
  30783. if (style.lineCap && style.lineCap !== "butt") {
  30784. pattern1 -= dashLength;
  30785. pattern2 += dashLength;
  30786. pattern3 = 1;
  30787. pattern4 += dashLength;
  30788. }
  30789. }
  30790. //longdashdot
  30791. if (style.lineType === 'longdashdot') {
  30792. pattern1 *= 8;
  30793. pattern2 *= 4;
  30794. pattern4 *= 4;
  30795. if (style.lineCap && style.lineCap !== "butt") {
  30796. pattern1 -= dashLength;
  30797. pattern2 += dashLength;
  30798. pattern3 = 1;
  30799. pattern4 += dashLength;
  30800. }
  30801. }
  30802. dashLength = (style.lineWidth || 1)
  30803. * (style.lineType === 'dashed' ? 5 : 1);
  30804. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  30805. for (let i = 1; i < len; i++) {
  30806. SUtil_SUtil.SUtil_dashedLineTo(
  30807. ctx,
  30808. pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
  30809. pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
  30810. dashLength,
  30811. [pattern1, pattern2, pattern3, pattern4]
  30812. );
  30813. }
  30814. }
  30815. }
  30816. return;
  30817. }
  30818. /**
  30819. * @function LevelRenderer.Shape.SmicBrokenLine.prototype.getRect
  30820. * @description 计算返回折线包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
  30821. *
  30822. * @param {Object} style - style
  30823. * @return {Object} 边框对象。包含属性:x,y,width,height。
  30824. */
  30825. getRect(style) {
  30826. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  30827. this.refOriginalPosition = [0, 0];
  30828. }
  30829. var __OP = this.refOriginalPosition;
  30830. return SmicPolygon.prototype.getRect.apply(this, [style, __OP]);
  30831. }
  30832. }
  30833. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRectangle.js
  30834. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30835. * This program are made available under the terms of the Apache License, Version 2.0
  30836. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30837. /**
  30838. * @private
  30839. * @class LevelRenderer.Shape.SmicRectangle
  30840. * @category Visualization Theme
  30841. * @classdesc 矩形。
  30842. * @extends LevelRenderer.Shape
  30843. * @example
  30844. * var shape = new LevelRenderer.Shape.SmicRectangle({
  30845. * style: {
  30846. * x: 0,
  30847. * y: 0,
  30848. * width: 100,
  30849. * height: 100,
  30850. * radius: 20
  30851. * }
  30852. * });
  30853. * levelRenderer.addShape(shape);
  30854. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  30855. */
  30856. class SmicRectangle extends Shape_Shape {
  30857. constructor(options) {
  30858. super(options);
  30859. /**
  30860. * @member {string} LevelRenderer.Shape.SmicRectangle.prototype.type
  30861. * @description 图形类型.
  30862. */
  30863. this.type = 'smicrectangle';
  30864. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  30865. this.refOriginalPosition = [0, 0];
  30866. }
  30867. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRectangle";
  30868. }
  30869. /**
  30870. * @function LevelRenderer.Shape.SmicRectangle.prototype.destroy
  30871. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  30872. */
  30873. destroy() {
  30874. this.type = null;
  30875. super.destroy();
  30876. }
  30877. /**
  30878. * APIMethod: _buildRadiusPath
  30879. * 创建矩形的圆角路径。
  30880. *
  30881. * Parameters:
  30882. * ctx - {CanvasRenderingContext2D} Context2D 上下文。
  30883. * style - {Object} style。
  30884. *
  30885. */
  30886. _buildRadiusPath(ctx, style) {
  30887. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  30888. this.refOriginalPosition = [0, 0];
  30889. }
  30890. var __OP = this.refOriginalPosition;
  30891. // 左上、右上、右下、左下角的半径依次为r1、r2、r3、r4
  30892. // r缩写为1 相当于 [1, 1, 1, 1]
  30893. // r缩写为[1] 相当于 [1, 1, 1, 1]
  30894. // r缩写为[1, 2] 相当于 [1, 2, 1, 2]
  30895. // r缩写为[1, 2, 3] 相当于 [1, 2, 3, 2]
  30896. var x = style.x + __OP[0];
  30897. var y = style.y + __OP[1];
  30898. var width = style.width;
  30899. var height = style.height;
  30900. var r = style.radius;
  30901. var r1;
  30902. var r2;
  30903. var r3;
  30904. var r4;
  30905. if (typeof r === 'number') {
  30906. r1 = r2 = r3 = r4 = r;
  30907. } else if (r instanceof Array) {
  30908. if (r.length === 1) {
  30909. r1 = r2 = r3 = r4 = r[0];
  30910. } else if (r.length === 2) {
  30911. r1 = r3 = r[0];
  30912. r2 = r4 = r[1];
  30913. } else if (r.length === 3) {
  30914. r1 = r[0];
  30915. r2 = r4 = r[1];
  30916. r3 = r[2];
  30917. } else {
  30918. r1 = r[0];
  30919. r2 = r[1];
  30920. r3 = r[2];
  30921. r4 = r[3];
  30922. }
  30923. } else {
  30924. r1 = r2 = r3 = r4 = 0;
  30925. }
  30926. var total;
  30927. if (r1 + r2 > width) {
  30928. total = r1 + r2;
  30929. r1 *= width / total;
  30930. r2 *= width / total;
  30931. }
  30932. if (r3 + r4 > width) {
  30933. total = r3 + r4;
  30934. r3 *= width / total;
  30935. r4 *= width / total;
  30936. }
  30937. if (r2 + r3 > height) {
  30938. total = r2 + r3;
  30939. r2 *= height / total;
  30940. r3 *= height / total;
  30941. }
  30942. if (r1 + r4 > height) {
  30943. total = r1 + r4;
  30944. r1 *= height / total;
  30945. r4 *= height / total;
  30946. }
  30947. ctx.moveTo(x + r1, y);
  30948. ctx.lineTo(x + width - r2, y);
  30949. r2 !== 0 && ctx.quadraticCurveTo(
  30950. x + width, y, x + width, y + r2
  30951. );
  30952. ctx.lineTo(x + width, y + height - r3);
  30953. r3 !== 0 && ctx.quadraticCurveTo(
  30954. x + width, y + height, x + width - r3, y + height
  30955. );
  30956. ctx.lineTo(x + r4, y + height);
  30957. r4 !== 0 && ctx.quadraticCurveTo(
  30958. x, y + height, x, y + height - r4
  30959. );
  30960. ctx.lineTo(x, y + r1);
  30961. r1 !== 0 && ctx.quadraticCurveTo(x, y, x + r1, y);
  30962. }
  30963. /**
  30964. * @function LevelRenderer.Shape.SmicRectangle.prototype.buildPath
  30965. * @description 创建矩形路径。
  30966. *
  30967. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  30968. * @param {Object} style - style。
  30969. *
  30970. */
  30971. buildPath(ctx, style) {
  30972. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  30973. this.refOriginalPosition = [0, 0];
  30974. }
  30975. var __OP = this.refOriginalPosition;
  30976. if (!style.radius) {
  30977. ctx.moveTo(style.x + __OP[0], style.y + __OP[1]);
  30978. ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]));
  30979. ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]) + style.height);
  30980. ctx.lineTo((style.x + __OP[0]), (style.y + __OP[1]) + style.height);
  30981. ctx.lineTo(style.x + __OP[0], style.y + __OP[1]);
  30982. // ctx.rect(style.x, style.y, style.width, style.height);
  30983. } else {
  30984. this._buildRadiusPath(ctx, style);
  30985. }
  30986. ctx.closePath();
  30987. return;
  30988. }
  30989. /**
  30990. * @function LevelRenderer.Shape.SmicRectangle.prototype.getRect
  30991. * @description 计算返回矩形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
  30992. *
  30993. * @param {Object} style - style
  30994. * @return {Object} 边框对象。包含属性:x,y,width,height。
  30995. */
  30996. getRect(style) {
  30997. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  30998. this.refOriginalPosition = [0, 0];
  30999. }
  31000. var __OP = this.refOriginalPosition;
  31001. if (style.__rect) {
  31002. return style.__rect;
  31003. }
  31004. var lineWidth;
  31005. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  31006. lineWidth = style.lineWidth || 1;
  31007. } else {
  31008. lineWidth = 0;
  31009. }
  31010. style.__rect = {
  31011. x: Math.round((style.x + __OP[0]) - lineWidth / 2),
  31012. y: Math.round((style.y + __OP[1]) - lineWidth / 2),
  31013. width: style.width + lineWidth,
  31014. height: style.height + lineWidth
  31015. };
  31016. return style.__rect;
  31017. }
  31018. }
  31019. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicSector.js
  31020. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31021. * This program are made available under the terms of the Apache License, Version 2.0
  31022. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31023. /**
  31024. * @private
  31025. * @class LevelRenderer.Shape.SmicSector
  31026. * @category Visualization Theme
  31027. * @classdesc 扇形。
  31028. * @extends LevelRenderer.Shape
  31029. * @example
  31030. * var shape = new LevelRenderer.Shape.SmicSector({
  31031. * style: {
  31032. * x: 100,
  31033. * y: 100,
  31034. * r: 60,
  31035. * r0: 30,
  31036. * startAngle: 0,
  31037. * endEngle: 180
  31038. * }
  31039. * });
  31040. * levelRenderer.addShape(shape);
  31041. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  31042. *
  31043. */
  31044. class SmicSector extends Shape_Shape {
  31045. constructor(options) {
  31046. super(options);
  31047. /**
  31048. * @member {string} LevelRenderer.Shape.SmicSector.protptype.type
  31049. * @description 图形类型。
  31050. */
  31051. this.type = 'smicsector';
  31052. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  31053. this.refOriginalPosition = [0, 0];
  31054. }
  31055. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicSector";
  31056. }
  31057. /**
  31058. * @function LevelRenderer.Shape.SmicSector.prototype.destroy
  31059. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  31060. */
  31061. destroy() {
  31062. this.type = null;
  31063. super.destroy();
  31064. }
  31065. /**
  31066. * @function LevelRenderer.Shape.SmicSector.prototype.buildPath
  31067. * @description 创建扇形路径。
  31068. *
  31069. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  31070. * @param {Object} style - style。
  31071. *
  31072. */
  31073. buildPath(ctx, style) {
  31074. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  31075. this.refOriginalPosition = [0, 0];
  31076. }
  31077. var __OP = this.refOriginalPosition;
  31078. var x = style.x + __OP[0]; // 圆心x
  31079. var y = style.y + __OP[1]; // 圆心y
  31080. var r0 = style.r0 || 0; // 形内半径[0,r)
  31081. var r = style.r; // 扇形外半径(0,r]
  31082. var startAngle = style.startAngle; // 起始角度[0,360)
  31083. var endAngle = style.endAngle; // 结束角度(0,360]
  31084. var clockWise = style.clockWise || false;
  31085. startAngle = SUtil_SUtil.Util_math.degreeToRadian(startAngle);
  31086. endAngle = SUtil_SUtil.Util_math.degreeToRadian(endAngle);
  31087. if (!clockWise) {
  31088. // 扇形默认是逆时针方向,Y轴向上
  31089. // 这个跟arc的标准不一样,为了兼容echarts
  31090. startAngle = -startAngle;
  31091. endAngle = -endAngle;
  31092. }
  31093. var unitX = SUtil_SUtil.Util_math.cos(startAngle);
  31094. var unitY = SUtil_SUtil.Util_math.sin(startAngle);
  31095. ctx.moveTo(
  31096. unitX * r0 + x,
  31097. unitY * r0 + y
  31098. );
  31099. ctx.lineTo(
  31100. unitX * r + x,
  31101. unitY * r + y
  31102. );
  31103. ctx.arc(x, y, r, startAngle, endAngle, !clockWise);
  31104. ctx.lineTo(
  31105. SUtil_SUtil.Util_math.cos(endAngle) * r0 + x,
  31106. SUtil_SUtil.Util_math.sin(endAngle) * r0 + y
  31107. );
  31108. if (r0 !== 0) {
  31109. ctx.arc(x, y, r0, endAngle, startAngle, clockWise);
  31110. }
  31111. ctx.closePath();
  31112. return;
  31113. }
  31114. /**
  31115. * @function LevelRenderer.Shape.SmicSector.prototype.getRect
  31116. * @description 返回扇形包围盒矩形
  31117. *
  31118. * @param {Object} style - style
  31119. * @return {Object} 边框对象。包含属性:x,y,width,height。
  31120. *
  31121. */
  31122. getRect(style) {
  31123. if (style.__rect) {
  31124. return style.__rect;
  31125. }
  31126. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  31127. this.refOriginalPosition = [0, 0];
  31128. }
  31129. var __OP = this.refOriginalPosition;
  31130. var min0 = SUtil_SUtil.Util_vector.create();
  31131. var min1 = SUtil_SUtil.Util_vector.create();
  31132. var max0 = SUtil_SUtil.Util_vector.create();
  31133. var max1 = SUtil_SUtil.Util_vector.create();
  31134. var x = style.x + __OP[0]; // 圆心x
  31135. var y = style.y + __OP[1]; // 圆心y
  31136. var r0 = style.r0 || 0; // 形内半径[0,r)
  31137. var r = style.r; // 扇形外半径(0,r]
  31138. var startAngle = SUtil_SUtil.Util_math.degreeToRadian(style.startAngle);
  31139. var endAngle = SUtil_SUtil.Util_math.degreeToRadian(style.endAngle);
  31140. var clockWise = style.clockWise;
  31141. if (!clockWise) {
  31142. startAngle = -startAngle;
  31143. endAngle = -endAngle;
  31144. }
  31145. if (r0 > 1) {
  31146. SUtil_SUtil.Util_computeBoundingBox.arc(
  31147. x, y, r0, startAngle, endAngle, !clockWise, min0, max0
  31148. );
  31149. } else {
  31150. min0[0] = max0[0] = x;
  31151. min0[1] = max0[1] = y;
  31152. }
  31153. SUtil_SUtil.Util_computeBoundingBox.arc(
  31154. x, y, r, startAngle, endAngle, !clockWise, min1, max1
  31155. );
  31156. SUtil_SUtil.Util_vector.min(min0, min0, min1);
  31157. SUtil_SUtil.Util_vector.max(max0, max0, max1);
  31158. style.__rect = {
  31159. x: min0[0],
  31160. y: min0[1],
  31161. width: max0[0] - min0[0],
  31162. height: max0[1] - min0[1]
  31163. };
  31164. return style.__rect;
  31165. }
  31166. }
  31167. ;// CONCATENATED MODULE: ./src/common/overlay/feature/ShapeFactory.js
  31168. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31169. * This program are made available under the terms of the Apache License, Version 2.0
  31170. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31171. /**
  31172. * @class FeatureShapeFactory
  31173. * @aliasclass Feature.ShapeFactory
  31174. * @deprecatedclass SuperMap.Feature.ShapeFactory
  31175. * @category Visualization Theme
  31176. * @classdesc 图形工厂类。
  31177. * 目前支持创建的图形有:<br>
  31178. * 用于统计专题图:<br>
  31179. * 点 - 参数对象 <{@link ShapeParametersPoint}> <br>
  31180. * 线 - 参数对象 <{@link ShapeParametersLine}> <br>
  31181. * 面 - 参数对象 <{@link ShapeParametersPolygon}> <br>
  31182. * 矩形 - 参数对象 <{@link ShapeParametersPolygon}> <br>
  31183. * 扇形 - 参数对象 <{@link ShapeParametersSector}> <br>
  31184. * 标签 - 参数对象 <{@link ShapeParametersLabel}> <br>
  31185. * 图片 - 参数对象 <{@link ShapeParametersImage}> <br>
  31186. * 用于符号专题图:<br>
  31187. * 圆形 - 参数对象:<{@link ShapeParametersCircle}>
  31188. * @param {Object} [shapeParameters] - 图形参数对象,<{@link ShapeParameters}> 子类对象。
  31189. * @usage
  31190. */
  31191. class ShapeFactory {
  31192. constructor(shapeParameters) {
  31193. /**
  31194. * @member {Object} FeatureShapeFactory.prototype.shapeParameters
  31195. * @description 图形参数对象,<{@link ShapeParameters}> 子类对象。必设参数,默认值 null。
  31196. */
  31197. this.shapeParameters = shapeParameters;
  31198. this.CLASS_NAME = "SuperMap.Feature.ShapeFactory";
  31199. }
  31200. /**
  31201. * @function FeatureShapeFactory.prototype.destroy
  31202. * @description 销毁图形工厂类对象。
  31203. */
  31204. destroy() {
  31205. this.shapeParameters = null;
  31206. }
  31207. /**
  31208. * @function FeatureShapeFactory.prototype.createShape
  31209. * @description 创建一个图形。具体图形由 shapeParameters 决定。
  31210. * @param {Object} shapeParameters - 图形参数对象,<{@link ShapeParameters}> 子类对象。
  31211. * 此参数可选,如果使用此参数(不为 null),shapeParameters 属性值将被修改为参数的值,然后再使用 shapeParameters 属性值创建图形;
  31212. * 如果不使用此参数,createShape 方法将直接使用 shapeParameters 属性创建图形。
  31213. * @returns {Object} 图形对象(或 null - 图形创建失败)。
  31214. */
  31215. createShape(shapeParameters) {
  31216. if (shapeParameters) {
  31217. this.shapeParameters = shapeParameters;
  31218. }
  31219. if (!this.shapeParameters) {
  31220. return null;
  31221. }
  31222. var sps = this.shapeParameters;
  31223. if (sps instanceof Point_Point) { // 点
  31224. //设置style
  31225. let style = new Object();
  31226. style["x"] = sps.x;
  31227. style["y"] = sps.y;
  31228. style["r"] = sps.r;
  31229. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y']);
  31230. //创建图形
  31231. let shape = new SmicPoint();
  31232. shape.style = ShapeFactory.transformStyle(style);
  31233. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  31234. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'style', 'highlightStyle']);
  31235. return shape;
  31236. } else if (sps instanceof Line_Line) { // 线
  31237. //检查参数 pointList 是否存在
  31238. if (!sps.pointList) {
  31239. return null;
  31240. }
  31241. // 设置style
  31242. let style = new Object();
  31243. style["pointList"] = sps.pointList;
  31244. style = Util_Util.copyAttributesWithClip(style, sps.style, ['pointList']);
  31245. // 创建图形
  31246. let shape = new SmicBrokenLine();
  31247. shape.style = ShapeFactory.transformStyle(style);
  31248. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  31249. Util_Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', 'highlightStyle']);
  31250. return shape;
  31251. } else if (sps instanceof feature_Polygon_Polygon) { // 面
  31252. //检查参数 pointList 是否存在
  31253. if (!sps.pointList) {
  31254. return null;
  31255. }
  31256. //设置style
  31257. let style = new Object();
  31258. style["pointList"] = sps.pointList;
  31259. style = Util_Util.copyAttributesWithClip(style, sps.style, ['pointList']);
  31260. //创建图形
  31261. let shape = new SmicPolygon();
  31262. shape.style = ShapeFactory.transformStyle(style);
  31263. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  31264. Util_Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', "highlightStyle"]);
  31265. return shape;
  31266. } else if (sps instanceof Rectangle_Rectangle) { // 矩形
  31267. //检查参数 pointList 是否存在
  31268. if (!sps.x && !sps.y & !sps.width & !sps.height) {
  31269. return null;
  31270. }
  31271. //设置style
  31272. let style = new Object();
  31273. style["x"] = sps.x;
  31274. style["y"] = sps.y;
  31275. style["width"] = sps.width;
  31276. style["height"] = sps.height;
  31277. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'width', 'height']);
  31278. //创建图形
  31279. let shape = new SmicRectangle();
  31280. shape.style = ShapeFactory.transformStyle(style);
  31281. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  31282. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'width', 'height', 'style', 'highlightStyle']);
  31283. return shape;
  31284. } else if (sps instanceof Sector) { // 扇形
  31285. //设置style
  31286. let style = new Object();
  31287. style["x"] = sps.x;
  31288. style["y"] = sps.y;
  31289. style["r"] = sps.r;
  31290. style["startAngle"] = sps.startAngle;
  31291. style["endAngle"] = sps.endAngle;
  31292. if (sps["r0"]) {
  31293. style["r0"] = sps.r0
  31294. }
  31295. if (sps["clockWise"]) {
  31296. style["clockWise"] = sps.clockWise
  31297. }
  31298. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle']);
  31299. //创建图形
  31300. let shape = new SmicSector();
  31301. shape.style = ShapeFactory.transformStyle(style);
  31302. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  31303. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle', 'style', 'highlightStyle']);
  31304. return shape;
  31305. } else if (sps instanceof Label) { // 标签
  31306. //设置style
  31307. let style = new Object();
  31308. style["x"] = sps.x;
  31309. style["y"] = sps.y;
  31310. style["text"] = sps.text;
  31311. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'text']);
  31312. //创建图形
  31313. let shape = new SmicText();
  31314. shape.style = ShapeFactory.transformStyle(style);
  31315. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  31316. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'text', 'style', 'highlightStyle']);
  31317. return shape;
  31318. } else if (sps instanceof Image_Image) { // 图片
  31319. //设置style
  31320. let style = new Object();
  31321. style["x"] = sps.x;
  31322. style["y"] = sps.y;
  31323. if (sps["image"]) {
  31324. style["image"] = sps.image;
  31325. }
  31326. if (sps["width"]) {
  31327. style["width"] = sps.width;
  31328. }
  31329. if (sps["height"]) {
  31330. style["height"] = sps.height;
  31331. }
  31332. if (sps["sx"]) {
  31333. style["sx"] = sps.sx;
  31334. }
  31335. if (sps["sy"]) {
  31336. style["sy"] = sps.sy;
  31337. }
  31338. if (sps["sWidth"]) {
  31339. style["sWidth"] = sps.sWidth
  31340. }
  31341. if (sps["sHeight"]) {
  31342. style["sHeight"] = sps.sHeight
  31343. }
  31344. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'image', 'width', 'height', 'sx', 'sy', 'sWidth', 'sHeight']);
  31345. //创建图形
  31346. let shape = new SmicImage();
  31347. shape.style = ShapeFactory.transformStyle(style);
  31348. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  31349. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'image', 'width', 'height', 'style', 'highlightStyle']);
  31350. return shape;
  31351. } else if (sps instanceof Circle_Circle) { //圆形 用于符号专题图
  31352. //设置stytle
  31353. let style = new Object();
  31354. style["x"] = sps.x;
  31355. style["r"] = sps.r;
  31356. style["y"] = sps.y;
  31357. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r']);
  31358. //创建图形
  31359. let shape = new SmicCircle();
  31360. shape.style = ShapeFactory.transformStyle(style);
  31361. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  31362. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'style', 'highlightStyle', 'lineWidth', 'text', 'textPosition']);
  31363. return shape;
  31364. }
  31365. return null
  31366. }
  31367. /**
  31368. * @function FeatureShapeFactory.prototype.transformStyle
  31369. * @description 将用户 feature.style (类 Svg style 标准) 的样式,转换为 levelRenderer 的样式标准(类 CSS-Canvas 样式)
  31370. * @param {Object} style - 用户 style。
  31371. * @returns {Object} 符合 levelRenderer 的 style。
  31372. */
  31373. static transformStyle(style) {
  31374. var newStyle = {};
  31375. //字体 ["font-style", "font-variant", "font-weight", "font-size / line-height", "font-family"];
  31376. var fontStr = ["normal", "normal", "normal", "12", "arial,sans-serif"];
  31377. //画笔类型 ["fill", "stroke"];
  31378. var brushType = [true, false];
  31379. for (var ss in style) {
  31380. switch (ss) {
  31381. case "fill":
  31382. brushType[0] = style[ss];
  31383. break;
  31384. case "fillColor":
  31385. newStyle["color"] = style[ss];
  31386. break;
  31387. case "stroke":
  31388. brushType[1] = style[ss];
  31389. break;
  31390. case "strokeWidth":
  31391. newStyle["lineWidth"] = style[ss];
  31392. break;
  31393. case "strokeLinecap":
  31394. newStyle["lineCap"] = style[ss];
  31395. break;
  31396. case "strokeLineJoin":
  31397. newStyle["lineJoin"] = style[ss];
  31398. break;
  31399. case "strokeDashstyle":
  31400. newStyle["lineType"] = style[ss];
  31401. break;
  31402. case "pointRadius":
  31403. newStyle["r"] = style[ss];
  31404. break;
  31405. case "label":
  31406. newStyle["text"] = style[ss];
  31407. break;
  31408. case "labelRect":
  31409. newStyle["labelRect"] = style[ss];
  31410. break;
  31411. case "fontColor":
  31412. newStyle["textColor"] = style[ss];
  31413. break;
  31414. case "fontStyle":
  31415. fontStr[0] = style[ss];
  31416. break;
  31417. case "fontVariant":
  31418. fontStr[1] = style[ss];
  31419. break;
  31420. case "fontWeight":
  31421. fontStr[2] = style[ss];
  31422. break;
  31423. case "fontSize":
  31424. var unit = "";
  31425. if (style[ss] && style[ss].toString().indexOf("px") < 0) {
  31426. unit = "px";
  31427. }
  31428. fontStr[3] = style[ss] + unit;
  31429. break;
  31430. case "fontFamily":
  31431. fontStr[4] = style[ss];
  31432. break;
  31433. case "fontOpacity":
  31434. newStyle["opacity"] = style[ss];
  31435. break;
  31436. case "labelPosition":
  31437. newStyle["textPosition"] = style[ss];
  31438. break;
  31439. case "labelAlign":
  31440. newStyle["textAlign"] = style[ss];
  31441. break;
  31442. case "labelBaseline":
  31443. newStyle["textBaseline"] = style[ss];
  31444. break;
  31445. case "labelRotation":
  31446. newStyle["textRotation"] = style[ss];
  31447. break;
  31448. default:
  31449. newStyle[ss] = style[ss];
  31450. break;
  31451. }
  31452. }
  31453. //拼接字体字符串
  31454. newStyle["textFont"] = fontStr.join(" ");
  31455. //画笔类型
  31456. if (brushType[0] === true && brushType[1] === false) {
  31457. newStyle["brushType"] = "fill";
  31458. } else if (brushType[0] === false && brushType[1] === true) {
  31459. newStyle["brushType"] = "stroke";
  31460. } else if (brushType[0] === true && brushType[1] === true) {
  31461. newStyle["brushType"] = "both";
  31462. } else {
  31463. newStyle["brushType"] = "fill";
  31464. }
  31465. //默认线宽 1
  31466. if (newStyle["lineWidth"] == null) {
  31467. newStyle["lineWidth"] = 1;
  31468. }
  31469. return newStyle;
  31470. }
  31471. /**
  31472. * @function FeatureShapeFactory.prototype.Background
  31473. * @description 创建一个矩形背景框图形对象。
  31474. * @param {FeatureShapeFactory} shapeFactory - 图形工厂对象。
  31475. * @param {Array.<number>} box - 框区域,长度为 4 的一维数组,像素坐标,[left, bottom, right, top]。
  31476. * @param {Object} setting - 图表配置参数。本函数中图形配置对象 setting 可设属性:
  31477. * @param {Object} setting.backgroundStyle - 背景样式,此样式对象对象可设属性:<ShapeParametersRectangle#style>。
  31478. * @param {Array.<number>} [setting.backgroundRadius=[0,0,0,0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  31479. * @returns {Object} 背景框图形,一个可视化图形(矩形)对象。
  31480. */
  31481. static Background(shapeFactory, box, setting) {
  31482. var sets = setting ? setting : {};
  31483. // 背景框图形参数对象
  31484. var bgSP = new Rectangle_Rectangle(box[0], box[3], Math.abs(box[2] - box[0]), Math.abs(box[3] - box[1]));
  31485. // 默认样式
  31486. bgSP.style = {
  31487. fillColor: "#f3f3f3"
  31488. };
  31489. // 设置用户 style
  31490. if (sets.backgroundStyle) {
  31491. Util_Util.copyAttributesWithClip(bgSP.style, sets.backgroundStyle);
  31492. }
  31493. // 设置背景框圆角参数
  31494. if (sets.backgroundRadius) {
  31495. bgSP.style["radius"] = sets.backgroundRadius;
  31496. }
  31497. // 禁止背景框响应事件
  31498. bgSP.clickable = false;
  31499. bgSP.hoverable = false;
  31500. return shapeFactory.createShape(bgSP);
  31501. }
  31502. /**
  31503. * @function FeatureShapeFactory.prototype.GraphAxis
  31504. * @description 创建一个统计图表坐标轴图形对象组。
  31505. * @param {FeatureShapeFactory} shapeFactory - 图形工厂对象。
  31506. * @param {Array.<number>} dataViewBox - 统计图表模型的数据视图框,长度为 4 的一维数组,像素坐标,[left, bottom, right, top]。
  31507. * @param {Object} setting - 图表配置参数。
  31508. * @param {Object} setting.axisStyle - 坐标轴样式,此样式对象对象可设属性:<ShapeParametersLine#style>。
  31509. * @param {boolean} [setting.axisUseArrow=false] - 坐标轴是否使用箭头。
  31510. * @param {number} [setting.axisYTick=0] - y 轴刻度数量,0表示不使用箭头。
  31511. * @param {Array.<string>} setting.axisYLabels - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  31512. * @param {Object} setting.axisYLabelsStyle - y 轴上的标签组样式,此样式对象对象可设属性:<ShapeParametersLabel#style>。
  31513. * @param {Array.<number>} [setting.axisYLabelsOffset=[0,0]] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 y 轴标签组纵向上的偏移量,向下为正,默认值:0。
  31514. * @param {Array.<string>} setting.axisXLabels - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。
  31515. * 标签排布规则:当标签数量与 xShapeInfo 中的属性 xPositions 数量相同(即标签个数与数据个数相等时), 按照 xPositions 提供的位置在水平方向上排布标签,否则沿数据视图框下面条边等距排布标签。
  31516. * @param {Object} setting.axisXLabelsStyle - x 轴上的标签组样式,此样式对象对象可设属性:<ShapeParametersLabel#style>。
  31517. * @param {Array.<number>} [setting.axisXLabelsOffset=[0,0]] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 x 轴标签组纵向上的偏移量,向下为正,默认值:0。
  31518. * @param {boolean} setting.useXReferenceLine - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  31519. * @param {Object} setting.xReferenceLineStyle - 水平参考线样式,此样式对象对象可设属性:<ShapeParametersLine#style>。
  31520. * @param {number} [setting.axis3DParameter=0] - 3D 坐标轴参数,此属性值在大于等于 15 时有效。
  31521. * @param {Object} xShapeInfo - X 方向上的图形信息对象,包含两个属性。
  31522. * @param {Array.<number>} xShapeInfo.xPositions - 图形在 x 轴方向上的像素坐标值,是一个一维数组,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  31523. * @param {number} xShapeInfo.width - 图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  31524. * @returns {Array.<Object>} 统计图表坐标轴图形对象数组。
  31525. */
  31526. static GraphAxis(shapeFactory, dataViewBox, setting, xShapeInfo) {
  31527. var dvb = dataViewBox;
  31528. var sets = setting ? setting : {};
  31529. // 参考线图形对象组
  31530. var refLines = [];
  31531. //坐标轴箭头对象组
  31532. var arrows = [];
  31533. // 是否使用参水平考线,默认不使用
  31534. var isAddRefLine = sets.useXReferenceLine ? sets.useXReferenceLine : false;
  31535. // y 轴上的刻度
  31536. var axisytick = (sets.axisYTick && !isNaN(sets.axisYTick)) ? sets.axisYTick : 0;
  31537. // 坐标轴节点数组
  31538. var pois = [];
  31539. //z 轴箭头数组
  31540. var zArrowPois = [];
  31541. // x,y 轴主干节点数组
  31542. var xMainPois = [];
  31543. if (axisytick == 0) {
  31544. xMainPois.push([dvb[0], dvb[3] - 5]);
  31545. xMainPois.push([dvb[0], dvb[1]]);
  31546. // 3D 坐标轴 第三象限平分线
  31547. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  31548. let axis3DParameter = parseInt(sets.axis3DParameter);
  31549. let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
  31550. // 添加 3D 轴节点
  31551. if (sets.axisUseArrow) { // 添加 3D 轴箭头节点坐标
  31552. //箭头坐标
  31553. zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
  31554. zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
  31555. zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
  31556. //3D轴
  31557. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  31558. } else {
  31559. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  31560. }
  31561. xMainPois.push([dvb[0], dvb[1]]);
  31562. }
  31563. xMainPois.push([dvb[2] + 5, dvb[1]]);
  31564. } else {
  31565. // 单位刻度长度
  31566. var unitTick = Math.abs(dvb[1] - dvb[3]) / axisytick;
  31567. // 刻度 y 坐标
  31568. var thckY = dvb[3];
  31569. xMainPois.push([dvb[0], thckY - 5]);
  31570. for (var i = 0; i < axisytick; i++) {
  31571. xMainPois.push([dvb[0], thckY]);
  31572. xMainPois.push([dvb[0] - 5, thckY]);
  31573. xMainPois.push([dvb[0], thckY]);
  31574. // 参考线
  31575. if (isAddRefLine) {
  31576. // 参考线参数对象
  31577. var refLineSP = new Line_Line([
  31578. [dvb[0], thckY],
  31579. [dvb[2], thckY]
  31580. ]);
  31581. // 参考线默认样式对象
  31582. refLineSP.style = {
  31583. strokeColor: "#cfcfcf",
  31584. strokeLinecap: "butt",
  31585. strokeLineJoin: "round",
  31586. strokeWidth: 1
  31587. };
  31588. // 禁止事件
  31589. refLineSP.clickable = false;
  31590. refLineSP.hoverable = false;
  31591. // 用户style
  31592. if (sets.xReferenceLineStyle) {
  31593. Util_Util.copyAttributesWithClip(refLineSP.style, sets.xReferenceLineStyle);
  31594. }
  31595. // 生成参考线图形对象
  31596. refLines.push(shapeFactory.createShape(refLineSP))
  31597. }
  31598. // y 刻度增量
  31599. thckY += unitTick;
  31600. }
  31601. xMainPois.push([dvb[0], dvb[1]]);
  31602. // 3D 坐标轴 第三象限平分线
  31603. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  31604. let axis3DParameter = parseInt(sets.axis3DParameter);
  31605. let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
  31606. /*
  31607. // 箭头计算过程
  31608. var axis3DPoiRef = [axis3DPoi[0] + 7, axis3DPoi[1] - 7]; // 7 是 10 为斜边 cos(45度)时邻边的值
  31609. var axis3DPoiLT = [axis3DPoiRef[0] - 4, axis3DPoiRef[1] - 4];
  31610. var axis3DPoiRB = [axis3DPoiRef[0] + 4, axis3DPoiRef[1] + 4];
  31611. if(sets.axisUseArrow){
  31612. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  31613. xMainPois.push([axis3DPoiLT[0], axis3DPoiLT[1]]);
  31614. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  31615. xMainPois.push([axis3DPoiRB[0], axis3DPoiRB[1]]);
  31616. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  31617. }
  31618. else{
  31619. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  31620. }
  31621. */
  31622. // 添加 3D 轴节点
  31623. if (sets.axisUseArrow) { // 添加 3D 轴和箭头坐标
  31624. //箭头坐标
  31625. zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
  31626. zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
  31627. zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
  31628. //3D轴
  31629. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  31630. } else {
  31631. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  31632. }
  31633. xMainPois.push([dvb[0], dvb[1]]);
  31634. }
  31635. xMainPois.push([dvb[2] + 5, dvb[1]]);
  31636. }
  31637. // 坐标轴箭头
  31638. if (sets.axisUseArrow) {
  31639. // x 轴箭头节点数组
  31640. var xArrowPois = [
  31641. [dvb[2] + 5, dvb[1] + 4],
  31642. [dvb[2] + 13, dvb[1]],
  31643. [dvb[2] + 5, dvb[1] - 4]
  31644. ];
  31645. // y 轴箭头节点数组
  31646. var yArrowPois = [
  31647. [dvb[0] - 4, dvb[3] - 5],
  31648. [dvb[0], dvb[3] - 13],
  31649. [dvb[0] + 4, dvb[3] - 5]
  31650. ];
  31651. //x轴箭头
  31652. var xSP = new feature_Polygon_Polygon(xArrowPois);
  31653. xSP.style = {fillColor: "#008acd"};
  31654. Util_Util.copyAttributesWithClip(xSP.style, sets.axisStyle);
  31655. arrows.push(shapeFactory.createShape(xSP));
  31656. //y轴箭头
  31657. var ySP = new feature_Polygon_Polygon(yArrowPois);
  31658. ySP.style = {fillColor: "#008acd"};
  31659. Util_Util.copyAttributesWithClip(ySP.style, sets.axisStyle);
  31660. arrows.push(shapeFactory.createShape(ySP));
  31661. // z轴箭头 坐标轴箭头是否要使用
  31662. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  31663. var zSP = new feature_Polygon_Polygon(zArrowPois);
  31664. zSP.style = {fillColor: "#008acd"};
  31665. Util_Util.copyAttributesWithClip(zSP.style, sets.axisStyle);
  31666. arrows.push(shapeFactory.createShape(zSP));
  31667. }
  31668. }
  31669. //不带箭头的坐标轴
  31670. pois = xMainPois;
  31671. // 坐标轴参数对象
  31672. var axisSP = new Line_Line(pois);
  31673. // 坐标轴默认style
  31674. axisSP.style = {
  31675. strokeLinecap: "butt",
  31676. strokeLineJoin: "round",
  31677. strokeColor: "#008acd",
  31678. strokeWidth: 1
  31679. };
  31680. // 用户 style
  31681. if (sets.axisStyle) {
  31682. Util_Util.copyAttributesWithClip(axisSP.style, sets.axisStyle);
  31683. }
  31684. // 禁止事件
  31685. axisSP.clickable = false;
  31686. axisSP.hoverable = false;
  31687. // 创建坐标轴图形对象
  31688. var axisMain = [shapeFactory.createShape(axisSP)];
  31689. // Y 轴标签
  31690. var yLabels = [];
  31691. if (sets.axisYLabels && sets.axisYLabels.length && sets.axisYLabels.length > 0) {
  31692. var axisYLabels = sets.axisYLabels;
  31693. let len = axisYLabels.length;
  31694. // 标签偏移量
  31695. var ylOffset = [0, 0];
  31696. if (sets.axisYLabelsOffset && sets.axisYLabelsOffset.length) {
  31697. ylOffset = sets.axisYLabelsOffset;
  31698. }
  31699. if (len == 1) {
  31700. // 标签参数对象
  31701. let labelYSP = new Label(dvb[0] - 5 + ylOffset[0], dvb[3] + ylOffset[1], axisYLabels[0]);
  31702. labelYSP.style = {
  31703. labelAlign: "right"
  31704. };
  31705. // 用户 style
  31706. if (sets.axisYLabelsStyle) {
  31707. Util_Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
  31708. }
  31709. // 禁止事件
  31710. labelYSP.clickable = false;
  31711. labelYSP.hoverable = false;
  31712. // 制作标签
  31713. yLabels.push(shapeFactory.createShape(labelYSP));
  31714. } else {
  31715. var labelY = dvb[3];
  31716. // y 轴标签单位距离
  31717. var yUnit = Math.abs(dvb[1] - dvb[3]) / (len - 1);
  31718. for (var j = 0; j < len; j++) {
  31719. // 标签参数对象
  31720. let labelYSP = new Label(dvb[0] - 5 + ylOffset[0], labelY + ylOffset[1], axisYLabels[j]);
  31721. labelYSP.style = {
  31722. labelAlign: "right"
  31723. };
  31724. // 用户 style
  31725. if (sets.axisYLabelsStyle) {
  31726. Util_Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
  31727. }
  31728. // 禁止事件
  31729. labelYSP.clickable = false;
  31730. labelYSP.hoverable = false;
  31731. // 制作标签
  31732. yLabels.push(shapeFactory.createShape(labelYSP));
  31733. // y 轴标签 y 方向增量
  31734. labelY += yUnit;
  31735. }
  31736. }
  31737. }
  31738. // X 轴标签
  31739. var xLabels = [];
  31740. if (sets.axisXLabels && sets.axisXLabels.length && sets.axisXLabels.length > 0) {
  31741. let axisXLabels = sets.axisXLabels;
  31742. let len = axisXLabels.length;
  31743. // 标签偏移量
  31744. let xlOffset = [0, 0];
  31745. if (sets.axisXLabelsOffset && sets.axisXLabelsOffset.length) {
  31746. xlOffset = sets.axisXLabelsOffset;
  31747. }
  31748. // 标签个数与数据字段个数相等等时,标签在 x 轴均匀排列
  31749. if (xShapeInfo && xShapeInfo.xPositions && xShapeInfo.xPositions.length && xShapeInfo.xPositions.length == len) {
  31750. let xsCenter = xShapeInfo.xPositions;
  31751. for (let K = 0; K < len; K++) {
  31752. // 标签参数对象
  31753. let labelXSP = new Label(xsCenter[K] + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[K]);
  31754. // 默认 style
  31755. labelXSP.style = {
  31756. labelAlign: "center",
  31757. labelBaseline: "top"
  31758. };
  31759. // 用户 style
  31760. if (sets.axisXLabelsStyle) {
  31761. Util_Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  31762. }
  31763. // 禁止事件
  31764. labelXSP.clickable = false;
  31765. labelXSP.hoverable = false;
  31766. // 创建标签对象
  31767. xLabels.push(shapeFactory.createShape(labelXSP));
  31768. }
  31769. } else {
  31770. if (len == 1) {
  31771. // 标签参数对象
  31772. let labelXSP = new Label(dvb[0] - 5 + xlOffset[0], dvb[1] + xlOffset[0], axisXLabels[0]);
  31773. // 默认 style
  31774. labelXSP.style = {
  31775. labelAlign: "center",
  31776. labelBaseline: "top"
  31777. };
  31778. // 用户 style
  31779. if (sets.axisXLabelsStyle) {
  31780. Util_Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  31781. }
  31782. // 禁止事件
  31783. labelXSP.clickable = false;
  31784. labelXSP.hoverable = false;
  31785. // 创建标签对象
  31786. xLabels.push(shapeFactory.createShape(labelXSP));
  31787. } else {
  31788. let labelX = dvb[0];
  31789. // x 轴标签单位距离
  31790. let xUnit = Math.abs(dvb[2] - dvb[0]) / (len - 1);
  31791. for (let m = 0; m < len; m++) {
  31792. // 标签参数对象
  31793. let labelXSP = new Label(labelX + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[m]);
  31794. // 默认 style
  31795. labelXSP.style = {
  31796. labelAlign: "center",
  31797. labelBaseline: "top"
  31798. };
  31799. // 用户 style
  31800. if (sets.axisXLabelsStyle) {
  31801. Util_Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  31802. }
  31803. // 禁止事件
  31804. labelXSP.clickable = false;
  31805. labelXSP.hoverable = false;
  31806. // 创建标签对象
  31807. xLabels.push(shapeFactory.createShape(labelXSP));
  31808. // x 轴标签 x 方向增量
  31809. labelX += xUnit;
  31810. }
  31811. }
  31812. }
  31813. }
  31814. // 组装并返回构成坐标轴的图形
  31815. return ((refLines.concat(axisMain)).concat(yLabels)).concat(xLabels).concat(arrows);
  31816. }
  31817. /**
  31818. * @function FeatureShapeFactory.prototype.ShapeStyleTool
  31819. * @description 一个图形 style 处理工具。此工具将指定的默认 style,通用 style,按 styleGroup 取得的 style 和按数据值 value 范围取得的 style 进行合并,得到图形最终的 style。
  31820. * @param {Object} defaultStyle - 默认style,此样式对象可设属性根据图形类型参考 <{@link ShapeParameters}> 子类对象的 style 属性。
  31821. * @param {Object} style - 图形对象基础 style,此参数控制图形的基础样式,可设属性根据图形类型参考 <{@link ShapeParameters}> 子类对象的 style 属性。优先级低于 styleGroup,styleByCodomain。
  31822. * @param {Array.<Object>} styleGroup - 一个 style 数组,优先级低于 styleByCodomain,高于 style。此数组每个元素是样式对象,
  31823. * 其可设属性根据图形类型参考 <{@link ShapeParameters}> 子类对象的 style 属性。通过 index 参数从 styleGroup 中取 style。
  31824. * @param {Array.<Object>} styleByCodomain - 按数据(参数 value)所在值域范围控制数据的可视化对象样式。
  31825. * (start code)
  31826. * // styleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  31827. * // start: 值域值下限(包含);
  31828. * // end: 值域值上限(不包含);
  31829. * // style: 数据可视化图形的 style,其可设属性根据图形类型参考 <ShapeParameters> 子类对象的 style 属性。
  31830. * // dataStyleByCodomain 数组形如:
  31831. * [
  31832. * {
  31833. * start:0,
  31834. * end:250,
  31835. * style:{
  31836. * fillColor:"#00CD00"
  31837. * }
  31838. * },
  31839. * {
  31840. * start:250,
  31841. * end:500,
  31842. * style:{
  31843. * fillColor:"#00EE00"
  31844. * }
  31845. * },
  31846. * {
  31847. * start:500,
  31848. * end:750,
  31849. * style:{
  31850. * fillColor:"#00FF7F"
  31851. * }
  31852. * },
  31853. * {
  31854. * start:750,
  31855. * end:1500,
  31856. * style:{
  31857. * fillColor:"#00FF00"
  31858. * }
  31859. * }
  31860. * ]
  31861. * (end)
  31862. * @param {number} index - styleGroup 的索引值,用于取出 styleGroup 指定的 style。
  31863. * @param {number} value - 数据值,用于取出 styleByCodomain 指定的 style。
  31864. * @returns {Object} 合并后的样式 (style) 对象。
  31865. */
  31866. static ShapeStyleTool(defaultStyle, style, styleGroup, styleByCodomain, index, value) {
  31867. // 用 defaultStyle 初始化 style 对象
  31868. var finalStyle = defaultStyle ? defaultStyle : {};
  31869. // 基础 style
  31870. if (style) {
  31871. Util_Util.copyAttributesWithClip(finalStyle, style);
  31872. }
  31873. // 按索引赋 style
  31874. if (styleGroup && styleGroup.length && typeof(index) !== "undefined" && !isNaN(index) && index >= 0) {
  31875. if (styleGroup[index]) {
  31876. Util_Util.copyAttributesWithClip(finalStyle, styleGroup[index]);
  31877. }
  31878. }
  31879. // 按值域赋 style
  31880. if (styleByCodomain && styleByCodomain.length && typeof(value) !== "undefined") {
  31881. var dsc = styleByCodomain;
  31882. var dscLen = dsc.length;
  31883. var v = parseFloat(value);
  31884. for (var i = 0; i < dscLen; i++) {
  31885. if (dsc[i].start <= v && v < dsc[i].end) {
  31886. Util_Util.copyAttributesWithClip(finalStyle, dsc[i].style);
  31887. break;
  31888. }
  31889. }
  31890. }
  31891. return finalStyle;
  31892. }
  31893. }
  31894. ;// CONCATENATED MODULE: ./src/common/overlay/ThemeVector.js
  31895. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31896. * This program are made available under the terms of the Apache License, Version 2.0
  31897. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31898. /**
  31899. * @class FeatureThemeVector
  31900. * @aliasclass Feature.Theme.ThemeVector
  31901. * @deprecatedclass SuperMap.Feature.Theme.ThemeVector
  31902. * @classdesc 矢量专题要素类。
  31903. * @category Visualization Theme
  31904. * @extends FeatureTheme
  31905. * @param {FeatureVector} data - 用户数据,的类型为矢量数据 feature。
  31906. * @param {SuperMap.Layer} layer - 此专题要素所在图层。
  31907. * @param {Object} style - 样式。
  31908. * @param {Object} options - 创建专题要素时的可选参数。
  31909. * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离,单位:像素。
  31910. * @param {boolean} [options.isHoverAble=true] - 图形是否可 hover。
  31911. * @param {boolean} [options.isMultiHover=true] - 是否使用多图形高亮,isHoverAble 为 true 时生效。
  31912. * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
  31913. * @param {Object} [options.highlightStyle] - 高亮样式。
  31914. * @usage
  31915. */
  31916. class ThemeVector extends Theme {
  31917. constructor(data, layer, style, options, shapeOptions) {
  31918. super(data, layer);
  31919. //数据的 geometry 属性必须存在且类型是 Geometry 或其子类的类型
  31920. if (!data.geometry) {
  31921. return;
  31922. }
  31923. if (!(data.geometry instanceof Geometry_Geometry)) {
  31924. return;
  31925. }
  31926. /**
  31927. * @member {Bounds} [FeatureThemeVector.prototype.dataBounds]
  31928. * @description 用户数据的(feature.geometry)地理范围。
  31929. */
  31930. this.dataBounds = data.geometry.getBounds();
  31931. /**
  31932. * @member {number} [FeatureThemeVector.prototype.nodesClipPixel=2]
  31933. * @description 节点抽稀像素距离。
  31934. */
  31935. this.nodesClipPixel = 2;
  31936. /**
  31937. * @member {boolean} [FeatureThemeVector.prototype.isHoverAble=true]
  31938. * @description 图形是否可 hover。
  31939. */
  31940. this.isHoverAble = true;
  31941. /**
  31942. * @member {boolean} [FeatureThemeVector.prototype.isMultiHover=true]
  31943. * @description 是否使用多图形高亮,isHoverAble 为 true 时生效。
  31944. */
  31945. this.isMultiHover = true;
  31946. /**
  31947. * @member {boolean} [FeatureThemeVector.prototype.isClickAble=true]
  31948. * @description 图形是否可点击。
  31949. */
  31950. this.isClickAble = true;
  31951. /**
  31952. * @member {Object} [FeatureThemeVector.prototype.highlightStyle]
  31953. * @description 高亮样式。
  31954. */
  31955. this.highlightStyle = null;
  31956. /**
  31957. * @member {Object} [FeatureThemeVector.prototype.shapeOptions]
  31958. * @description 添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做。
  31959. */
  31960. this.shapeOptions = {};
  31961. /**
  31962. * @member {Object} [FeatureThemeVector.prototype.style]
  31963. * @description 可视化图形的 style。在子类中规定其对象结构和默认属性值。
  31964. */
  31965. this.style = style || {};
  31966. this.CLASS_NAME = "SuperMap.Feature.Theme.Vector";
  31967. this.style = style ? style : {};
  31968. if (options) {
  31969. Util_Util.copyAttributesWithClip(this, options, ["shapeOptions", "dataBounds"])
  31970. }
  31971. if (shapeOptions) {
  31972. Util_Util.copyAttributesWithClip(this.shapeOptions, shapeOptions);
  31973. }
  31974. //设置基础参数 dataBounds、lonlat、location
  31975. var geometry = data.geometry;
  31976. this.lonlat = this.dataBounds.getCenterLonLat();
  31977. this.location = this.getLocalXY(this.lonlat);
  31978. //将地理要素转为专题要素
  31979. if (geometry instanceof LinearRing_LinearRing) {
  31980. this.lineToTF(geometry);
  31981. } else if (geometry instanceof LineString) {
  31982. this.lineToTF(geometry);
  31983. } else if (geometry instanceof Curve) {
  31984. //独立几何体
  31985. } else if (geometry instanceof MultiPoint) {
  31986. this.multiPointToTF(geometry);
  31987. } else if (geometry instanceof MultiLineString) {
  31988. this.multiLineStringToTF(geometry);
  31989. } else if (geometry instanceof MultiPolygon) {
  31990. this.multiPolygonToTF(geometry);
  31991. } else if (geometry instanceof Polygon_Polygon) {
  31992. this.polygonToTF(geometry);
  31993. } else if (geometry instanceof Collection) {
  31994. //独立几何体
  31995. } else if (geometry instanceof Point) {
  31996. this.pointToTF(geometry);
  31997. } else if (geometry instanceof Rectangle) {
  31998. this.rectangleToTF(geometry);
  31999. } else if (geometry instanceof GeoText) {
  32000. this.geoTextToTF(geometry);
  32001. }
  32002. }
  32003. /**
  32004. * @function FeatureThemeVector.prototype.destroy
  32005. * @override
  32006. */
  32007. destroy() {
  32008. this.style = null;
  32009. this.dataBounds = null;
  32010. this.nodesClipPixel = null;
  32011. this.isHoverAble = null;
  32012. this.isMultiHover = null;
  32013. this.isClickAble = null;
  32014. this.highlightStyle = null;
  32015. this.shapeOptions = null;
  32016. super.destroy();
  32017. }
  32018. /**
  32019. * @function FeatureThemeVector.prototype.lineToTF
  32020. * @description 转换线和线环要素。
  32021. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 GeometryLineString 或 GeometryLineRing。
  32022. */
  32023. lineToTF(geometry) {
  32024. var components = geometry.components;
  32025. //节点像素坐标
  32026. var localLX = [];
  32027. //参考位置,参考中心为
  32028. var refLocal = [];
  32029. var location = this.location;
  32030. var pointList = [];
  32031. //节点抽稀距离
  32032. var nCPx = this.nodesClipPixel;
  32033. for (var i = 0; i < components.length; i++) {
  32034. var components_i = components[i];
  32035. refLocal = [];
  32036. localLX = this.getLocalXY(components_i);
  32037. refLocal[0] = localLX[0] - location[0];
  32038. refLocal[1] = localLX[1] - location[1];
  32039. //抽稀 - 2 px
  32040. if (pointList.length > 0) {
  32041. var lastLocalXY = pointList[pointList.length - 1];
  32042. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  32043. continue;
  32044. }
  32045. }
  32046. //使用参考点
  32047. pointList.push(refLocal);
  32048. }
  32049. if (pointList.length < 2) {
  32050. return null;
  32051. }
  32052. //赋 style
  32053. var style = new Object();
  32054. style = Util_Util.copyAttributesWithClip(style, this.style, ['pointList']);
  32055. style.pointList = pointList;
  32056. //创建图形
  32057. var shape = new SmicBrokenLine({
  32058. style: style,
  32059. clickable: this.isClickAble,
  32060. hoverable: this.isHoverAble
  32061. });
  32062. //设置高亮样式
  32063. if (this.highlightStyle) {
  32064. shape.highlightStyle = this.highlightStyle;
  32065. }
  32066. //设置参考中心,指定图形位置
  32067. shape.refOriginalPosition = this.location;
  32068. //储存数据 id 属性,用于事件
  32069. shape.refDataID = this.data.id;
  32070. //储存数据 id 属性,用于事件-多图形同时高亮
  32071. shape.isHoverByRefDataID = this.isMultiHover;
  32072. //添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做
  32073. if (this.shapeOptions) {
  32074. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  32075. }
  32076. this.shapes.push(shape);
  32077. }
  32078. /**
  32079. * @function FeatureThemeVector.prototype.multiPointToTF
  32080. * @description 转多点要素。
  32081. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPoint。
  32082. */
  32083. multiPointToTF(geometry) {
  32084. /* //-- 不抽稀
  32085. var components = geometry.components;
  32086. for(var i = 0; i < components.length; i++){
  32087. var components_i = components[i];
  32088. this.pointToTF(components_i);
  32089. }
  32090. */
  32091. var components = geometry.components;
  32092. //节点像素坐标
  32093. var localLX = [];
  32094. //参考位置,参考中心为
  32095. var refLocal = [];
  32096. var location = this.location;
  32097. var pointList = [];
  32098. //节点抽稀距离
  32099. var nCPx = this.nodesClipPixel;
  32100. for (var i = 0; i < components.length; i++) {
  32101. var components_i = components[i];
  32102. refLocal = [];
  32103. localLX = this.getLocalXY(components_i);
  32104. refLocal[0] = localLX[0] - location[0];
  32105. refLocal[1] = localLX[1] - location[1];
  32106. //抽稀
  32107. if (pointList.length > 0) {
  32108. var lastLocalXY = pointList[pointList.length - 1];
  32109. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  32110. continue;
  32111. }
  32112. }
  32113. //使用参考点
  32114. pointList.push(refLocal);
  32115. //赋 style
  32116. var style = new Object();
  32117. style.r = 6; //防止漏设此参数,默认 6 像素
  32118. style = Util_Util.copyAttributesWithClip(style, this.style);
  32119. style.x = refLocal[0];
  32120. style.y = refLocal[1];
  32121. //创建图形
  32122. var shape = new SmicPoint({
  32123. style: style,
  32124. clickable: this.isClickAble,
  32125. hoverable: this.isHoverAble
  32126. });
  32127. //设置高亮样式
  32128. if (this.highlightStyle) {
  32129. shape.highlightStyle = this.highlightStyle;
  32130. }
  32131. //设置参考中心,指定图形位置
  32132. shape.refOriginalPosition = location;
  32133. //储存数据 id 属性,用于事件
  32134. shape.refDataID = this.data.id;
  32135. //储存数据 id 属性,用于事件-多图形同时高亮
  32136. shape.isHoverByRefDataID = this.isMultiHover;
  32137. //修改一些 shape 可选属性,通常不需要这么做
  32138. if (this.shapeOptions) {
  32139. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  32140. }
  32141. this.shapes.push(shape);
  32142. }
  32143. }
  32144. /**
  32145. * @function FeatureThemeVector.prototype.multiLineStringToTF
  32146. * @description 转换多线要素。
  32147. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiLineString。
  32148. */
  32149. multiLineStringToTF(geometry) {
  32150. var components = geometry.components;
  32151. for (var i = 0; i < components.length; i++) {
  32152. var components_i = components[i];
  32153. this.lineToTF(components_i);
  32154. }
  32155. }
  32156. /**
  32157. * @function FeatureThemeVector.prototype.multiPolygonToTF
  32158. * @description 转换多面要素。
  32159. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPolygon。
  32160. */
  32161. multiPolygonToTF(geometry) {
  32162. var components = geometry.components;
  32163. for (var i = 0; i < components.length; i++) {
  32164. var components_i = components[i];
  32165. this.polygonToTF(components_i);
  32166. }
  32167. }
  32168. /**
  32169. * @function FeatureThemeVector.prototype.pointToTF
  32170. * @description 转换点要素。
  32171. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 Point。
  32172. */
  32173. pointToTF(geometry) {
  32174. //参考位置,参考中心为
  32175. var location = this.location;
  32176. //geometry 像素坐标
  32177. var localLX = this.getLocalXY(geometry);
  32178. //赋 style
  32179. var style = new Object();
  32180. style.r = 6; //防止漏设此参数,默认 6 像素
  32181. style = Util_Util.copyAttributesWithClip(style, this.style);
  32182. style.x = localLX[0] - location[0];
  32183. style.y = localLX[1] - location[1];
  32184. //创建图形
  32185. var shape = new SmicPoint({
  32186. style: style,
  32187. clickable: this.isClickAble,
  32188. hoverable: this.isHoverAble
  32189. });
  32190. //设置高亮样式
  32191. if (this.highlightStyle) {
  32192. shape.highlightStyle = this.highlightStyle;
  32193. }
  32194. //设置参考中心,指定图形位置
  32195. shape.refOriginalPosition = location;
  32196. //储存数据 id 属性,用于事件
  32197. shape.refDataID = this.data.id;
  32198. //储存数据 id 属性,用于事件-多图形同时高亮
  32199. shape.isHoverByRefDataID = this.isMultiHover;
  32200. //修改一些 shape 可选属性,通常不需要这么做
  32201. if (this.shapeOptions) {
  32202. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  32203. }
  32204. this.shapes.push(shape);
  32205. }
  32206. /**
  32207. * @function FeatureThemeVector.prototype.polygonToThemeFeature
  32208. * @description 转换面要素。
  32209. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 Polygon。
  32210. */
  32211. polygonToTF(geometry) {
  32212. var components = geometry.components;
  32213. //节点像素坐标
  32214. var localLX = [];
  32215. //参考位置,参考中心为
  32216. var refLocal = [];
  32217. var location = this.location;
  32218. var pointList = [];
  32219. //岛洞
  32220. var holePolygonPointList = [];
  32221. var holePolygonPointLists = [];
  32222. //节点抽稀距离
  32223. var nCPx = this.nodesClipPixel;
  32224. for (var i = 0; i < components.length; i++) {
  32225. var components_i = components[i].components;
  32226. if (i === 0) {
  32227. // 第一个 component 正常绘制
  32228. pointList = [];
  32229. for (var j = 0; j < components_i.length; j++) {
  32230. refLocal = [];
  32231. localLX = this.getLocalXY(components_i[j]);
  32232. refLocal[0] = localLX[0] - location[0];
  32233. refLocal[1] = localLX[1] - location[1];
  32234. //抽稀 - 2 px
  32235. if (pointList.length > 0) {
  32236. var lastLocalXY = pointList[pointList.length - 1];
  32237. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  32238. continue;
  32239. }
  32240. }
  32241. //使用参考点
  32242. pointList.push(refLocal);
  32243. }
  32244. } else {
  32245. // 其它 component 作为岛洞
  32246. holePolygonPointList = [];
  32247. for (var k = 0; k < components_i.length; k++) {
  32248. refLocal = [];
  32249. localLX = this.getLocalXY(components_i[k]);
  32250. refLocal[0] = localLX[0] - location[0];
  32251. refLocal[1] = localLX[1] - location[1];
  32252. //抽稀 - 2 px
  32253. if (holePolygonPointList.length > 0) {
  32254. var lastXY = holePolygonPointList[holePolygonPointList.length - 1];
  32255. if ((Math.abs(lastXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastXY[1] - refLocal[1]) <= nCPx)) {
  32256. continue;
  32257. }
  32258. }
  32259. //使用参考点
  32260. holePolygonPointList.push(refLocal);
  32261. }
  32262. }
  32263. if (holePolygonPointList.length < 2) {
  32264. continue;
  32265. }
  32266. holePolygonPointLists.push(holePolygonPointList);
  32267. }
  32268. if (pointList.length < 2) {
  32269. return;
  32270. }
  32271. //赋 style
  32272. var style = {};
  32273. style = Util_Util.copyAttributesWithClip(style, this.style, ['pointList']);
  32274. style.pointList = pointList;
  32275. //创建图形
  32276. var shape = new SmicPolygon({
  32277. style: style,
  32278. clickable: this.isClickAble,
  32279. hoverable: this.isHoverAble
  32280. });
  32281. //设置高亮样式
  32282. if (this.highlightStyle) {
  32283. shape.highlightStyle = this.highlightStyle;
  32284. }
  32285. //设置参考中心,指定图形位置
  32286. shape.refOriginalPosition = this.location;
  32287. //储存数据 id 属性,用于事件
  32288. shape.refDataID = this.data.id;
  32289. //储存数据 id 属性,用于事件-多图形同时高亮
  32290. shape.isHoverByRefDataID = this.isMultiHover;
  32291. //岛洞面
  32292. if (holePolygonPointLists.length > 0) {
  32293. shape.holePolygonPointLists = holePolygonPointLists;
  32294. }
  32295. //修改一些 shape 可选属性,通常不需要这么做
  32296. if (this.shapeOptions) {
  32297. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  32298. }
  32299. this.shapes.push(shape);
  32300. }
  32301. /**
  32302. * @function FeatureThemeVector.prototype.rectangleToTF
  32303. * @description 转换矩形要素。
  32304. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 Rectangle。
  32305. */
  32306. rectangleToTF(geometry) {
  32307. //参考位置,参考中心为
  32308. var location = this.location;
  32309. var ll = new LonLat(geometry.x, geometry.y);
  32310. //地图分辨率
  32311. var res = this.layer.map.getResolution();
  32312. //geometry 像素坐标
  32313. var localLX = this.getLocalXY(ll);
  32314. //赋 style
  32315. var style = new Object();
  32316. style.r = 6; //防止漏设此参数,默认 6 像素
  32317. style = Util_Util.copyAttributesWithClip(style, this.style);
  32318. style.x = localLX[0] - location[0];
  32319. // Rectangle 使用左下角定位, SmicRectangle 使用左上角定位,需要转换
  32320. style.y = (localLX[1] - location[1]) - 2 * geometry.width / res;
  32321. style.width = geometry.width / res;
  32322. style.height = geometry.height / res;
  32323. //创建图形
  32324. var shape = new SmicRectangle({
  32325. style: style,
  32326. clickable: this.isClickAble,
  32327. hoverable: this.isHoverAble
  32328. });
  32329. //设置高亮样式
  32330. if (this.highlightStyle) {
  32331. shape.highlightStyle = this.highlightStyle;
  32332. }
  32333. //设置参考中心,指定图形位置
  32334. shape.refOriginalPosition = location;
  32335. //储存数据 id 属性,用于事件
  32336. shape.refDataID = this.data.id;
  32337. //储存数据 id 属性,用于事件-多图形同时高亮
  32338. shape.isHoverByRefDataID = this.isMultiHover;
  32339. //修改一些 shape 可选属性,通常不需要这么做
  32340. if (this.shapeOptions) {
  32341. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  32342. }
  32343. this.shapes.push(shape);
  32344. }
  32345. /**
  32346. * @function FeatureThemeVector.prototype.geoTextToTF
  32347. * @description 转换文本要素。
  32348. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 GeoText。
  32349. */
  32350. geoTextToTF(geometry) {
  32351. //参考位置,参考中心为
  32352. var location = this.location;
  32353. //geometry 像素坐标
  32354. var localLX = this.getLocalXY(geometry);
  32355. //赋 style
  32356. var style = new Object();
  32357. style.r = 6; //防止漏设此参数,默认 6 像素
  32358. style = Util_Util.copyAttributesWithClip(style, this.style, ["x", "y", "text"]);
  32359. style.x = localLX[0] - location[0];
  32360. style.y = localLX[1] - location[1];
  32361. style.text = geometry.text;
  32362. //创建图形
  32363. var shape = new SmicText({
  32364. style: style,
  32365. clickable: this.isClickAble,
  32366. hoverable: this.isHoverAble
  32367. });
  32368. //设置高亮样式
  32369. if (this.highlightStyle) {
  32370. shape.highlightStyle = this.highlightStyle;
  32371. }
  32372. //设置参考中心,指定图形位置
  32373. shape.refOriginalPosition = location;
  32374. //储存数据 id 属性,用于事件
  32375. shape.refDataID = this.data.id;
  32376. //储存数据 id 属性,用于事件-多图形同时高亮
  32377. shape.isHoverByRefDataID = this.isMultiHover;
  32378. //修改一些 shape 可选属性,通常不需要这么做
  32379. if (this.shapeOptions) {
  32380. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  32381. }
  32382. this.shapes.push(shape);
  32383. }
  32384. /**
  32385. * @function FeatureThemeVector.prototype.updateAndAddShapes
  32386. * @description 修改位置,针对地图平移操作,地图漫游操作后调用此函数。
  32387. */
  32388. updateAndAddShapes() {
  32389. var newLocalLX = this.getLocalXY(this.lonlat);
  32390. this.location = newLocalLX;
  32391. var render = this.layer.renderer;
  32392. for (var i = 0, len = this.shapes.length; i < len; i++) {
  32393. var shape = this.shapes[i];
  32394. //设置参考中心,指定图形位置
  32395. shape.refOriginalPosition = newLocalLX;
  32396. render.addShape(shape);
  32397. }
  32398. }
  32399. /**
  32400. * @function FeatureThemeVector.prototype.getShapesCount
  32401. * @description 获得专题要素中可视化图形的数量。
  32402. * @returns {number} 可视化图形的数量。
  32403. */
  32404. getShapesCount() {
  32405. return this.shapes.length;
  32406. }
  32407. /**
  32408. * @function FeatureThemeVector.prototype.getLocalXY
  32409. * @description 地理坐标转为像素坐标。
  32410. * @param {LonLat} lonlat - 专题要素地理位置。
  32411. */
  32412. getLocalXY(lonlat) {
  32413. return this.layer.getLocalXY(lonlat);
  32414. }
  32415. }
  32416. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/theme/GeoFeatureThemeLayer.js
  32417. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32418. * This program are made available under the terms of the Apache License, Version 2.0
  32419. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32420. /**
  32421. * @class GeoFeatureThemeLayer
  32422. * @category Visualization Theme
  32423. * @modulecategory Overlay
  32424. * @classdesc 地理几何专题要素型专题图层类。
  32425. * @param {string} name - 图层名。
  32426. * @param {Object} options - 参数。
  32427. * @param {mapboxgl.Map} options.map - MapBoxGL Map 对象。
  32428. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  32429. * @param {boolean} [options.loadWhileAnimating=true] - 是否实时重绘。
  32430. * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离。
  32431. * @param {boolean} [options.isHoverAble=false] - 图形是否在 hover 时高亮。
  32432. * @param {boolean} [options.isMultiHover=false] - 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
  32433. * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
  32434. * @param {boolean} [options.isAllowFeatureStyle=false] - 是否允许 feature 样式(style) 中的有效属性应用到专题图层。
  32435. * 禁止对专题要素使用数据(feature)的 style。
  32436. * 此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature) 对应专题要素赋予独立 style。
  32437. * @param {number} [options.opacity=1] - 图层不透明度。
  32438. * @extends {ThemeLayer}
  32439. * @fires GeoFeatureThemeLayer#beforefeaturesadded
  32440. * @usage
  32441. */
  32442. class GeoFeature extends ThemeLayer_Theme {
  32443. constructor(name, options) {
  32444. super(name, options);
  32445. /**
  32446. * @member {string} GeoFeatureThemeLayer.prototype.name
  32447. * @description 专题图图层名称。
  32448. */
  32449. this.name = null;
  32450. /**
  32451. * @member {ThemeStyle} GeoFeatureThemeLayer.prototype.style
  32452. * @description 专题图图层全局样式。
  32453. */
  32454. this.style = null;
  32455. /**
  32456. * @member {ThemeStyle} GeoFeatureThemeLayer.prototype.highlightStyle
  32457. * @description 专题图图层高亮样式。
  32458. */
  32459. this.highlightStyle = null;
  32460. /**
  32461. * @member {number} [GeoFeatureThemeLayer.prototype.nodesClipPixel=2]
  32462. * @description 节点抽稀像素距离。
  32463. */
  32464. this.nodesClipPixel = 2;
  32465. /**
  32466. * @member {boolean} [GeoFeatureThemeLayer.prototype.isHoverAble=false]
  32467. * @description 图形是否在 hover 时高亮。
  32468. */
  32469. this.isHoverAble = false;
  32470. /**
  32471. * @member {boolean} [GeoFeatureThemeLayer.prototype.isMultiHover=false]
  32472. * @description 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
  32473. */
  32474. this.isMultiHover = false;
  32475. /**
  32476. * @member {boolean} [GeoFeatureThemeLayer.prototype.isClickAble=true]
  32477. * @description 图形是否可点击。
  32478. */
  32479. this.isClickAble = true;
  32480. /**
  32481. * @member {boolean} [GeoFeatureThemeLayer.prototype.isAllowFeatureStyle=false]
  32482. * @description 是否允许 feature 样式(style) 中的有效属性应用到专题图层。</br>
  32483. * 禁止对专题要素使用数据(feature)的 style。此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature) 对应专题要素赋予独立 style。
  32484. */
  32485. this.isAllowFeatureStyle = false;
  32486. Util_Util.extend(this, options);
  32487. this.cache = options.cache || {};
  32488. this.cacheFields = options.cacheFields || [];
  32489. this.maxCacheCount = options.maxCacheCount || 0;
  32490. this.isCustomSetMaxCacheCount = options.isCustomSetMaxCacheCount === undefined ? false : options.isCustomSetMaxCacheCount;
  32491. }
  32492. /**
  32493. * @function GeoFeatureThemeLayer.prototype.addFeatures
  32494. * @description 添加要素。
  32495. * @param {ThemeFeature|ServerFeature} features - 要素对象。
  32496. */
  32497. addFeatures(features) {
  32498. /**
  32499. * @event GeoFeatureThemeLayer#beforefeaturesadded
  32500. * @description 要素添加之前触发。
  32501. * @property {ThemeFeature|ServerFeature} features - 被添加的要素。
  32502. */
  32503. external_mapboxgl_default().Evented.prototype.fire('beforefeaturesadded', {features: features});
  32504. //转换 features 形式
  32505. this.features = this.toiClientFeature(features);
  32506. if (!this.isCustomSetMaxCacheCount) {
  32507. this.maxCacheCount = this.features.length * 5;
  32508. }
  32509. //绘制专题要素
  32510. if (this.renderer) {
  32511. this.redrawThematicFeatures(this.map.getBounds());
  32512. }
  32513. }
  32514. /**
  32515. * @function GeoFeatureThemeLayer.prototype.removeFeatures
  32516. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。
  32517. * @param {(FeatureVector|Function)} features - 要删除的要素对象或用于过滤的回调函数。
  32518. */
  32519. removeFeatures(features) {
  32520. this.clearCache();
  32521. ThemeLayer_Theme.prototype.removeFeatures.call(this, features);
  32522. }
  32523. /**
  32524. * @function GeoFeatureThemeLayer.prototype.removeAllFeatures
  32525. * @description 清除当前图层所有的矢量要素。
  32526. */
  32527. removeAllFeatures() {
  32528. this.clearCache();
  32529. ThemeLayer_Theme.prototype.removeAllFeatures.apply(this, arguments);
  32530. }
  32531. /**
  32532. * @function GeoFeatureThemeLayer.prototype.redrawThematicFeatures
  32533. * @description 重绘所有专题要素。
  32534. * @param {mapboxgl.LngLatBounds} extent - 重绘的范围。
  32535. */
  32536. redrawThematicFeatures(extent) { // eslint-disable-line no-unused-vars
  32537. this.clearCache();
  32538. //获取高亮专题要素对应的用户 id
  32539. var hoverone = this.renderer.getHoverOne();
  32540. var hoverFid = null;
  32541. if (hoverone && hoverone.refDataID) {
  32542. hoverFid = hoverone.refDataID;
  32543. }
  32544. //清除当前所有可视元素
  32545. this.renderer.clearAll();
  32546. var features = this.features;
  32547. var cache = this.cache;
  32548. var cacheFields = this.cacheFields;
  32549. var cmZoom = this.map.getZoom();
  32550. var maxCC = this.maxCacheCount;
  32551. for (var i = 0, len = features.length; i < len; i++) {
  32552. var feature = features[i];
  32553. // var feaBounds = feature.geometry.getBounds();
  32554. //
  32555. // //剔除当前视图(地理)范围以外的数据
  32556. // if (extent) {
  32557. // var bounds = new Bounds(extent.getWest(), extent.getSouth(), extent.getEast(), extent.getNorth());
  32558. // // if (!bounds.intersectsBounds(feaBounds)) continue;
  32559. // }
  32560. //缓存字段
  32561. var fields = feature.id + "_zoom_" + cmZoom.toString();
  32562. var thematicFeature;
  32563. //判断专题要素缓存是否存在
  32564. if (cache[fields]) {
  32565. cache[fields].updateAndAddShapes();
  32566. } else {
  32567. //如果专题要素缓存不存在,创建专题要素
  32568. thematicFeature = this.createThematicFeature(features[i]);
  32569. //检查 thematicFeature 是否有可视化图形
  32570. if (thematicFeature.getShapesCount() < 1) {
  32571. continue;
  32572. }
  32573. //加入缓存
  32574. cache[fields] = thematicFeature;
  32575. cacheFields.push(fields);
  32576. //缓存数量限制
  32577. if (cacheFields.length > maxCC) {
  32578. var fieldsTemp = cacheFields[0];
  32579. cacheFields.splice(0, 1);
  32580. delete cache[fieldsTemp];
  32581. }
  32582. }
  32583. }
  32584. this.renderer.render();
  32585. //地图漫游后,重新高亮图形
  32586. if (hoverFid && this.isHoverAble && this.isMultiHover) {
  32587. var hShapes = this.getShapesByFeatureID(hoverFid);
  32588. this.renderer.updateHoverShapes(hShapes);
  32589. }
  32590. }
  32591. /**
  32592. * @function GeoFeatureThemeLayer.prototype.createThematicFeature
  32593. * @description 创建专题要素。
  32594. * @param {FeatureVector} feature - 要素对象。
  32595. * @returns {Array.<FeatureVector>} 返回矢量要素。
  32596. */
  32597. createThematicFeature(feature) {
  32598. var style = Util_Util.copyAttributesWithClip(this.style);
  32599. if (feature.style && this.isAllowFeatureStyle === true) {
  32600. style = Util_Util.copyAttributesWithClip(feature.style);
  32601. }
  32602. //创建专题要素时的可选参数
  32603. var options = {};
  32604. options.nodesClipPixel = this.nodesClipPixel;
  32605. options.isHoverAble = this.isHoverAble;
  32606. options.isMultiHover = this.isMultiHover;
  32607. options.isClickAble = this.isClickAble;
  32608. options.highlightStyle = ShapeFactory.transformStyle(this.highlightStyle);
  32609. //将数据转为专题要素(Vector)
  32610. var thematicFeature = new ThemeVector(feature, this, ShapeFactory.transformStyle(style), options);
  32611. //直接添加图形到渲染器
  32612. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  32613. this.renderer.addShape(thematicFeature.shapes[m]);
  32614. }
  32615. return thematicFeature;
  32616. }
  32617. /**
  32618. * @function GeoFeatureThemeLayer.prototype.clearCache
  32619. * @description 清除缓存。
  32620. */
  32621. clearCache() {
  32622. this.cache = {};
  32623. this.cacheFields = [];
  32624. }
  32625. /**
  32626. * @function GeoFeatureThemeLayer.prototype.clear
  32627. * @description 清除的内容包括数据(features)、专题要素和缓存。
  32628. */
  32629. clear() {
  32630. this.renderer.clearAll();
  32631. this.renderer.refresh();
  32632. this.removeAllFeatures();
  32633. this.clearCache();
  32634. }
  32635. /**
  32636. * @function GeoFeatureThemeLayer.prototype.getCacheCount
  32637. * @description 获取当前缓存数量。
  32638. * @returns {number} 当前缓存数量。
  32639. */
  32640. getCacheCount() {
  32641. return this.cacheFields.length;
  32642. }
  32643. /**
  32644. * @function GeoFeatureThemeLayer.prototype.setMaxCacheCount
  32645. * @param {number} [cacheCount] - 缓存总数。
  32646. * @description 设置最大缓存条数。
  32647. */
  32648. setMaxCacheCount(cacheCount) {
  32649. if (!isNaN(cacheCount)) {
  32650. this.maxCacheCount = cacheCount;
  32651. this.isCustomSetMaxCacheCount = true;
  32652. }
  32653. }
  32654. /**
  32655. * @function GeoFeatureThemeLayer.prototype.getShapesByFeatureID
  32656. * @param {number} [featureID=si.refDataID] - 要素 ID。
  32657. * @description 通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
  32658. * @returns {Array} 返回图形数组。
  32659. */
  32660. getShapesByFeatureID(featureID) {
  32661. var list = [];
  32662. var shapeList = this.renderer.getAllShapes();
  32663. if (!featureID) {
  32664. return shapeList
  32665. }
  32666. for (var i = 0, len = shapeList.length; i < len; i++) {
  32667. var si = shapeList[i];
  32668. if (si.refDataID && featureID === si.refDataID) {
  32669. list.push(si);
  32670. }
  32671. }
  32672. return list;
  32673. }
  32674. }
  32675. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/LabelThemeLayer.js
  32676. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32677. * This program are made available under the terms of the Apache License, Version 2.0
  32678. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32679. /**
  32680. * @class LabelThemeLayer
  32681. * @category Visualization Theme
  32682. * @classdesc 标签专题图层类。
  32683. * @modulecategory Overlay
  32684. * @param {string} name - 图层名。
  32685. * @param {Object} options - 参数。
  32686. * @param {mapboxgl.Map} options.map - MapBoxGL Map 对象。
  32687. * @param {string} options.themeField - 指定创建专题图字段。
  32688. * @param {Object} options.style - 专题图样式。
  32689. * @param {Object} options.styleGroups - 各专题类型样式组。
  32690. * @param {Object} [options.highlightStyle] - hover 的高亮样式。
  32691. * @param {string} [options.id] - 专题图层 ID。专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  32692. * @param {boolean} [options.loadWhileAnimating=true] - 是否实时重绘。
  32693. * @param {number} [options.opacity=1] - 图层不透明度。
  32694. * @param {boolean} [options.isAvoid=true] - 是否进行地图边缘的避让处理。
  32695. * @param {boolean} [options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  32696. * @param {boolean} [options.isHoverAble] - 是否开启 hover 事件。
  32697. * @extends {GeoFeatureThemeLayer}
  32698. * @usage
  32699. */
  32700. class LabelThemeLayer_Label extends GeoFeature {
  32701. constructor(name, options) {
  32702. super(name, options);
  32703. /**
  32704. * @member {boolean} [LabelThemeLayer.prototype.isOverLay=true]
  32705. * @description 是否进行压盖处理,如果设为 true,将隐藏被压盖的标签。
  32706. */
  32707. this.isOverLay = true;
  32708. /**
  32709. * @member {boolean} [LabelThemeLayer.prototype.isAvoid=true]
  32710. * @description 是否进行地图边缘的避让处理,如果设为 true,将把与地图边缘相交的标签移到地图范围内,在地图边缘处做避让处理。
  32711. */
  32712. this.isAvoid = true;
  32713. /**
  32714. * @member {string} LabelThemeLayer.prototype.themeField
  32715. * @description 用于指定专题要素样式的属性字段名称。</br>
  32716. * 此属性字段是要用户数据(feature) attributes 中包含的字段,且字段对应的值的类型必须是数值型。</br>
  32717. * 使用标签分组显示还需要设置 styleGroups 属性。
  32718. */
  32719. this.themeField = null;
  32720. /**
  32721. * @member {Array.<Object>} LabelThemeLayer.prototype.styleGroups
  32722. * @description 分组样式。使用此属性需要设置 themeField 属性。</br>
  32723. * 1.没有同时设置 themeField 和 styleGroups,则所有专题要素都使用本图层的 style 进行渲染;</br>
  32724. * 2.同时设置 themeField 和 styleGroups,则按照 themeField 指定的字段名称获取用户数据(feature)attributes 中对应的属性值;</br>
  32725. * &nbsp;&nbsp;a.如果属性值等于 styleGroups 数组里某个元素定义的 value 值,则此专题要素取 styleGroups 数组中该元素定义的 style 进行渲染。</br>
  32726. * &nbsp;&nbsp;b.如果属性值不等于 styleGroups 数组里任何元素定义的 value 值,则此专题要素按照本图层的 style 进行渲染。</br>
  32727. * 此数组每个元素对象必须有两个属性:value : 与字段 themeField 相对应的属性值;style:专题要素 style。
  32728. */
  32729. this.styleGroups = null;
  32730. Util_Util.extend(this, options);
  32731. this.defaultStyle = {
  32732. //默认文本样式
  32733. fontColor: "#000000",
  32734. fontOpacity: 1,
  32735. fontSize: "12px",
  32736. fontStyle: "normal",
  32737. fontWeight: "normal",
  32738. labelAlign: "cm",
  32739. labelXOffset: 0,
  32740. labelYOffset: 0,
  32741. labelRotation: 0,
  32742. //默认样式
  32743. fill: false,
  32744. fillColor: "#ee9900",
  32745. fillOpacity: 0.4,
  32746. stroke: false,
  32747. strokeColor: "#ee9900",
  32748. strokeOpacity: 1,
  32749. strokeWidth: 1,
  32750. strokeLinecap: "round",
  32751. strokeDashstyle: "solid",
  32752. //默认显示背景框
  32753. labelRect: true,
  32754. //对用户隐藏但必须保持此值的属性
  32755. //cursor: "pointer",
  32756. labelSelect: true,
  32757. //用 _isGeoTextStrategyStyle 标记此style,携带此类style的要素特指GeoText策略中的标签要素
  32758. _isGeoTextStrategyStyle: true
  32759. };
  32760. //获取标签像素 bounds 的方式。0 - 表示通过文本类容和文本风格计算获取像素范围,现在支持中文、英文; 1 - 表示通过绘制的文本标签获取像素范围,支持各个语种的文字范围获取,但性能消耗较大(尤其是采用SVG渲染)。默认值为0。
  32761. this.getPxBoundsMode = 0;
  32762. this.labelFeatures = [];
  32763. }
  32764. /**
  32765. * @function LabelThemeLayer.prototype.redrawThematicFeatures
  32766. * @description 重绘所有专题要素。</br>
  32767. * 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。</br>
  32768. * 地图漫游时调用此方法进行图层刷新。
  32769. * @param {mapboxgl.LngLatBounds} bounds - 重绘范围。
  32770. */
  32771. redrawThematicFeatures(bounds) {
  32772. if (this.features.length > 0 && this.labelFeatures.length == 0) {
  32773. var feats = this.setLabelsStyle(this.features);
  32774. for (var i = 0, len = feats.length; i < len; i++) {
  32775. this.labelFeatures.push(feats[i]);
  32776. }
  32777. }
  32778. this.features = this.getDrawnLabels(this.labelFeatures);
  32779. super.redrawThematicFeatures.call(this, bounds);
  32780. }
  32781. /**
  32782. * @function LabelThemeLayer.prototype.removeFeatures
  32783. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。
  32784. * @param {(Array.<FeatureVector>|FeatureVector|Function)} features - 要删除的要素对象或用于过滤的回调函数。
  32785. */
  32786. removeFeatures(features) {
  32787. this.labelFeatures = [];
  32788. super.removeFeatures.call(this, features);
  32789. }
  32790. /**
  32791. * @function LabelThemeLayer.prototype.removeAllFeatures
  32792. * @description 清除当前图层所有的矢量要素。
  32793. */
  32794. removeAllFeatures() {
  32795. this.labelFeatures = [];
  32796. super.removeAllFeatures.call(this, arguments);
  32797. }
  32798. /**
  32799. * @function LabelThemeLayer.prototype.createThematicFeature
  32800. * @description 创建专题图要素。
  32801. * @param {Object} feature - 要创建的专题图形要素。
  32802. */
  32803. createThematicFeature(feature) {
  32804. //赋 style
  32805. var style = this.getStyleByData(feature);
  32806. //创建专题要素时的可选参数
  32807. var options = {};
  32808. options.nodesClipPixel = this.nodesClipPixel;
  32809. options.isHoverAble = this.isHoverAble;
  32810. options.isMultiHover = this.isMultiHover;
  32811. options.isClickAble = this.isClickAble;
  32812. options.highlightStyle = ShapeFactory.transformStyle(this.highlightStyle);
  32813. //将数据转为专题要素(Vector)
  32814. var thematicFeature = new ThemeVector(feature, this, ShapeFactory.transformStyle(style), options);
  32815. //直接添加图形到渲染器
  32816. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  32817. this.renderer.addShape(thematicFeature.shapes[m]);
  32818. }
  32819. return thematicFeature;
  32820. }
  32821. /**
  32822. * @function LabelThemeLayer.prototype.getDrawnLabels
  32823. * @description 获取经(压盖)处理后将要绘制在图层上的标签要素。
  32824. * @param {Array.<FeatureVector>} labelFeatures - 所有标签要素的数组。
  32825. * @returns {Array.<FeatureVector>} 最终要绘制的标签要素数组。
  32826. */
  32827. getDrawnLabels(labelFeatures) {
  32828. var feas = [], //最终要绘制的标签要素集
  32829. fea, //最终要绘制的标签要素
  32830. fi, //临时标签要素,用户的第i个标签
  32831. labelsB = [], //不产生压盖的标签要素范围集
  32832. styTmp, //用于临时存储要素style的变量
  32833. feaSty, //标签要素最终的style
  32834. // styleTemp用于屏蔽文本style中带有偏移性质style属性,偏移已经在计算bounds的过程中参与了运算,
  32835. // 所以在最终按照bounds来绘制标签时,需屏蔽style中带有偏移性质属性,否则文本的偏移量将扩大一倍。
  32836. styleTemp = {
  32837. labelAlign: "cm",
  32838. labelXOffset: 0,
  32839. labelYOffset: 0
  32840. };
  32841. var map = this.map;
  32842. var zoom = map.getZoom();
  32843. var canvas = map.getCanvas();
  32844. var mapSize = {
  32845. x: parseFloat(canvas.style.width),
  32846. y: parseFloat(canvas.style.height)
  32847. };
  32848. //对用户的每个标签要素进行处理与判断
  32849. for (var i = 0, len = labelFeatures.length; i < len; i++) {
  32850. fi = labelFeatures[i];
  32851. //检查fi的style在避让中是否被改变,如果改变,重新设置要素的style
  32852. if (fi.isStyleChange || fi.isStyleChange === undefined) {
  32853. fi = this.setStyle(fi);
  32854. }
  32855. //标签最终的中心点像素位置 (偏移后)
  32856. var loc = this.getLabelPxLocation(fi);
  32857. //过滤掉地图范围外的标签 (偏移后)
  32858. if ((loc.x >= 0 && loc.x <= mapSize.x) && (loc.y >= 0 && loc.y <= mapSize.y)) {
  32859. //根据当前地图缩放级别过滤标签
  32860. if (fi.style.minZoomLevel > -1) {
  32861. if (zoom <= fi.style.minZoomLevel) {
  32862. continue;
  32863. }
  32864. }
  32865. if (fi.style.maxZoomLevel > -1) {
  32866. if (zoom > fi.style.maxZoomLevel) {
  32867. continue;
  32868. }
  32869. }
  32870. //计算标签bounds
  32871. var boundsQuad = null;
  32872. if (fi.isStyleChange) {
  32873. fi.isStyleChange = null;
  32874. boundsQuad = this.calculateLabelBounds(fi, loc);
  32875. } else {
  32876. if (fi.geometry.bsInfo.w && fi.geometry.bsInfo.h) {
  32877. //使用calculateLabelBounds2可以提高bounds的计算效率,尤其是在getPxBoundsMode = 1时
  32878. boundsQuad = this.calculateLabelBounds2(fi, loc);
  32879. } else {
  32880. boundsQuad = this.calculateLabelBounds(fi, loc);
  32881. }
  32882. }
  32883. //避让处理 -start
  32884. var mapViewBounds = new Bounds(0, mapSize.y, mapSize.x, 0), //地图像素范围
  32885. quadlen = boundsQuad.length;
  32886. if (this.isAvoid) {
  32887. var avoidInfo = this.getAvoidInfo(mapViewBounds, boundsQuad); //避让信息
  32888. if (avoidInfo) {
  32889. //横向(x方向)上的避让
  32890. if (avoidInfo.aspectW === "left") {
  32891. fi.style.labelXOffset += avoidInfo.offsetX;
  32892. for (let j = 0; j < quadlen; j++) {
  32893. boundsQuad[j].x += avoidInfo.offsetX;
  32894. }
  32895. } else if (avoidInfo.aspectW === "right") {
  32896. fi.style.labelXOffset += (-avoidInfo.offsetX);
  32897. for (let j = 0; j < quadlen; j++) {
  32898. boundsQuad[j].x += (-avoidInfo.offsetX);
  32899. }
  32900. }
  32901. //纵向(y方向)上的避让
  32902. if (avoidInfo.aspectH === "top") {
  32903. fi.style.labelYOffset += avoidInfo.offsetY;
  32904. for (let j = 0; j < quadlen; j++) {
  32905. boundsQuad[j].y += avoidInfo.offsetY;
  32906. }
  32907. } else if (avoidInfo.aspectH === "bottom") {
  32908. fi.style.labelYOffset += (-avoidInfo.offsetY);
  32909. for (let j = 0; j < quadlen; j++) {
  32910. boundsQuad[j].y += (-avoidInfo.offsetY);
  32911. }
  32912. }
  32913. //如果style发生变化,记录下来
  32914. fi.isStyleChange = true;
  32915. }
  32916. }
  32917. //避让处理 -end
  32918. //压盖处理 -start
  32919. if (this.isOverLay) {
  32920. //是否压盖
  32921. var isOL = false;
  32922. if (i != 0) {
  32923. for (let j = 0; j < labelsB.length; j++) {
  32924. //压盖判断
  32925. if (this.isQuadrilateralOverLap(boundsQuad, labelsB[j])) {
  32926. isOL = true;
  32927. break;
  32928. }
  32929. }
  32930. }
  32931. if (isOL) {
  32932. continue;
  32933. } else {
  32934. labelsB.push(boundsQuad);
  32935. }
  32936. }
  32937. //压盖处理 -end
  32938. //背景(事件)-start
  32939. //将标签像素范围转为地理范围
  32940. var geoBs = [];
  32941. for (let j = 0; j < quadlen - 1; j++) {
  32942. geoBs.push(map.unproject(boundsQuad[j]));
  32943. }
  32944. //屏蔽有偏移性质的style属性,偏移量在算bounds时已经加入计算
  32945. var leftBottom = geoBs[3];
  32946. var rightTop = geoBs[1];
  32947. var bounds = new Bounds(leftBottom.lng, leftBottom.lat, rightTop.lng, rightTop.lat);
  32948. var center = bounds.getCenterLonLat();
  32949. var label = new GeoText(center.lon, center.lat, fi.attributes[this.themeField]);
  32950. label.calculateBounds();
  32951. styTmp = Util_Util.cloneObject(fi.style);
  32952. feaSty = Util_Util.cloneObject(Util_Util.copyAttributes(styTmp, styleTemp));
  32953. fea = new Vector(label, fi.attributes, feaSty);
  32954. //赋予id
  32955. fea.id = fi.id;
  32956. fea.fid = fi.fid;
  32957. feas.push(fea);
  32958. }
  32959. }
  32960. //返回最终要绘制的标签要素
  32961. return feas;
  32962. }
  32963. /**
  32964. * @function LabelThemeLayer.prototype.getStyleByData
  32965. * @description 根据用户数据(feature)设置专题要素的 Style。
  32966. * @param {FeatureVector} feat - 矢量要素对象。
  32967. * @returns {Array.<ThemeStyle>} 专题要素的 Style。
  32968. */
  32969. getStyleByData(feat) {
  32970. var feature = feat;
  32971. feature.style = Util_Util.copyAttributes(feature.style, this.defaultStyle);
  32972. //将style赋给标签
  32973. if (this.style && this.style.fontSize && parseFloat(this.style.fontSize) < 12) {
  32974. this.style.fontSize = "12px";
  32975. }
  32976. feature.style = Util_Util.copyAttributes(feature.style, this.style);
  32977. if (this.themeField && this.styleGroups && feature.attributes) {
  32978. var Sf = this.themeField;
  32979. var attributes = feature.attributes;
  32980. var groups = this.styleGroups;
  32981. var isSfInAttrs = false; //指定的 groupField 是否是geotext的属性字段之一
  32982. var attr = null; //属性值
  32983. for (var property in attributes) {
  32984. if (Sf === property) {
  32985. isSfInAttrs = true;
  32986. attr = attributes[property];
  32987. break;
  32988. }
  32989. }
  32990. //判断属性值是否属于styleGroups的某一个范围,以便对标签分组
  32991. if (isSfInAttrs) {
  32992. for (var i = 0, len = groups.length; i < len; i++) {
  32993. if ((attr >= groups[i].start) && (attr < groups[i].end)) {
  32994. var sty1 = groups[i].style;
  32995. if (sty1 && sty1.fontSize && parseFloat(sty1.fontSize) < 12) {
  32996. sty1.fontSize = "12px";
  32997. }
  32998. feature.style = Util_Util.copyAttributes(feature.style, sty1);
  32999. }
  33000. }
  33001. }
  33002. feature.style.label = feature.attributes[this.themeField]
  33003. }
  33004. return feature.style;
  33005. }
  33006. /**
  33007. * @function LabelThemeLayer.prototype.setLabelsStyle
  33008. * @description 设置标签要素的 Style。
  33009. * @param {Array.<FeatureVector>} labelFeatures - 需要设置 Style 的标签要素数组。
  33010. * @returns {Array.<FeatureVector>} 赋予 Style 后的标签要素数组。
  33011. */
  33012. setLabelsStyle(labelFeatures) {
  33013. var fea, labelFeas = [];
  33014. for (var i = 0, len = labelFeatures.length; i < len; i++) {
  33015. var feature = labelFeatures[i];
  33016. if (feature.geometry.CLASS_NAME === "SuperMap.Geometry.GeoText") {
  33017. //设置标签的Style
  33018. if (feature.geometry.bsInfo.w || feature.geometry.bsInfo.h) {
  33019. feature.geometry.bsInfo.w = null;
  33020. feature.geometry.bsInfo.h = null;
  33021. feature.geometry.labelWTmp = null;
  33022. }
  33023. fea = this.setStyle(feature);
  33024. //为标签要素指定图层
  33025. fea.layer = this.layer;
  33026. labelFeas.push(fea);
  33027. } else {
  33028. return labelFeatures;
  33029. }
  33030. }
  33031. return labelFeas;
  33032. }
  33033. /**
  33034. * @function LabelThemeLayer.prototype.setStyle
  33035. * @description 设置标签要素的Style。
  33036. * @param {FeatureVector} feat - 需要赋予 style 的要素。
  33037. */
  33038. setStyle(feat) {
  33039. var feature = feat;
  33040. feature.style = Util_Util.copyAttributes(feature.style, this.defaultStyle);
  33041. //将style赋给标签
  33042. if (this.style && this.style.fontSize && parseFloat(this.style.fontSize) < 12) {
  33043. this.style.fontSize = "12px";
  33044. }
  33045. feature.style = Util_Util.copyAttributes(feature.style, this.style);
  33046. if (this.groupField && this.styleGroups && feature.attributes) {
  33047. var Sf = this.groupField;
  33048. var Attrs = feature.attributes;
  33049. var Gro = this.styleGroups;
  33050. var isSfInAttrs = false; //指定的 groupField 是否是geotext的属性字段之一
  33051. var attr = null; //属性值
  33052. for (var property in Attrs) {
  33053. if (Sf === property) {
  33054. isSfInAttrs = true;
  33055. attr = Attrs[property];
  33056. break;
  33057. }
  33058. }
  33059. //判断属性值是否属于styleGroups的某一个范围,以便对标签分组
  33060. if (isSfInAttrs) {
  33061. for (var i = 0, len = Gro.length; i < len; i++) {
  33062. if ((attr >= Gro[i].start) && (attr < Gro[i].end)) {
  33063. //feature.style = Util.copyAttributes(feature.style, this.defaultStyle);
  33064. var sty1 = Gro[i].style;
  33065. if (sty1 && sty1.fontSize && parseFloat(sty1.fontSize) < 12) {
  33066. sty1.fontSize = "12px";
  33067. }
  33068. feature.style = Util_Util.copyAttributes(feature.style, sty1);
  33069. }
  33070. }
  33071. }
  33072. }
  33073. //将文本内容赋到标签要素的style上
  33074. feature.style.label = feature.geometry.text;
  33075. return feature;
  33076. }
  33077. /**
  33078. * @function LabelThemeLayer.prototype.getLabelPxLocation
  33079. * @description 获取标签要素的像素坐标。
  33080. * @param {FeatureVector} feature - 标签要素。
  33081. * @returns {mapboxgl.Point} 标签位置。
  33082. */
  33083. getLabelPxLocation(feature) {
  33084. var geoText = feature.geometry;
  33085. var styleTmp = feature.style;
  33086. //将标签的地理位置转为像素位置
  33087. var locationTmp = geoText.getCentroid();
  33088. var locTmp = this.map.project(new (external_mapboxgl_default()).LngLat(locationTmp.x, locationTmp.y));
  33089. var loc = new (external_mapboxgl_default()).Point(locTmp.x, locTmp.y);
  33090. //偏移处理
  33091. if (styleTmp.labelXOffset || styleTmp.labelYOffset) {
  33092. var xOffset = isNaN(styleTmp.labelXOffset) ? 0 : styleTmp.labelXOffset;
  33093. var yOffset = isNaN(styleTmp.labelYOffset) ? 0 : styleTmp.labelYOffset;
  33094. var point = loc.add(new (external_mapboxgl_default()).Point(xOffset, -yOffset));
  33095. return new (external_mapboxgl_default()).Point(point.x, point.y);
  33096. } else {
  33097. return new (external_mapboxgl_default()).Point(loc.x, loc.y);
  33098. }
  33099. }
  33100. /**
  33101. * @function LabelThemeLayer.prototype.calculateLabelBounds
  33102. * @description 获得标签要素的最终范围。
  33103. *
  33104. * @param {FeatureVector} feature - 需要计算 bounds 的标签要素数。
  33105. * @param {mapboxgl.Point} loc - 标签位置。
  33106. *
  33107. * @returns {Array.<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  33108. */
  33109. calculateLabelBounds(feature, loc) {
  33110. var geoText = feature.geometry;
  33111. //标签范围(未旋转前)
  33112. var labB = null;
  33113. var labelInfo = null;
  33114. //获取bounds的方式
  33115. if (this.getPxBoundsMode == 0) {
  33116. labB = geoText.getLabelPxBoundsByText(loc, feature.style);
  33117. } else if (this.getPxBoundsMode === 1) {
  33118. //canvas
  33119. labelInfo = this.getLabelInfo(feature.geometry.getCentroid(), feature.style);
  33120. labB = geoText.getLabelPxBoundsByLabel(loc, labelInfo.w, labelInfo.h, feature.style);
  33121. } else {
  33122. return null;
  33123. }
  33124. //旋转Bounds
  33125. var boundsQuad = [];
  33126. if ((feature.style.labelRotation % 180) == 0) {
  33127. boundsQuad = [{
  33128. "x": labB.left,
  33129. "y": labB.top
  33130. },
  33131. {
  33132. "x": labB.right,
  33133. "y": labB.top
  33134. },
  33135. {
  33136. "x": labB.right,
  33137. "y": labB.bottom
  33138. },
  33139. {
  33140. "x": labB.left,
  33141. "y": labB.bottom
  33142. },
  33143. {
  33144. "x": labB.left,
  33145. "y": labB.top
  33146. }
  33147. ];
  33148. } else {
  33149. boundsQuad = this.rotationBounds(labB, loc, feature.style.labelRotation);
  33150. }
  33151. //重置GeoText的bounds
  33152. geoText.bounds = new Bounds(boundsQuad[1].x, boundsQuad[3].y, boundsQuad[2].x, boundsQuad[4].y);
  33153. return boundsQuad;
  33154. }
  33155. /**
  33156. * @function LabelThemeLayer.prototype.calculateLabelBounds2
  33157. * @description 获得标签要素的最终范围的另一种算法(通过记录下的标签宽高),提高计算 bounds 的效率。
  33158. *
  33159. * @param {FeatureVector} feature - 需要计算 bounds 的标签要素数。
  33160. * @param {mapboxgl.Point} loc - 标签位置。
  33161. *
  33162. * @returns {Array.<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  33163. */
  33164. calculateLabelBounds2(feature, loc) {
  33165. var labB, left, bottom, top, right;
  33166. var labelSize = feature.geometry.bsInfo;
  33167. var style = feature.style;
  33168. var locationPx = Util_Util.cloneObject(loc);
  33169. //处理文字对齐
  33170. if (style.labelAlign && style.labelAlign !== "cm") {
  33171. switch (style.labelAlign) {
  33172. case "lt":
  33173. locationPx.x += labelSize.w / 2;
  33174. locationPx.y += labelSize.h / 2;
  33175. break;
  33176. case "lm":
  33177. locationPx.x += labelSize.w / 2;
  33178. break;
  33179. case "lb":
  33180. locationPx.x += labelSize.w / 2;
  33181. locationPx.y -= labelSize.h / 2;
  33182. break;
  33183. case "ct":
  33184. locationPx.y += labelSize.h / 2;
  33185. break;
  33186. case "cb":
  33187. locationPx.y -= labelSize.h / 2;
  33188. break;
  33189. case "rt":
  33190. locationPx.x -= labelSize.w / 2;
  33191. locationPx.y += labelSize.h / 2;
  33192. break;
  33193. case "rm":
  33194. locationPx.x -= labelSize.w / 2;
  33195. break;
  33196. case "rb":
  33197. locationPx.x -= labelSize.w / 2;
  33198. locationPx.y -= labelSize.h / 2;
  33199. break;
  33200. default:
  33201. break;
  33202. }
  33203. }
  33204. left = locationPx.x - labelSize.w / 2;
  33205. bottom = locationPx.y + labelSize.h / 2;
  33206. //处理斜体字
  33207. if (style.fontStyle && style.fontStyle === "italic") {
  33208. right = locationPx.x + labelSize.w / 2 + parseInt(parseFloat(style.fontSize) / 2);
  33209. } else {
  33210. right = locationPx.x + labelSize.w / 2;
  33211. }
  33212. top = locationPx.y - labelSize.h / 2;
  33213. labB = new Bounds(left, bottom, right, top);
  33214. //旋转Bounds
  33215. var boundsQuad = [];
  33216. if ((style.labelRotation % 180) == 0) {
  33217. boundsQuad = [{
  33218. "x": labB.left,
  33219. "y": labB.top
  33220. },
  33221. {
  33222. "x": labB.right,
  33223. "y": labB.top
  33224. },
  33225. {
  33226. "x": labB.right,
  33227. "y": labB.bottom
  33228. },
  33229. {
  33230. "x": labB.left,
  33231. "y": labB.bottom
  33232. },
  33233. {
  33234. "x": labB.left,
  33235. "y": labB.top
  33236. }
  33237. ];
  33238. } else {
  33239. boundsQuad = this.rotationBounds(labB, loc, style.labelRotation);
  33240. }
  33241. //重置GeoText的bounds
  33242. feature.geometry.bounds = new Bounds(boundsQuad[1].x, boundsQuad[3].y, boundsQuad[2].x, boundsQuad[4].y);
  33243. return boundsQuad;
  33244. }
  33245. /**
  33246. * @function LabelThemeLayer.prototype.getLabelInfo
  33247. * @description 根据当前位置获取绘制后的标签信息,包括标签的宽,高和行数等。
  33248. * @returns {Object} 绘制后的标签信息。
  33249. */
  33250. getLabelInfo(location, style) {
  33251. var LABEL_ALIGN = {
  33252. "l": "left",
  33253. "r": "right",
  33254. "t": "top",
  33255. "b": "bottom"
  33256. },
  33257. LABEL_FACTOR = {
  33258. "l": 0,
  33259. "r": -1,
  33260. "t": 0,
  33261. "b": -1
  33262. };
  33263. style = Util_Util.extend({
  33264. fontColor: "#000000",
  33265. labelAlign: "cm"
  33266. }, style);
  33267. var pt = this.getLocalXY(location);
  33268. var labelWidth = 0;
  33269. if (style.labelXOffset || style.labelYOffset) {
  33270. var xOffset = isNaN(style.labelXOffset) ? 0 : style.labelXOffset;
  33271. var yOffset = isNaN(style.labelYOffset) ? 0 : style.labelYOffset;
  33272. pt[0] += xOffset;
  33273. pt[1] -= yOffset;
  33274. }
  33275. var canvas = document.createElement('canvas');
  33276. canvas.globalAlpha = 0;
  33277. canvas.lineWidth = 1;
  33278. var ctx = canvas.getContext("2d");
  33279. ctx.fillStyle = style.fontColor;
  33280. ctx.globalAlpha = style.fontOpacity || 1.0;
  33281. var fontStyle = [style.fontStyle ? style.fontStyle : "normal",
  33282. "normal",
  33283. style.fontWeight ? style.fontWeight : "normal",
  33284. style.fontSize ? style.fontSize : "1em",
  33285. style.fontFamily ? style.fontFamily : "sans-serif"
  33286. ].join(" ");
  33287. var labelRows = style.label.split('\n');
  33288. var numRows = labelRows.length;
  33289. var vfactor, lineHeight, labelWidthTmp;
  33290. if (ctx.fillText) {
  33291. // HTML5
  33292. ctx.font = fontStyle;
  33293. ctx.textAlign = LABEL_ALIGN[style.labelAlign[0]] ||
  33294. "center";
  33295. ctx.textBaseline = LABEL_ALIGN[style.labelAlign[1]] ||
  33296. "middle";
  33297. vfactor = LABEL_FACTOR[style.labelAlign[1]];
  33298. if (vfactor == null) {
  33299. vfactor = -.5;
  33300. }
  33301. lineHeight = ctx.measureText('Mg').height ||
  33302. ctx.measureText('xx').width;
  33303. pt[1] += lineHeight * vfactor * (numRows - 1);
  33304. for (let i = 0; i < numRows; i++) {
  33305. labelWidthTmp = ctx.measureText(labelRows[i]).width;
  33306. if (labelWidth < labelWidthTmp) {
  33307. labelWidth = labelWidthTmp;
  33308. }
  33309. }
  33310. } else if (ctx.mozDrawText) {
  33311. // Mozilla pre-Gecko1.9.1 (<FF3.1)
  33312. ctx.mozTextStyle = fontStyle;
  33313. vfactor = LABEL_FACTOR[style.labelAlign[1]];
  33314. if (vfactor == null) {
  33315. vfactor = -.5;
  33316. }
  33317. lineHeight = ctx.mozMeasureText('xx');
  33318. pt[1] += lineHeight * (1 + (vfactor * numRows));
  33319. for (let i = 0; i < numRows; i++) {
  33320. labelWidthTmp = ctx.measureText(labelRows[i]).width;
  33321. if (labelWidth < labelWidthTmp) {
  33322. labelWidth = labelWidthTmp;
  33323. }
  33324. }
  33325. }
  33326. var labelInfo = {}; //标签信息
  33327. if (labelWidth) {
  33328. labelInfo.w = labelWidth; //标签的宽
  33329. } else {
  33330. return null;
  33331. }
  33332. labelInfo.h = style.fontSize; //一行标签的高
  33333. labelInfo.rows = labelRows.length; //标签的行数
  33334. return labelInfo;
  33335. }
  33336. /**
  33337. * @function LabelThemeLayer.prototype.rotationBounds
  33338. * @description 旋转 bounds。
  33339. *
  33340. * @param {Bounds} bounds - 要旋转的 bounds。
  33341. * @param {Object} rotationCenterPoi - 旋转中心点对象,此对象含有属性X(横坐标),属性Y(纵坐标)。
  33342. * @param {number} angle - 旋转角度(顺时针)。
  33343. *
  33344. * @returns {Array.<Object>} bounds 旋转后形成的多边形节点数组。是一个四边形,形如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]
  33345. */
  33346. rotationBounds(bounds, rotationCenterPoi, angle) {
  33347. var ltPoi = new (external_mapboxgl_default()).Point(bounds.left, bounds.top);
  33348. var rtPoi = new (external_mapboxgl_default()).Point(bounds.right, bounds.top);
  33349. var rbPoi = new (external_mapboxgl_default()).Point(bounds.right, bounds.bottom);
  33350. var lbPoi = new (external_mapboxgl_default()).Point(bounds.left, bounds.bottom);
  33351. var ver = [];
  33352. ver.push(this.getRotatedLocation(ltPoi.x, ltPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  33353. ver.push(this.getRotatedLocation(rtPoi.x, rtPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  33354. ver.push(this.getRotatedLocation(rbPoi.x, rbPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  33355. ver.push(this.getRotatedLocation(lbPoi.x, lbPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  33356. //bounds旋转后形成的多边形节点数组
  33357. var quad = [];
  33358. for (var i = 0; i < ver.length; i++) {
  33359. quad.push({
  33360. "x": ver[i].x,
  33361. "y": ver[i].y
  33362. });
  33363. }
  33364. quad.push({
  33365. "x": ver[0].x,
  33366. "y": ver[0].y
  33367. });
  33368. return quad;
  33369. }
  33370. /**
  33371. * @function LabelThemeLayer.prototype.getRotatedLocation
  33372. * @description 获取一个点绕旋转中心顺时针旋转后的位置(此方法用于屏幕坐标)。
  33373. *
  33374. * @param {number} x - 旋转点横坐标。
  33375. * @param {number} y - 旋转点纵坐标。
  33376. * @param {number} rx - 旋转中心点横坐标。
  33377. * @param {number} ry - 旋转中心点纵坐标。
  33378. * @param {number} angle - 旋转角度。
  33379. *
  33380. * @returns {Object} 旋转后的坐标位置对象,该对象含有属性X(横坐标),属性Y(纵坐标)。
  33381. */
  33382. getRotatedLocation(x, y, rx, ry, angle) {
  33383. var loc = {},
  33384. x0, y0;
  33385. y = -y;
  33386. ry = -ry;
  33387. angle = -angle; //顺时针旋转
  33388. x0 = (x - rx) * Math.cos((angle / 180) * Math.PI) - (y - ry) * Math.sin((angle / 180) * Math.PI) + rx;
  33389. y0 = (x - rx) * Math.sin((angle / 180) * Math.PI) + (y - ry) * Math.cos((angle / 180) * Math.PI) + ry;
  33390. loc.x = x0;
  33391. loc.y = -y0;
  33392. return loc;
  33393. }
  33394. /**
  33395. * @function LabelThemeLayer.prototype.getAvoidInfo
  33396. * @description 获取避让的信息。
  33397. *
  33398. * @param {Bounds} bounds - 地图像素范围。
  33399. * @param {Array.<Object>} quadrilateral - 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  33400. *
  33401. * @returns {Object} 避让的信息。
  33402. */
  33403. getAvoidInfo(bounds, quadrilateral) {
  33404. if (quadrilateral.length !== 5) {
  33405. return null;
  33406. } //不是四边形
  33407. //将bound序列化为点数组形式
  33408. var bounddQuad = [{
  33409. "x": bounds.left,
  33410. "y": bounds.top
  33411. },
  33412. {
  33413. "x": bounds.right,
  33414. "y": bounds.top
  33415. },
  33416. {
  33417. "x": bounds.right,
  33418. "y": bounds.bottom
  33419. },
  33420. {
  33421. "x": bounds.left,
  33422. "y": bounds.bottom
  33423. },
  33424. {
  33425. "x": bounds.left,
  33426. "y": bounds.top
  33427. }
  33428. ];
  33429. var isIntersection = false,
  33430. bqLen = bounddQuad.length,
  33431. quadLen = quadrilateral.length;
  33432. var offsetX = 0,
  33433. offsetY = 0,
  33434. aspectH = "",
  33435. aspectW = "";
  33436. for (var i = 0; i < bqLen - 1; i++) {
  33437. for (var j = 0; j < quadLen - 1; j++) {
  33438. var isLineIn = Util_Util.lineIntersection(bounddQuad[i], bounddQuad[i + 1], quadrilateral[j], quadrilateral[j + 1]);
  33439. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  33440. //设置避让信息
  33441. setInfo(quadrilateral[j]);
  33442. setInfo(quadrilateral[j + 1]);
  33443. isIntersection = true;
  33444. }
  33445. }
  33446. }
  33447. if (isIntersection) {
  33448. //组织避让操作所需的信息
  33449. return {
  33450. "aspectW": aspectW,
  33451. "aspectH": aspectH,
  33452. "offsetX": offsetX,
  33453. "offsetY": offsetY
  33454. };
  33455. } else {
  33456. return null;
  33457. }
  33458. //内部函数:设置避让信息
  33459. //参数:{Object} vec- quadrilateral四边形单个节点。如:{"x":1,"y":1}。
  33460. function setInfo(vec) {
  33461. //四边形不在bounds内的节点
  33462. if (!bounds.contains(vec.x, vec.y)) {
  33463. //bounds的Top边
  33464. if (vec.y < bounds.top) {
  33465. let oY = Math.abs(bounds.top - vec.y);
  33466. if (oY > offsetY) {
  33467. offsetY = oY;
  33468. aspectH = "top";
  33469. }
  33470. }
  33471. //bounds的Bottom边
  33472. if (vec.y > bounds.bottom) {
  33473. let oY = Math.abs(vec.y - bounds.bottom);
  33474. if (oY > offsetY) {
  33475. offsetY = oY;
  33476. aspectH = "bottom";
  33477. }
  33478. }
  33479. //bounds的left边
  33480. if (vec.x < bounds.left) {
  33481. let oX = Math.abs(bounds.left - vec.x);
  33482. if (oX > offsetX) {
  33483. offsetX = oX;
  33484. aspectW = "left";
  33485. }
  33486. }
  33487. //bounds的right边
  33488. if (vec.x > bounds.right) {
  33489. let oX = Math.abs(vec.x - bounds.right);
  33490. if (oX > offsetX) {
  33491. offsetX = oX;
  33492. aspectW = "right";
  33493. }
  33494. }
  33495. }
  33496. }
  33497. }
  33498. /**
  33499. * @function LabelThemeLayer.prototype.isQuadrilateralOverLap
  33500. * @description 判断两个四边形是否有压盖。
  33501. * @param {Array.<Object>} quadrilateral - 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  33502. * @param {Array.<Object>} quadrilateral2 - 第二个四边形节点数组。
  33503. * @returns {boolean} 是否压盖,true 表示压盖。
  33504. */
  33505. isQuadrilateralOverLap(quadrilateral, quadrilateral2) {
  33506. var quadLen = quadrilateral.length,
  33507. quad2Len = quadrilateral2.length;
  33508. if (quadLen !== 5 || quad2Len !== 5) {
  33509. return null;
  33510. } //不是四边形
  33511. var OverLap = false;
  33512. //如果两四边形互不包含对方的节点,则两个四边形不相交
  33513. for (let i = 0; i < quadLen; i++) {
  33514. if (this.isPointInPoly(quadrilateral[i], quadrilateral2)) {
  33515. OverLap = true;
  33516. break;
  33517. }
  33518. }
  33519. for (let i = 0; i < quad2Len; i++) {
  33520. if (this.isPointInPoly(quadrilateral2[i], quadrilateral)) {
  33521. OverLap = true;
  33522. break;
  33523. }
  33524. }
  33525. //加上两矩形十字相交的情况
  33526. for (let i = 0; i < quadLen - 1; i++) {
  33527. if (OverLap) {
  33528. break;
  33529. }
  33530. for (var j = 0; j < quad2Len - 1; j++) {
  33531. var isLineIn = Util_Util.lineIntersection(quadrilateral[i], quadrilateral[i + 1], quadrilateral2[j], quadrilateral2[j + 1]);
  33532. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  33533. OverLap = true;
  33534. break;
  33535. }
  33536. }
  33537. }
  33538. return OverLap;
  33539. }
  33540. /**
  33541. * @function LabelThemeLayer.prototype.isPointInPoly
  33542. * @description 判断一个点是否在多边形里面(射线法)。
  33543. *
  33544. * @param {Object} pt - 需要判定的点对象,该对象含有属性x(横坐标),属性y(纵坐标)。
  33545. * @param {Array.<Object>} poly - 多边形节点数组。例如一个四边形:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  33546. * @returns {boolean} 点是否在多边形内。
  33547. */
  33548. isPointInPoly(pt, poly) {
  33549. for (var isIn = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
  33550. ((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y)) &&
  33551. (pt.x < (poly[j].x - poly[i].x) * (pt.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x) &&
  33552. (isIn = !isIn);
  33553. }
  33554. return isIn;
  33555. }
  33556. }
  33557. ;// CONCATENATED MODULE: external "function(){try{return mapv}catch(e){return {}}}()"
  33558. const external_function_try_return_mapv_catch_e_return_namespaceObject = function(){try{return mapv}catch(e){return {}}}();
  33559. ;// CONCATENATED MODULE: ./src/common/overlay/mapv/MapvRenderer.js
  33560. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33561. * This program are made available under the terms of the Apache License, Version 2.0
  33562. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33563. var BaseLayer = external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer ? external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer.__proto__ : Function;
  33564. /**
  33565. * @private
  33566. * @class MapvRenderer
  33567. * @classdesc MapV图层渲染。
  33568. * @param {Object} map - 地图。
  33569. * @param {Object} layer - 图层。
  33570. * @param {Mapv.DataSet} dataSet - 数据集。
  33571. * @param {Object} options - 参数。
  33572. * @param {Object} [functions] - 图层传递给渲染器调用的方法。
  33573. * @param {Object} [mapOptions] - 图层传递给渲染器的地图元素信息。
  33574. * @extends {MapV.BaseLayer}
  33575. *
  33576. */
  33577. class MapvRenderer extends BaseLayer {
  33578. constructor(map, dataSet, options, functions, mapOptions) {
  33579. super(map, dataSet, options);
  33580. if (!BaseLayer) {
  33581. return;
  33582. }
  33583. this.options = options || {};
  33584. this.transferCoordinate = functions.transferCoordinate;
  33585. this.getCenterPixel = functions.getCenterPixel;
  33586. this.getResolution = functions.getResolution;
  33587. this.validZoom = functions.validZoom;
  33588. let { mapElement, targetElement, id } = mapOptions;
  33589. this.targetElement = targetElement;
  33590. this.canvas = this._createCanvas(id, mapElement);
  33591. this.canvasLayer = {
  33592. canvas: this.canvas,
  33593. devicePixelRatio: this.devicePixelRatio
  33594. }
  33595. this.init(options);
  33596. this.argCheck(options);
  33597. this.stopAniamation = false;
  33598. this.animation = options.animation;
  33599. this.clickEvent = this.clickEvent.bind(this);
  33600. this.mousemoveEvent = this.mousemoveEvent.bind(this);
  33601. this._canvasUpdate();
  33602. this.targetElement.appendChild(this.canvas);
  33603. this._expectShow = true;
  33604. this.isShow = true;
  33605. }
  33606. /**
  33607. * @function MapvRenderer.prototype.clickEvent
  33608. * @description 点击绑定事件。
  33609. * @param {Object} e - 事件。
  33610. */
  33611. clickEvent(e) {
  33612. var pixel = e.point;
  33613. super.clickEvent(pixel, e);
  33614. }
  33615. /**
  33616. * @function MapvRenderer.prototype.mousemoveEvent
  33617. * @description 鼠标移动事件。
  33618. * @param {Object} e - 事件。
  33619. */
  33620. mousemoveEvent(e) {
  33621. var pixel = e.point;
  33622. super.mousemoveEvent(pixel, e);
  33623. }
  33624. /**
  33625. * @function MapvRenderer.prototype.getContext
  33626. * @description 获取信息。
  33627. */
  33628. getContext() {
  33629. return this.canvas.getContext(this.context);
  33630. }
  33631. /**
  33632. * @function MapvRenderer.prototype.addData
  33633. * @description 添加数据。
  33634. * @param {Object} data - 待添加的数据。
  33635. * @param {Object} options - 待添加的数据信息。
  33636. */
  33637. addData(data, options) {
  33638. var _data = data;
  33639. if (data && data.get) {
  33640. _data = data.get();
  33641. }
  33642. this.dataSet.add(_data);
  33643. this.update({
  33644. options: options
  33645. });
  33646. }
  33647. /**
  33648. * @function MapvRenderer.prototype.update
  33649. * @description 更新图层。
  33650. * @param {Object} opt - 待更新的数据。
  33651. * @param {Object} opt.data - mapv 数据集。
  33652. * @param {Object} opt.options - mapv 绘制参数。
  33653. */
  33654. update(opt) {
  33655. var update = opt || {};
  33656. var _data = update.data;
  33657. if (_data && _data.get) {
  33658. _data = _data.get();
  33659. }
  33660. if (_data != undefined) {
  33661. this.dataSet.set(_data);
  33662. }
  33663. super.update({
  33664. options: update.options
  33665. });
  33666. }
  33667. /**
  33668. * @function MapvRenderer.prototype.getData
  33669. * @description 获取数据。
  33670. */
  33671. getData() {
  33672. return this.dataSet;
  33673. }
  33674. /**
  33675. * @function MapvRenderer.prototype.removeData
  33676. * @description 删除符合过滤条件的数据。
  33677. * @param {function} [filter] - 过滤条件。条件参数为数据项,返回值为true,表示删除该元素;否则表示不删除。
  33678. */
  33679. removeData(filter) {
  33680. if (!this.dataSet) {
  33681. return;
  33682. }
  33683. var newData = this.dataSet.get({
  33684. filter: function (data) {
  33685. return filter != null && typeof filter === 'function' ? !filter(data) : true;
  33686. }
  33687. });
  33688. this.dataSet.set(newData);
  33689. this.update({
  33690. options: null
  33691. });
  33692. }
  33693. /**
  33694. * @function MapVRenderer.prototype.clearData
  33695. * @description 清除数据。
  33696. */
  33697. clearData() {
  33698. this.dataSet && this.dataSet.clear();
  33699. this.update({
  33700. options: null
  33701. });
  33702. }
  33703. /**
  33704. * @function MapVRenderer.prototype.updateData
  33705. * @param {Object} dataSet - 数据集。
  33706. * @param {Object} options - 数据项配置。
  33707. * @description 更新数据。
  33708. */
  33709. updateData(dataSet, options) {
  33710. if (dataSet && dataSet.get) {
  33711. this.dataSet.set(dataSet.get());
  33712. }
  33713. this.update({
  33714. options: options
  33715. });
  33716. }
  33717. _createCanvas(id, mapElement) {
  33718. const { width, height } = mapElement.style;
  33719. var canvas = document.createElement('canvas');
  33720. canvas.style.position = 'absolute';
  33721. canvas.style.top = '0px';
  33722. canvas.style.left = '0px';
  33723. canvas.id = id;
  33724. var global$2 = typeof window === 'undefined' ? {} : window;
  33725. var devicePixelRatio = this.devicePixelRatio = global$2.devicePixelRatio || 1;
  33726. canvas.width = parseInt(width) * devicePixelRatio;
  33727. canvas.height = parseInt(height) * devicePixelRatio;
  33728. if (!this.options.context || this.options.context == '2d') {
  33729. canvas.getContext('2d').scale(devicePixelRatio, devicePixelRatio);
  33730. }
  33731. canvas.style.width = width;
  33732. canvas.style.height = height;
  33733. return canvas;
  33734. }
  33735. _canvasUpdate(time) {
  33736. if (this.stopAniamation) {
  33737. return;
  33738. }
  33739. var self = this;
  33740. var animationOptions = self.options.animation;
  33741. var context = this.getContext();
  33742. if (self.isEnabledTime()) {
  33743. if (time === undefined) {
  33744. this.clear(context);
  33745. return;
  33746. }
  33747. if (this.context === '2d') {
  33748. context.save();
  33749. context.globalCompositeOperation = 'destination-out';
  33750. context.fillStyle = 'rgba(0, 0, 0, .1)';
  33751. context.fillRect(0, 0, context.canvas.width, context.canvas.height);
  33752. context.restore();
  33753. }
  33754. } else {
  33755. this.clear(context);
  33756. }
  33757. if (this.context === '2d') {
  33758. for (var key in self.options) {
  33759. context[key] = self.options[key];
  33760. }
  33761. } else {
  33762. context.clear(context.COLOR_BUFFER_BIT);
  33763. }
  33764. if (!this.validZoom()) {
  33765. return;
  33766. }
  33767. var dataGetOptions = {
  33768. transferCoordinate: this.transferCoordinate()
  33769. };
  33770. var zoomUnit = this.getResolution();
  33771. if (time !== undefined) {
  33772. dataGetOptions.filter = function (item) {
  33773. var trails = animationOptions.trails || 10;
  33774. return time && item.time > time - trails && item.time < time;
  33775. };
  33776. }
  33777. var data = self.dataSet.get(dataGetOptions);
  33778. this.processData(data);
  33779. // 兼容unit为'm'的情况
  33780. if (self.options.unit === 'm') {
  33781. if (self.options.size) {
  33782. self.options._size = self.options.size / zoomUnit;
  33783. }
  33784. if (self.options.width) {
  33785. self.options._width = self.options.width / zoomUnit;
  33786. }
  33787. if (self.options.height) {
  33788. self.options._height = self.options.height / zoomUnit;
  33789. }
  33790. } else {
  33791. self.options._size = self.options.size;
  33792. self.options._height = self.options.height;
  33793. self.options._width = self.options.width;
  33794. }
  33795. var worldPoint = this.getCenterPixel();
  33796. this.drawContext(context, data, self.options, worldPoint);
  33797. self.options.updateCallback && self.options.updateCallback(time);
  33798. }
  33799. init(options) {
  33800. var self = this;
  33801. self.options = options;
  33802. this.initDataRange(options);
  33803. this.context = self.options.context || '2d';
  33804. if (self.options.zIndex) {
  33805. this.setZIndex(self.options.zIndex);
  33806. }
  33807. this.initAnimator();
  33808. }
  33809. /**
  33810. * @function MapVRenderer.prototype.destroy
  33811. * @description 释放资源。
  33812. */
  33813. destroy() {
  33814. this.targetElement.removeChild(this.canvas);
  33815. this.clearData();
  33816. this.animator && this.animator.stop();
  33817. this.animator = null;
  33818. }
  33819. /**
  33820. * @function MapvRenderer.prototype.addAnimatorEvent
  33821. * @description 添加动画事件。
  33822. */
  33823. addAnimatorEvent() {}
  33824. moveEndEvent() {
  33825. this.stopAniamation = false;
  33826. this._canvasUpdate();
  33827. }
  33828. /**
  33829. * @function MapvRenderer.prototype.draw
  33830. * @description 渲染绘制。
  33831. */
  33832. draw() {
  33833. this._canvasUpdate();
  33834. }
  33835. visible() {
  33836. return this.isShow;
  33837. }
  33838. hide() {
  33839. this.isShow = false;
  33840. this.canvas.style.display = 'none';
  33841. }
  33842. show() {
  33843. this.isShow = true;
  33844. this.canvas.style.display = 'block';
  33845. }
  33846. setZIndex(z) {
  33847. this.canvas.style.zIndex = z;
  33848. }
  33849. /**
  33850. * @function MapvRenderer.prototype.clear
  33851. * @param {Object} context - 当前环境。
  33852. * @description 清除环境。
  33853. */
  33854. clear(context) {
  33855. context &&
  33856. context.clearRect &&
  33857. context.clearRect(
  33858. 0,
  33859. 0,
  33860. parseInt(this.map.getCanvas().style.width),
  33861. parseInt(this.map.getCanvas().style.height)
  33862. );
  33863. }
  33864. }
  33865. ;// CONCATENATED MODULE: ./src/common/util/MapCalculateUtil.js
  33866. /**
  33867. * @function getMeterPerMapUnit
  33868. * @description 单位换算,把米|度|千米|英寸|英尺换成米。
  33869. * @category BaseTypes Util
  33870. * @param {string} mapUnit 地图单位。
  33871. * @returns {number} 返回地图的距离单位。
  33872. * @usage
  33873. * ```
  33874. * // 浏览器
  33875. * <script type="text/javascript" src="{cdn}"></script>
  33876. * <script>
  33877. * const result = {namespace}.getMeterPerMapUnit(mapUnit);
  33878. *
  33879. * </script>
  33880. *
  33881. * // ES6 Import
  33882. * import { getMeterPerMapUnit } from '{npm}';
  33883. *
  33884. * const result = getMeterPerMapUnit(mapUnit);
  33885. * ```
  33886. */
  33887. var getMeterPerMapUnit = function(mapUnit) {
  33888. var earchRadiusInMeters = 6378137;
  33889. var meterPerMapUnit;
  33890. if (mapUnit === Unit.METER) {
  33891. meterPerMapUnit = 1;
  33892. } else if (mapUnit === Unit.DEGREE) {
  33893. // 每度表示多少米。
  33894. meterPerMapUnit = (Math.PI * 2 * earchRadiusInMeters) / 360;
  33895. } else if (mapUnit === Unit.KILOMETER) {
  33896. meterPerMapUnit = 1.0e-3;
  33897. } else if (mapUnit === Unit.INCH) {
  33898. meterPerMapUnit = 1 / 2.5399999918e-2;
  33899. } else if (mapUnit === Unit.FOOT) {
  33900. meterPerMapUnit = 0.3048;
  33901. } else {
  33902. return meterPerMapUnit;
  33903. }
  33904. return meterPerMapUnit;
  33905. };
  33906. /**
  33907. * @function getWrapNum
  33908. * @description 获取该坐标系的经纬度范围的经度或纬度。
  33909. * @category BaseTypes Util
  33910. * @param {number} x 经度或纬度。
  33911. * @param {boolean} includeMax 是否获取经度或纬度的最大值。
  33912. * @param {boolean} includeMin 是否获取经度或纬度的最小值。
  33913. * @param {number} range 坐标系的经纬度范围。
  33914. * @returns {number} 返回经度或纬度的值。
  33915. * @usage
  33916. * ```
  33917. * // 浏览器
  33918. * <script type="text/javascript" src="{cdn}"></script>
  33919. * <script>
  33920. * const result = {namespace}.getWrapNum(x, includeMax, includeMin, range);
  33921. *
  33922. * </script>
  33923. *
  33924. * // ES6 Import
  33925. * import { getWrapNum } from '{npm}';
  33926. *
  33927. * const result = getWrapNum(x, includeMax, includeMin, range);
  33928. * ```
  33929. */
  33930. function getWrapNum(x, includeMax = true, includeMin = true, range = [-180, 180]) {
  33931. var max = range[1],
  33932. min = range[0],
  33933. d = max - min;
  33934. if (x === max && includeMax) {
  33935. return x;
  33936. }
  33937. if (x === min && includeMin) {
  33938. return x;
  33939. }
  33940. var tmp = (((x - min) % d) + d) % d;
  33941. if (tmp === 0 && includeMax) {
  33942. return max;
  33943. }
  33944. return ((((x - min) % d) + d) % d) + min;
  33945. }
  33946. /**
  33947. * @function conversionDegree
  33948. * @description 转换经纬度。
  33949. * @category BaseTypes Util
  33950. * @param {number} degrees 经度或纬度。
  33951. * @returns {string} 返回度分秒。
  33952. * @usage
  33953. * ```
  33954. * // 浏览器
  33955. * <script type="text/javascript" src="{cdn}"></script>
  33956. * <script>
  33957. * const result = {namespace}.conversionDegree(degrees);
  33958. *
  33959. * </script>
  33960. *
  33961. * // ES6 Import
  33962. * import { conversionDegree } from '{npm}';
  33963. *
  33964. * const result = conversionDegree(degrees);
  33965. * ```
  33966. */
  33967. function conversionDegree(degrees) {
  33968. const degree = parseInt(degrees);
  33969. let fraction = parseInt((degrees - degree) * 60);
  33970. let second = parseInt(((degrees - degree) * 60 - fraction) * 60);
  33971. fraction = parseInt(fraction / 10) === 0 ? `0${fraction}` : fraction;
  33972. second = parseInt(second / 10) === 0 ? `0${second}` : second;
  33973. return `${degree}°${fraction}'${second}`;
  33974. }
  33975. /**
  33976. * @function scalesToResolutions
  33977. * @description 通过比例尺数组计算分辨率数组,没有传入比例尺数组时通过地图范围与地图最大级别进行计算。
  33978. * @version 11.0.1
  33979. * @param {Array} scales - 比例尺数组。
  33980. * @param {Object} bounds - 地图范围。
  33981. * @param {number} dpi - 屏幕分辨率。
  33982. * @param {string} mapUnit - 地图单位。
  33983. * @param {number} [level=22] - 地图最大级别。
  33984. * @returns {number} 分辨率。
  33985. * @usage
  33986. * ```
  33987. * // 浏览器
  33988. * <script type="text/javascript" src="{cdn}"></script>
  33989. * <script>
  33990. * const result = {namespace}.scalesToResolutions(scales, bounds, dpi, mapUnit);
  33991. *
  33992. * </script>
  33993. *
  33994. * // ES6 Import
  33995. * import { scalesToResolutions } from '{npm}';
  33996. *
  33997. * const result = scalesToResolutions(scales, bounds, dpi, mapUnit);
  33998. * ```
  33999. */
  34000. function scalesToResolutions(scales, bounds, dpi, mapUnit, level = 22) {
  34001. var resolutions = [];
  34002. if (scales && scales.length > 0) {
  34003. for (let i = 0; i < scales.length; i++) {
  34004. resolutions.push(scaleToResolution(scales[i], dpi, mapUnit));
  34005. }
  34006. } else {
  34007. const maxReolution = Math.abs(bounds.left - bounds.right) / 256;
  34008. for (let i = 0; i < level; i++) {
  34009. resolutions.push(maxReolution / Math.pow(2, i));
  34010. }
  34011. }
  34012. return resolutions.sort(function (a, b) {
  34013. return b - a;
  34014. });
  34015. }
  34016. /**
  34017. * @function getZoomByResolution
  34018. * @description 通过分辨率获取地图级别。
  34019. * @version 11.0.1
  34020. * @param {number} resolution - 分辨率。
  34021. * @param {Array} resolutions - 分辨率数组。
  34022. * @returns {number} 地图级别。
  34023. * @usage
  34024. * ```
  34025. * // 浏览器
  34026. * <script type="text/javascript" src="{cdn}"></script>
  34027. * <script>
  34028. * const result = {namespace}.getZoomByResolution(resolution, resolutions);
  34029. *
  34030. * </script>
  34031. *
  34032. * // ES6 Import
  34033. * import { getZoomByResolution } from '{npm}';
  34034. *
  34035. * const result = getZoomByResolution(resolution, resolutions);
  34036. * ```
  34037. */
  34038. function getZoomByResolution(resolution, resolutions) {
  34039. let zoom = 0;
  34040. let minDistance;
  34041. for (let i = 0; i < resolutions.length; i++) {
  34042. if (i === 0) {
  34043. minDistance = Math.abs(resolution - resolutions[i]);
  34044. }
  34045. if (minDistance > Math.abs(resolution - resolutions[i])) {
  34046. minDistance = Math.abs(resolution - resolutions[i]);
  34047. zoom = i;
  34048. }
  34049. }
  34050. return zoom;
  34051. }
  34052. /**
  34053. * @function scaleToResolution
  34054. * @description 通过比例尺计算分辨率。
  34055. * @version 11.0.1
  34056. * @param {number} scale - 比例尺。
  34057. * @param {number} dpi - 屏幕分辨率。
  34058. * @param {string} mapUnit - 地图单位。
  34059. * @returns {number} 分辨率。
  34060. * @usage
  34061. * ```
  34062. * // 浏览器
  34063. * <script type="text/javascript" src="{cdn}"></script>
  34064. * <script>
  34065. * const result = {namespace}.scaleToResolution(scale, dpi, mapUnit);
  34066. *
  34067. * </script>
  34068. *
  34069. * // ES6 Import
  34070. * import { scaleToResolution } from '{npm}';
  34071. *
  34072. * const result = scaleToResolution(scale, dpi, mapUnit);
  34073. * ```
  34074. */
  34075. function scaleToResolution(scale, dpi, mapUnit) {
  34076. const inchPerMeter = 1 / 0.0254;
  34077. const meterPerMapUnitValue = getMeterPerMapUnit(mapUnit);
  34078. const resolution = 1 / (scale * dpi * inchPerMeter * meterPerMapUnitValue);
  34079. return resolution;
  34080. }
  34081. /**
  34082. * 范围是否相交
  34083. * @param {Array} extent1 范围1
  34084. * @param {Array} extent2 范围2
  34085. * @return {boolean} 范围是否相交。
  34086. */
  34087. function intersects(extent1, extent2) {
  34088. return (
  34089. extent1[0] <= extent2[2] &&
  34090. extent1[2] >= extent2[0] &&
  34091. extent1[1] <= extent2[3] &&
  34092. extent1[3] >= extent2[1]
  34093. );
  34094. }
  34095. /**
  34096. * 获取两个范围的交集
  34097. * @param {Array} extent1 Extent 1
  34098. * @param {Array} extent2 Extent 2
  34099. * @return {Array} 相交范围数组.
  34100. * @api
  34101. */
  34102. function getIntersection(extent1, extent2) {
  34103. const intersection = [];
  34104. if (intersects(extent1, extent2)) {
  34105. if (extent1[0] > extent2[0]) {
  34106. intersection[0] = extent1[0];
  34107. } else {
  34108. intersection[0] = extent2[0];
  34109. }
  34110. if (extent1[1] > extent2[1]) {
  34111. intersection[1] = extent1[1];
  34112. } else {
  34113. intersection[1] = extent2[1];
  34114. }
  34115. if (extent1[2] < extent2[2]) {
  34116. intersection[2] = extent1[2];
  34117. } else {
  34118. intersection[2] = extent2[2];
  34119. }
  34120. if (extent1[3] < extent2[3]) {
  34121. intersection[3] = extent1[3];
  34122. } else {
  34123. intersection[3] = extent2[3];
  34124. }
  34125. }
  34126. return intersection;
  34127. }
  34128. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/MapvLayer.js
  34129. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34130. * This program are made available under the terms of the Apache License, Version 2.0
  34131. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34132. /**
  34133. * @class MapvLayer
  34134. * @category Visualization MapV
  34135. * @classdesc Mapv 图层类。
  34136. * @modulecategory Overlay
  34137. * @param {mapboxgl.Map} map - MapBoxGL Map 对象,将在下个版本弃用,请用 map.addLayer() 方法添加图层。
  34138. * @param {Mapv.DataSet} dataSet - MapV 图层数据集。
  34139. * @param {Object} mapVOptions - Mapv 参数。
  34140. * @param {string} [mapVOptions.layerID] - 图层 ID。默认使用 CommonUtil.createUniqueID("mapvLayer_") 创建专题图层 ID。
  34141. * @usage
  34142. */
  34143. class MapvLayer {
  34144. constructor(map, dataSet, mapVOptions) {
  34145. if (arguments.length === 3) {
  34146. this.map = map;
  34147. delete mapVOptions['layerID'];
  34148. this.mapVOptions = mapVOptions;
  34149. this.dataSet = dataSet;
  34150. } else {
  34151. this.dataSet = map;
  34152. delete dataSet['layerID'];
  34153. this.mapVOptions = dataSet;
  34154. }
  34155. this.id = this.mapVOptions.layerID ? this.mapVOptions.layerID : Util_Util.createUniqueID('mapvLayer_');
  34156. this.type = 'custom';
  34157. this.visibility = true;
  34158. this.renderingMode = '3d';
  34159. this.overlay = true;
  34160. this.context = this.mapVOptions.context || '2d';
  34161. //保留之前的用法
  34162. if (this.map) {
  34163. this.map.addLayer(this);
  34164. }
  34165. }
  34166. /**
  34167. * @function MapvLayer.prototype.onAdd
  34168. * @description 添加图层到地图。
  34169. * @param {Object} map - 地图对象。
  34170. */
  34171. onAdd(map) {
  34172. this.map = map;
  34173. this.mapContainer = map.getCanvasContainer();
  34174. this.renderer = new MapvRenderer(map, this.dataSet, this.mapVOptions, {
  34175. transferCoordinate: this._transferCoordinate,
  34176. getCenterPixel: this._getCenterPixel,
  34177. getResolution: this._getResolution,
  34178. validZoom: this._validZoom.bind(this)
  34179. }, { mapElement: this.map.getCanvas(), targetElement: this.mapContainer, id: this.id });
  34180. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  34181. this.bindEvent();
  34182. }
  34183. /**
  34184. * @function MapvLayer.prototype.onRemove
  34185. * @description 移除图层。
  34186. */
  34187. onRemove() {
  34188. this.renderer.destroy();
  34189. this.unbindEvent();
  34190. }
  34191. /**
  34192. * @function MapvLayer.prototype.render
  34193. * @description 渲染图层。
  34194. */
  34195. render() {
  34196. this.renderer && this.renderer.draw();
  34197. }
  34198. _transferCoordinate() {
  34199. let map = this.map;
  34200. var bounds = map.getBounds(),
  34201. dw = bounds.getEast() - bounds.getWest(),
  34202. dh = bounds.getNorth() - bounds.getSouth();
  34203. let rect = map.getCanvas().getBoundingClientRect();
  34204. var resolutionX = dw / rect.width,
  34205. resolutionY = dh / rect.height;
  34206. var center = map.getCenter();
  34207. var centerPx = map.project(center);
  34208. var self = this;
  34209. return function (coordinate) {
  34210. if (map.transform.rotationMatrix || self.context === '2d') {
  34211. var worldPoint = map.project(new (external_mapboxgl_default()).LngLat(coordinate[0], coordinate[1]));
  34212. return [worldPoint.x, worldPoint.y];
  34213. }
  34214. var pixel = [(coordinate[0] - center.lng) / resolutionX, (center.lat - coordinate[1]) / resolutionY];
  34215. return [pixel[0] + centerPx.x, pixel[1] + centerPx.y];
  34216. }
  34217. }
  34218. _validZoom() {
  34219. if (
  34220. (this.mapVOptions.minZoom && this.map.getZoom() < this.mapVOptions.minZoom) ||
  34221. (this.mapVOptions.maxZoom && this.map.getZoom() > this.mapVOptions.maxZoom)
  34222. ) {
  34223. return false;
  34224. }
  34225. return true;
  34226. }
  34227. _getResolution() {
  34228. var bounds = this.map.getBounds();
  34229. var dw = bounds.getEast() - bounds.getWest();
  34230. var rect = this.map.getCanvas().getBoundingClientRect();
  34231. var resolutionX = dw / rect.width;
  34232. // 一个像素是多少米
  34233. return getMeterPerMapUnit('DEGREE') * resolutionX;
  34234. }
  34235. _getCenterPixel() {
  34236. return this.map.project(new (external_mapboxgl_default()).LngLat(0, 0));
  34237. }
  34238. /**
  34239. * @function MapvLayer.prototype.addData
  34240. * @description 追加数据。
  34241. * @param {Object} data - 要追加的数据。
  34242. * @param {Object} options - 要追加的值。
  34243. */
  34244. addData(data, options) {
  34245. this.renderer.addData(data, options);
  34246. }
  34247. /**
  34248. * @function MapvLayer.prototype.update
  34249. * @description 更新图层。
  34250. * @param {Object} opt - 待更新的数据。
  34251. * @param {Object} opt.data - mapv 数据集。
  34252. * @param {Object} opt.options - mapv 绘制参数。
  34253. */
  34254. update(opt) {
  34255. this.renderer.update(opt);
  34256. }
  34257. /**
  34258. * @function MapvLayer.prototype.getData
  34259. * @description 获取数据。
  34260. * @returns {Mapv.DataSet} mapv 数据集。
  34261. */
  34262. getData() {
  34263. if (this.renderer) {
  34264. this.dataSet = this.renderer.getData();
  34265. }
  34266. return this.dataSet;
  34267. }
  34268. /**
  34269. * @function MapvLayer.prototype.removeData
  34270. * @description 删除符合过滤条件的数据。
  34271. * @param {function} [filter] - 过滤条件。条件参数为数据项,返回值为 true,表示删除该元素;否则表示不删除。
  34272. * @example
  34273. * filter=function(data){
  34274. * if(data.id=="1"){
  34275. * return true
  34276. * }
  34277. * return false;
  34278. * }
  34279. */
  34280. removeData(filter) {
  34281. this.renderer && this.renderer.removeData(filter);
  34282. }
  34283. /**
  34284. * @function MapvLayer.prototype.clearData
  34285. * @description 清除数据。
  34286. */
  34287. clearData() {
  34288. this.renderer.clearData();
  34289. }
  34290. /**
  34291. * @function MapvLayer.prototype.show
  34292. * @description 显示该图层
  34293. */
  34294. show() {
  34295. if (this.renderer) {
  34296. this.renderer.show();
  34297. }
  34298. return this;
  34299. }
  34300. /**
  34301. * @function MapvLayer.prototype.hide
  34302. * @description 隐藏该图层
  34303. */
  34304. hide() {
  34305. if (this.renderer) {
  34306. this.renderer.hide();
  34307. }
  34308. return this;
  34309. }
  34310. /**
  34311. * @function MapvLayer.prototype.getTopLeft
  34312. * @description 获取左上的坐标。
  34313. */
  34314. getTopLeft() {
  34315. var map = this.map;
  34316. var topLeft;
  34317. if (map) {
  34318. var bounds = map.getBounds();
  34319. topLeft = bounds.getNorthWest();
  34320. }
  34321. return topLeft;
  34322. }
  34323. /**
  34324. * @function MapvRenderer.prototype.bindEvent
  34325. * @description 绑定事件。
  34326. */
  34327. bindEvent() {
  34328. var map = this.map;
  34329. if (this.mapVOptions.methods) {
  34330. if (this.mapVOptions.methods.click) {
  34331. map.on('click', this.renderer.clickEvent);
  34332. }
  34333. if (this.mapVOptions.methods.mousemove) {
  34334. map.on('mousemove', this.renderer.mousemoveEvent);
  34335. }
  34336. }
  34337. }
  34338. /**
  34339. * @function MapvRenderer.prototype.unbindEvent
  34340. * @description 解绑事件。
  34341. */
  34342. unbindEvent() {
  34343. var map = this.map;
  34344. if (this.mapvOptions.methods) {
  34345. if (this.mapvOptions.methods.click) {
  34346. map.off('click', this.clickEvent);
  34347. }
  34348. if (this.mapvOptions.methods.mousemove) {
  34349. map.off('mousemove', this.mousemoveEvent);
  34350. }
  34351. }
  34352. }
  34353. /**
  34354. * @function MapvLayer.prototype.setVisibility
  34355. * @description 设置图层可见性。
  34356. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  34357. */
  34358. setVisibility(visibility) {
  34359. if (visibility !== this.visibility) {
  34360. this.visibility = visibility;
  34361. if (visibility) {
  34362. this.show();
  34363. } else {
  34364. this.hide();
  34365. }
  34366. }
  34367. }
  34368. /**
  34369. * @function MapvLayer.prototype.setZIndex
  34370. * @description 设置 canvas 层级。
  34371. * @param {number} zIndex - canvas 层级。
  34372. */
  34373. setZIndex(z) {
  34374. this.renderer.setZIndex(z);
  34375. }
  34376. }
  34377. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/theme/Theme3DLayer.js
  34378. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34379. * This program are made available under the terms of the Apache License, Version 2.0
  34380. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34381. /**
  34382. * @class Theme3DLayer
  34383. * @category Visualization Theme
  34384. * @classdesc 三维专题图基类。不能直接实例化。
  34385. * @modulecategory Overlay
  34386. * @param {string} [id] - 专题图图层 ID。默认使用 CommonUtil.createUniqueID("theme3DLayer") 创建专题图层 ID。
  34387. * @param {Object} layerOptions -专题图图层配置项。
  34388. * @param {number} [layerOptions.opacity=1] - 图层不透明度。
  34389. * @param {boolean} [layerOptions.parseNumber=fasle] - 是否预处理数据,将数据转换为 number。
  34390. * @param {boolean} [layerOptions.enableHighlight=false] - 是否开启高亮。
  34391. * @param {string} [layerOptions.highlight="#ADA91E"] - 高亮颜色。
  34392. * @param {string} [layerOptions.baseHeightField] - 数据中表示基础高度的字段。
  34393. * @param {number} [layerOptions.height] - 高度。如果数据指定的 heightField (为height)没有可以表示高度的字段,可以为所有数据统一设置一个高度。
  34394. * @param {string} [layerOptions.heightField] - 数据中表示高度的字段。
  34395. * @param {string} [layerOptions.themeField] - 专题展示的字段。
  34396. * @param {boolean} [layerOptions.showLegend=true] - 是否显示图例。
  34397. * @param {string} [layerOptions.legendTitle] - 图例标题。
  34398. * @param {string} [layerOptions.legendTheme='light'] - 图例主题,取值:'light','dark'。
  34399. * @param {string} [layerOptions.legendOrientation='horizontal'] - 图例方向,取值:'horizontal','vertical'。
  34400. * @param {string} [layerOptions.legendPosition] - 图例位置,取值:'top-right'|'top-left'|'bottom-left'|'bottom-right'。
  34401. * @usage
  34402. */
  34403. class Theme3DLayer {
  34404. constructor(id, layerOptions) {
  34405. /**
  34406. * @member {string} Theme3DLayer.prototype.id
  34407. * @description Mapbox GL 图层 ID。
  34408. */
  34409. this.id = id;
  34410. /**
  34411. * @member {Object} Theme3DLayer.prototype.map
  34412. * @description Mapbox GL 地图对象。
  34413. */
  34414. this.map = null;
  34415. /**
  34416. * @member {number} [Theme3DLayer.prototype.opacity=1]
  34417. * @description 图层不透明度。
  34418. */
  34419. this.opacity = 1;
  34420. /**
  34421. * @member {boolean} [Theme3DLayer.prototype.parseNumber=false]
  34422. * @description 是否进行数据预处理,有些字段是 string 类型,需要转换为 number。
  34423. */
  34424. this.parseNumber = false;
  34425. /**
  34426. * @member {boolean} [Theme3DLayer.prototype.enableHighlight=false]
  34427. * @description 是否开启高亮。
  34428. */
  34429. this.enableHighlight = false;
  34430. /**
  34431. * @member {Object} [Theme3DLayer.prototype.highlight={color: "#ADA91E"}]
  34432. * @description 高亮相关配置。
  34433. */
  34434. this.highlight = {color: "#ADA91E"};
  34435. /**
  34436. * @member {string} Theme3DLayer.prototype.baseHeightField
  34437. * @description 数据中表示基础高度的字段。
  34438. */
  34439. this.baseHeightField = null;
  34440. /**
  34441. * @member {number} Theme3DLayer.prototype.height
  34442. * @description 高度。如果数据指定的 heightField (默认 height) 没有可以表示高度的字段,可以为所有数据统一设置一个高度。
  34443. */
  34444. this.height = null;
  34445. /**
  34446. * @member {string} Theme3DLayer.prototype.heightField
  34447. * @description 数据中表示高度的字段。
  34448. */
  34449. this.heightField = 'height';
  34450. /**
  34451. * @member {string} [Theme3DLayer.prototype.themeField]
  34452. * @description 专题展示的字段。
  34453. */
  34454. this.themeField = this.heightField;
  34455. /**
  34456. * @member {boolean} [Theme3DLayer.prototype.showLegend=true]
  34457. * @description 是否显示图例。
  34458. */
  34459. this.showLegend = true;
  34460. /**
  34461. * @member {string} [Theme3DLayer.prototype.legendTitle]
  34462. * @description 图例标题。
  34463. */
  34464. this.legendTitle = null;
  34465. /**
  34466. * @member {string} [Theme3DLayer.prototype.legendTheme='light']
  34467. * @description 图例主题,取值:'light','dark'。
  34468. * @default 'light'
  34469. */
  34470. this.legendTheme = 'light';
  34471. /**
  34472. * @member {string} [Theme3DLayer.prototype.legendOrientation='horizontal']
  34473. * @description 图例方向,取值:'horizontal','vertical'。
  34474. * @default 'horizontal'
  34475. */
  34476. this.legendOrientation = 'horizontal';
  34477. /**
  34478. * @member {string} Theme3DLayer.prototype.legendPosition
  34479. * @description 图例位置,取值:'top-right'|'top-left'|'bottom-left'|'bottom-right'。
  34480. * @default 'bottom-right'
  34481. */
  34482. this.legendPosition = 'bottom-right';
  34483. this._highlightLayerId = `${this.id}-highlightLayer`;
  34484. this._extend(this, layerOptions);
  34485. }
  34486. /**
  34487. * @function Theme3DLayer.prototype.setLayerOptions
  34488. * @description 设置图层相关参数。
  34489. * @param {Object} layerOptions - 该专题图图层相关参数。
  34490. * @param {number} [layerOptions.opacity=1] - 图层不透明度。
  34491. * @param {boolean} [layerOptions.parseNumber=false] - 是否预处理数据,将数据转换为 number。
  34492. * @param {string} [layerOptions.baseHeightField] - 数据中表示基础高度的字段。
  34493. * @param {number} [layerOptions.height] - 高度。如果数据指定的heightField(默认height)没有可以表示高度的字段,可以为所有数据统一设置一个高度。
  34494. * @param {string} [layerOptions.heightField] - 数据中表示高度的字段。
  34495. * @param {string} [layerOptions.themeField] - 专题展示的字段。
  34496. * @param {boolean} [layerOptions.showLegend=true] - 是否显示图例。
  34497. * @param {string} layerOptions.legendTitle - 图例标题。
  34498. * @param {string} [layerOptions.legendTheme='light'] - 图例主题,取值:'light','dark'。
  34499. * @param {string} [layerOptions.legendOrientation='horizontal'] - 图例方向,取值:'horizontal','vertical'。
  34500. * @param {string} [layerOptions.legendPosition] - 图例位置,取值:'top-right'|'top-left'|'bottom-left'|'bottom-right'。
  34501. * @returns {Theme3DLayer} Theme3DLayer的实例对象。
  34502. */
  34503. setLayerOptions(layerOptions) {
  34504. this._extend(this, layerOptions);
  34505. return this;
  34506. }
  34507. /**
  34508. * @function Theme3DLayer.prototype.setHighlightStyleOptions
  34509. * @description 设置图层高亮相关参数。
  34510. * @param {Object} highlightOptions - 该专题图图层高亮相关参数。
  34511. * @param {string} [highlightOptions.color] - 颜色。
  34512. * @param {function} highlightOptions.callback - 回调,返回数据参数(data,event)。
  34513. * @returns {Theme3DLayer} Theme3DLayer的实例对象。
  34514. */
  34515. setHighlightStyleOptions(highlightOptions) {
  34516. this._extend(this.highlight, highlightOptions);
  34517. return this;
  34518. }
  34519. /**
  34520. * @function Theme3DLayer.prototype.setData
  34521. * @description 设置数据,数据格式必须为 GeoJSON 格式。
  34522. * @param {GeoJSONObject} data - GeoJSON 格式数据。
  34523. * @param {boolean} [parseNumber=false] - 是否进行数据预处理,有些字段是 string 类型,需要转换为 number。
  34524. */
  34525. setData(data, parseNumber) {
  34526. var me = this;
  34527. me.data = data;
  34528. if (parseNumber != null) {
  34529. me.parseNumber = parseNumber;
  34530. }
  34531. me.parseNumber && me.data && me.data.features && me.data.features.map(function (val) {
  34532. if (me.baseHeightField && val.properties[me.baseHeightField]) {
  34533. val.properties[me.baseHeightField] = parseFloat(val.properties[me.baseHeightField]);
  34534. }
  34535. if (me.heightField && val.properties[me.heightField]) {
  34536. val.properties[me.heightField] = parseFloat(val.properties[me.heightField]);
  34537. }
  34538. return val;
  34539. });
  34540. return this;
  34541. }
  34542. /**
  34543. * @function Theme3DLayer.prototype.getData
  34544. * @description 获取数据。
  34545. * @returns {GeoJSONObject} 获取的数据。
  34546. */
  34547. getData() {
  34548. return this.data;
  34549. }
  34550. /**
  34551. * @function Theme3DLayer.prototype.addTo
  34552. * @description 添加图层到地图上。
  34553. * @param {mapboxgl.Map} map - MapBoxGL Map 对象。
  34554. * @returns {Theme3DLayer} Theme3DLayer的实例对象。
  34555. */
  34556. addTo(map) {
  34557. this.map = map;
  34558. if (!this.map) {
  34559. return this;
  34560. }
  34561. this.show();
  34562. return this;
  34563. }
  34564. /**
  34565. * @function Theme3DLayer.prototype.show
  34566. * @description 显示图层。
  34567. * @param {Object} options - 图层配置项。
  34568. * @returns {Theme3DLayer} Theme3DLayer的实例对象。
  34569. */
  34570. show(options) {
  34571. this._extend(this, options);
  34572. this._addLayer();
  34573. if (this.enableHighlight) {
  34574. this._addHighLightLayer();
  34575. }
  34576. if (this.showLegend) {
  34577. if (!this.legend) {
  34578. this.legend = this._createLegendControl();
  34579. }
  34580. this.map.addControl(this.legend, this.legendPosition);
  34581. }
  34582. return this;
  34583. }
  34584. /**
  34585. * @function Theme3DLayer.prototype.remove
  34586. * @description 从地图上移除图层。
  34587. * @returns {Theme3DLayer} Theme3DLayer的实例对象。
  34588. */
  34589. remove() {
  34590. if (!this.map) {
  34591. return this;
  34592. }
  34593. //移除图层
  34594. var layerId = this.id ? this.id : "theme3DLayer";
  34595. if (this.map.getLayer(layerId)) {
  34596. this.map.off('mousemove', layerId, this._onMouseMove.bind(this));
  34597. this.map.on('mouseout', layerId, this._onMouseMove.bind(this));
  34598. this.map.removeLayer(layerId);
  34599. }
  34600. //移除高亮图层
  34601. if (this.map.getLayer(this._highlightLayerId)) {
  34602. this._selectFeatureId = null;
  34603. this.map.removeLayer(this._highlightLayerId );
  34604. }
  34605. //移除图例
  34606. if (this.legend) {
  34607. this.map.removeControl(this.legend);
  34608. }
  34609. return this;
  34610. }
  34611. /**
  34612. * @function Theme3DLayer.prototype.getLayerStyleOptions
  34613. * @description 获取图层样式。
  34614. * @returns {Object} Mapbox GL 样式对象。
  34615. */
  34616. getLayerStyleOptions() {
  34617. //子类重写实现
  34618. }
  34619. /**
  34620. * @function Theme3DLayer.prototype.getHighlightStyleOptions
  34621. * @description 获取高亮样式,子类重写实现。
  34622. * @returns {Object} Mapbox GL 样式对象。
  34623. */
  34624. getHighlightStyleOptions() {
  34625. //子类重写实现
  34626. }
  34627. _createLegendControl(html) {
  34628. var me = this;
  34629. function LegendControl() {
  34630. }
  34631. LegendControl.prototype.onAdd = function (map) {
  34632. this._map = map;
  34633. this._container = document.createElement('div');
  34634. var className = 'mapboxgl-ctrl legend ';
  34635. var theme = 'legend-light';
  34636. if (me.legendTheme === 'dark') {
  34637. theme = 'legend-dark';
  34638. }
  34639. var orientation = ' legend-horizontal';
  34640. if (me.legendOrientation === 'vertical') {
  34641. orientation = ' legend-vertical';
  34642. }
  34643. this._container.className = className + theme + orientation;
  34644. if (html) {
  34645. this._container.innerHTML = html;
  34646. } else {
  34647. var legendTitle = me.legendTitle || "";
  34648. var titleElement = " <div class='legend-title'>" + legendTitle + "</div>";
  34649. var content = me._createLegendElement.call(me) || "";
  34650. var contentElement = "<div class='legend-content'>" + content + "</div>";
  34651. this._container.innerHTML = titleElement + contentElement;
  34652. }
  34653. me._appendLegendCSSStyle();
  34654. return this._container;
  34655. };
  34656. LegendControl.prototype.onRemove = function () {
  34657. this._container.parentNode.removeChild(this._container);
  34658. this._map = undefined;
  34659. };
  34660. return new LegendControl();
  34661. }
  34662. _createLegendElement() {
  34663. //子类实现
  34664. }
  34665. _addLayer() {
  34666. var paintOptions = this.getLayerStyleOptions();
  34667. var id = this.id ? this.id : "theme3DLayer";
  34668. var sourceId = this.sourceId = id + 'Source';
  34669. if (!this.map.getSource(sourceId)) {
  34670. this.map.addSource(sourceId, {
  34671. 'type': 'geojson',
  34672. 'data': this.data
  34673. });
  34674. } else {
  34675. this.map.removeSource(sourceId);
  34676. this.map.addSource(sourceId, {
  34677. 'type': 'geojson',
  34678. 'data': this.data
  34679. });
  34680. }
  34681. this.map.addLayer({
  34682. 'id': id,
  34683. 'type': 'fill-extrusion',
  34684. 'source': sourceId,
  34685. 'paint': paintOptions
  34686. });
  34687. this.map.moveLayer(id);
  34688. }
  34689. //添加高亮图层
  34690. _addHighLightLayer() {
  34691. if (!this.map) {
  34692. return;
  34693. }
  34694. var map = this.map;
  34695. map.addLayer({
  34696. 'id': this._highlightLayerId,
  34697. 'type': 'fill-extrusion',
  34698. 'source': this.sourceId,
  34699. 'paint': this.getHighlightStyleOptions(),
  34700. "filter": ["in", "$id", ""]
  34701. });
  34702. this._selectFeatureId = null;
  34703. map.on('mousemove', this.id, this._onMouseMove.bind(this));
  34704. map.on('mouseout', this.id, this._onMouseMove.bind(this));
  34705. }
  34706. _onMouseMove(e) {
  34707. var me = this, map = this.map;
  34708. var features = map.queryRenderedFeatures(e.point, {layers: [me.id]});
  34709. if (me.highlight && me.highlight.callback) {
  34710. me.highlight.callback(features, e);
  34711. }
  34712. if (!features || features.length < 1) {
  34713. me._clearHighlight.call(me);
  34714. me._selectFeatureId = null;
  34715. return;
  34716. }
  34717. var id = features[0].id;
  34718. if (me._selectFeatureId === id) {
  34719. return;
  34720. }
  34721. me._selectFeatureId = id;
  34722. map.setFilter(me._highlightLayerId, ['==', '$id', me._selectFeatureId]);
  34723. }
  34724. _clearHighlight() {
  34725. if (this.map) {
  34726. this.map.setFilter(this._highlightLayerId, ["in", "$id", ""]);
  34727. }
  34728. }
  34729. _appendLegendCSSStyle() {
  34730. var legendStyle = document.createElement('style');
  34731. legendStyle.type = 'text/css';
  34732. var baseStyle = `
  34733. .legend {
  34734. display: inline-block;
  34735. border-radius: 2px;
  34736. -moz-border-radius: 2px;
  34737. -webkit-border-radius: 2px;
  34738. font-size: 12px;
  34739. color: rgba(0, 0, 0, 0.8);
  34740. background-color: rgb(255, 255, 255);
  34741. }
  34742. .legend-light {
  34743. color: rgba(0, 0, 0, 0.8);
  34744. background-color: rgb(255, 255, 255);
  34745. box-shadow: 0px 0px 6px #bbbbbb;
  34746. -moz-box-shadow: 0px 6px 10px #bbbbbb;
  34747. -webkit-box-shadow: 0px 0px 6px #bbbbbb;
  34748. }
  34749. .legend-dark {
  34750. color: rgba(255, 255, 255, 0.8);
  34751. background-color: rgb(64, 64, 64);
  34752. }
  34753. .legend .legend-title {
  34754. min-height: 14px;
  34755. max-width: 500px;
  34756. padding:6px 10px;
  34757. }
  34758. .legend-light .legend-title {
  34759. color: rgba(0, 0, 0, 0.8);
  34760. }
  34761. .legend-dark .legend-title {
  34762. color: rgba(255, 255, 255, 0.8);
  34763. }
  34764. .legend-content{
  34765. padding:6px 10px;
  34766. }
  34767. `;
  34768. legendStyle.innerHTML = baseStyle + this._legendCSSStyle();
  34769. document.getElementsByTagName('head')[0].appendChild(legendStyle);
  34770. }
  34771. //各种图层对应的自己的图例的样式
  34772. _legendCSSStyle() {
  34773. //子类可重写实现
  34774. return `
  34775. .legend ul {
  34776. padding: 0;
  34777. margin: 0 16px;
  34778. height: 100%;
  34779. display: block;
  34780. list-style: none;
  34781. }
  34782. .legend li {
  34783. vertical-align: middle;
  34784. }
  34785. .legend li span:first-child {
  34786. vertical-align: middle;
  34787. }
  34788. .legend li span:last-child {
  34789. line-height: 28px;
  34790. max-width: 200px;
  34791. vertical-align: middle;
  34792. white-space: nowrap;
  34793. overflow: hidden;
  34794. text-overflow: ellipsis;
  34795. -ms-text-overflow: ellipsis;
  34796. }
  34797. .legend-vertical li {
  34798. height: 28px;
  34799. }
  34800. .legend-vertical li span:first-child {
  34801. display: inline-block;
  34802. width: 60px;
  34803. height: 100%;
  34804. }
  34805. .legend-vertical li span:last-child {
  34806. display: inline-block;
  34807. margin-left: 16px;
  34808. height: 100%;
  34809. }
  34810. .legend-horizontal li {
  34811. height: 56px;
  34812. float: left;
  34813. }
  34814. .legend-horizontal li span:first-child {
  34815. display: block;
  34816. width: 100%;
  34817. height: 50%;
  34818. }
  34819. .legend-horizontal li span:last-child {
  34820. display: block;
  34821. vertical-align: middle;
  34822. width: 60px;
  34823. height: 50%;
  34824. text-align: center;
  34825. }
  34826. `;
  34827. }
  34828. _extend(dest) {
  34829. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  34830. var arg = Object.getOwnPropertyNames(arguments)[index];
  34831. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  34832. continue;
  34833. }
  34834. var obj = arguments[arg];
  34835. if (obj) {
  34836. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  34837. var key = Object.getOwnPropertyNames(obj)[j];
  34838. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  34839. continue;
  34840. }
  34841. dest[key] = obj[key];
  34842. }
  34843. }
  34844. }
  34845. return dest;
  34846. }
  34847. }
  34848. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/RangeTheme3DLayer.js
  34849. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34850. * This program are made available under the terms of the Apache License, Version 2.0
  34851. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34852. /**
  34853. * @class RangeTheme3DLayer
  34854. * @category Visualization Theme
  34855. * @classdesc 三维分段专题图类。
  34856. * @modulecategory Overlay
  34857. * @param {string} [id] - 专题图图层 ID。默认使用 CommonUtil.createUniqueID("theme3DLayer") 创建专题图层 ID。
  34858. * @param {Object} layerOptions - 专题图图层配置项,参数继承自 Theme3DLayer。
  34859. * @param {Array} [layerOptions.heightStops] - 新增参数,数据高度分段数组。
  34860. * @param {Array} layerOptions.colorStops - 新增参数,数据颜色分段数组。
  34861. * @param {number} [layerOptions.base] - 新增参数,数据分段线性增量。
  34862. * @param {number} [layerOptions.legendRatio=1] - 新增参数,图例数值扩大系数。
  34863. * @example
  34864. * new RangeTheme3DLayer(layerId, map, {
  34865. * enableHighlight:true,
  34866. * // 设置分段
  34867. * heightField: "floor",
  34868. * heightStops: [[1, 10], [10, 100]],
  34869. * 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)']],
  34870. * // 显示图例
  34871. * showLegend: true,
  34872. * legendTheme: 'dark',
  34873. * legendTitle: "图例"
  34874. * });
  34875. * @usage
  34876. */
  34877. class RangeTheme3DLayer extends Theme3DLayer {
  34878. constructor(id, layerOptions) {
  34879. super(id, layerOptions);
  34880. /**
  34881. * @member {Array} RangeTheme3DLayer.prototype.heightStops
  34882. * @description 数据高度分段数组。
  34883. */
  34884. this.heightStops = null;
  34885. /**
  34886. * @member {Array} RangeTheme3DLayer.prototype.colorStops
  34887. * @description 数据颜色分段数组。
  34888. */
  34889. this.colorStops = null;
  34890. /**
  34891. * @member {number} RangeTheme3DLayer.prototype.base
  34892. * @description 数据分段线性增量。
  34893. */
  34894. this.base = null;
  34895. /**
  34896. * @member {number} [RangeTheme3DLayer.prototype.legendRatio=1]
  34897. * @description 图例数值扩大系数。
  34898. */
  34899. this.legendRatio = 1;
  34900. this._extend(this, layerOptions);
  34901. }
  34902. /**
  34903. * @function RangeTheme3DLayer.prototype.getLayerStyleOptions
  34904. * @description 获取图层样式。
  34905. * @returns {Object} Mapbox GL 样式对象。
  34906. */
  34907. getLayerStyleOptions() {
  34908. var opacity = this.opacity == null ? 1 : this.opacity;
  34909. opacity = isNaN(parseFloat(opacity)) ? 1 : parseFloat(opacity);
  34910. var reg = /^[0-9]+.?[0-9]*$/;
  34911. var options = {
  34912. 'fill-extrusion-color': {
  34913. 'stops': this.colorStops,
  34914. 'property': this.themeField || this.heightField,
  34915. 'type': 'interval',
  34916. 'base': reg.test(this.base) ? this.base : 1
  34917. },
  34918. 'fill-extrusion-opacity': opacity
  34919. };
  34920. if (this.heightStops) {
  34921. options['fill-extrusion-height'] = {
  34922. 'stops': this.heightStops,
  34923. 'property': this.heightField || 'height',
  34924. 'base': reg.test(this.base) ? this.base : 1
  34925. }
  34926. } else if (this.height) {
  34927. options['fill-extrusion-height'] = this.height;
  34928. } else {
  34929. options['fill-extrusion-height'] = {
  34930. 'property': this.heightField || 'height',
  34931. 'type': 'identity'
  34932. }
  34933. }
  34934. if (this.baseHeightField) {
  34935. options['fill-extrusion-base'] = {
  34936. 'property': this.baseHeightField,
  34937. 'type': 'identity'
  34938. }
  34939. }
  34940. return options;
  34941. }
  34942. /**
  34943. * @function RangeTheme3DLayer.prototype.getHighlightStyleOptions
  34944. * @description 获取高亮样式。
  34945. * @returns {Object} mapboxgl 样式对象。
  34946. */
  34947. getHighlightStyleOptions() {
  34948. var color = (this.highlight && this.highlight.color != null) ? this.highlight.color : '#ADA91E';
  34949. return {
  34950. 'fill-extrusion-color': color,
  34951. 'fill-extrusion-height': {
  34952. "stops": this.heightStops,
  34953. "property": this.heightField
  34954. },
  34955. 'fill-extrusion-opacity': this.highlight && this.highlight.opacity || 0.6
  34956. }
  34957. }
  34958. _createLegendElement() {
  34959. var len = this.colorStops && this.colorStops.length || 0;
  34960. //颜色分段对应标识
  34961. var legendListElement = "<ul>";
  34962. var i;
  34963. for (i = 0; i < len; i++) {
  34964. var value = this.colorStops[i][0];
  34965. var text = this._getWrapperText(value);
  34966. if (i === len - 1) {
  34967. text = "> " + text;
  34968. } else {
  34969. var next = this._getWrapperText(this.colorStops[i + 1][0]);
  34970. text = text + "-" + next;
  34971. }
  34972. var color = this.colorStops[i][1];
  34973. legendListElement += "<li><span style='background-color:" + color + ";'></span><span>" + text + "</span></li>";
  34974. }
  34975. legendListElement += "</ul>";
  34976. return legendListElement;
  34977. }
  34978. _getWrapperText(number) {
  34979. var value = number * ((this.legendRatio == null) ? 1 : parseFloat(this.legendRatio));
  34980. //单个颜色值宽度为60px,最大只能完全显示1000000,否则就超出宽度,则显示以为k计数单位的值
  34981. var num = parseFloat(value);
  34982. if (num % 1000000 <= 1000000) {
  34983. return num.toString();
  34984. }
  34985. return parseInt(num / 1000) + 'k'
  34986. }
  34987. }
  34988. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/RangeThemeLayer.js
  34989. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34990. * This program are made available under the terms of the Apache License, Version 2.0
  34991. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34992. /**
  34993. * @class RangeThemeLayer
  34994. * @category Visualization Theme
  34995. * @classdesc 分段专题图层类。
  34996. * @modulecategory Overlay
  34997. * @param {string} name - 图层名。
  34998. * @param {Object} options - 参数。
  34999. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  35000. * @param {boolean} [options.loadWhileAnimating=true] - 是否实时重绘。
  35001. * @param {mapboxgl.Map} options.map - MapBoxGL Map 对象。
  35002. * @param {number} [options.opacity=1] - 图层不透明度。
  35003. * @param {string} options.themeField - 指定创建专题图字段。
  35004. * @param {Object} options.style - 专题图样式。
  35005. * @param {Object} options.styleGroups - 各专题类型样式组。
  35006. * @param {boolean} [options.isHoverAble=false] - 是否开启 hover 事件。
  35007. * @param {Object} [options.highlightStyle] - hover 的高亮样式。
  35008. * @extends {GeoFeatureThemeLayer}
  35009. * @usage
  35010. */
  35011. class Range extends GeoFeature {
  35012. constructor(name, opt_options) {
  35013. super(name, opt_options);
  35014. this.style = opt_options.style;
  35015. this.isHoverAble = opt_options.isHoverAble;
  35016. this.highlightStyle = opt_options.highlightStyle;
  35017. this.themeField = opt_options.themeField;
  35018. this.styleGroups = opt_options.styleGroups;
  35019. }
  35020. /**
  35021. * @function RangeThemeLayer.prototype.createThematicFeature
  35022. * @description 创建专题图要素。
  35023. * @param {Object} feature - 要创建的专题图形要素。
  35024. */
  35025. createThematicFeature(feature) {
  35026. //赋 style
  35027. var style = this.getStyleByData(feature);
  35028. //创建专题要素时的可选参数
  35029. var options = {};
  35030. options.nodesClipPixel = this.nodesClipPixel;
  35031. options.isHoverAble = this.isHoverAble;
  35032. options.isMultiHover = this.isMultiHover;
  35033. options.isClickAble = this.isClickAble;
  35034. options.highlightStyle = ShapeFactory.transformStyle(this.highlightStyle);
  35035. //将数据转为专题要素(Vector)
  35036. var thematicFeature = new ThemeVector(feature, this, ShapeFactory.transformStyle(style), options);
  35037. //直接添加图形到渲染器
  35038. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  35039. this.renderer.addShape(thematicFeature.shapes[m]);
  35040. }
  35041. return thematicFeature;
  35042. }
  35043. /**
  35044. * @private
  35045. * @function RangeThemeLayer.prototype.getStyleByData
  35046. * @description 通过数据获取 style。
  35047. * @param {Object} fea - 要素数据。
  35048. */
  35049. getStyleByData(fea) {
  35050. var style = {};
  35051. var feature = fea;
  35052. style = Util_Util.copyAttributesWithClip(style, this.style);
  35053. if (this.themeField && this.styleGroups && this.styleGroups.length > 0 && feature.attributes) {
  35054. var Sf = this.themeField;
  35055. var Attrs = feature.attributes;
  35056. var Gro = this.styleGroups;
  35057. var isSfInAttrs = false; //指定的 themeField 是否是 feature 的属性字段之一
  35058. var attr = null; //属性值
  35059. for (var property in Attrs) {
  35060. if (Sf === property) {
  35061. isSfInAttrs = true;
  35062. attr = Attrs[property];
  35063. break;
  35064. }
  35065. }
  35066. //判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
  35067. if (isSfInAttrs) {
  35068. for (var i = 0, len = Gro.length; i < len; i++) {
  35069. if ((attr >= Gro[i].start) && (attr < Gro[i].end)) {
  35070. //feature.style = CommonUtil.copyAttributes(feature.style, this.defaultStyle);
  35071. var sty1 = Gro[i].style;
  35072. style = Util_Util.copyAttributesWithClip(style, sty1);
  35073. }
  35074. }
  35075. }
  35076. }
  35077. if (feature.style && this.isAllowFeatureStyle === true) {
  35078. style = Util_Util.copyAttributesWithClip(feature.style);
  35079. }
  35080. return style;
  35081. }
  35082. }
  35083. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/RankSymbolThemeLayer.js
  35084. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35085. * This program are made available under the terms of the Apache License, Version 2.0
  35086. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35087. /**
  35088. * @class RankSymbolThemeLayer
  35089. * @category Visualization Theme
  35090. * @classdesc 等级符号专题图层类。
  35091. * @modulecategory Overlay
  35092. * @param {string} name - 图层名。
  35093. * @param {string} symbolType - 符号类型。
  35094. * @param {Object} opt_options - 参数。
  35095. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  35096. * @param {boolean} [opt_options.loadWhileAnimating=true] - 是否实时重绘。
  35097. * @param {mapboxgl.Map} opt_options.map - MapBoxGL Map 对象。
  35098. * @param {string} opt_options.themeFields - 指定创建专题图字段。
  35099. * @param {number} [opt_options.opacity=1] - 图层不透明度。
  35100. * @param {boolean} [opt_options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  35101. * @param {string} [opt_options.chartsType] - 图表类型。目前可用:"Bar", "Line", "Pie"。
  35102. * @param {Object} [opt_options.symbolSetting] - 各类型图表的 symbolSetting 对象可设属性请参考具体图表模型类的注释中对 symbolSetting 对象可设属性的描述。symbolSetting 对象通常都具有以下 5 个基础可设属性:
  35103. * @param {number} [opt_options.symbolSetting.width] - 专题要素(图表)宽度。
  35104. * @param {number} [opt_options.symbolSetting.height] - 专题要素(图表)高度。
  35105. * @param {Array.<number>} opt_options.symbolSetting.codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  35106. * @param {number} [opt_options.symbolSetting.XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  35107. * @param {number} [opt_options.symbolSetting.YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  35108. * @param {Array.<number>} opt_options.symbolSetting.dataViewBoxParameter - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值,长度为 4 的一维数组。
  35109. * @param {number} opt_options.symbolSetting.decimalNumber - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  35110. * @extends {GraphThemeLayer}
  35111. * @usage
  35112. */
  35113. class RankSymbol extends Graph {
  35114. constructor(name, symbolType, opt_options) {
  35115. super(name, symbolType, opt_options);
  35116. this.symbolType = symbolType;
  35117. this.symbolSetting = opt_options.symbolSetting;
  35118. this.themeField = opt_options.themeField;
  35119. }
  35120. /**
  35121. * @function RankSymbolThemeLayer.prototype.setSymbolType
  35122. * @description 设置标志符号。
  35123. * @param {string} [symbolType] - 符号类型。
  35124. */
  35125. setSymbolType(symbolType) {
  35126. this.symbolType = symbolType;
  35127. this.redraw();
  35128. }
  35129. /**
  35130. * @function RankSymbolThemeLayer.prototype.createThematicFeature
  35131. * @description 创建专题图形要素。
  35132. * @param {Object} feature - 要创建的专题图形要素。
  35133. */
  35134. createThematicFeature(feature) {
  35135. var thematicFeature;
  35136. // 检查图形创建条件并创建图形
  35137. if (Theme[this.symbolType] && this.themeField && this.symbolSetting) {
  35138. thematicFeature = new Theme[this.symbolType](feature, this, [this.themeField], this.symbolSetting);
  35139. }
  35140. // thematicFeature 是否创建成功
  35141. if (!thematicFeature) {
  35142. return false;
  35143. }
  35144. // 对专题要素执行图形装载
  35145. thematicFeature.assembleShapes();
  35146. return thematicFeature;
  35147. }
  35148. }
  35149. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/UniqueTheme3DLayer.js
  35150. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35151. * This program are made available under the terms of the Apache License, Version 2.0
  35152. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35153. /**
  35154. * @class UniqueTheme3DLayer
  35155. * @category Visualization Theme
  35156. * @classdesc 三维单值专题图类。
  35157. * @modulecategory Overlay
  35158. * @param {string} [id] - 专题图图层 ID。默认使用 CommonUtil.createUniqueID("theme3DLayer") 创建专题图层 ID。
  35159. * @param {Object} layerOptions - 专题图图层配置项,参数继承自 Theme3DLayer。
  35160. * @param {number} [layerOptions.height] - 新增参数,如果数据指定的 heightField (默认为 height )没有可以表示高度的字段,可以为所有数据统一设置一个高度。
  35161. * @param {Array} layerOptions.colorStops - 新增参数,数据颜色分段数组。
  35162. * @usage
  35163. */
  35164. class UniqueTheme3DLayer extends Theme3DLayer {
  35165. constructor(id, layerOptions) {
  35166. super(id, layerOptions);
  35167. /**
  35168. * @member {Array} UniqueTheme3DLayer.prototype.colorStops
  35169. * @description 数据颜色数组,如[["绿地","#CD7054"],["道路","#AD1283"]]。
  35170. */
  35171. this.colorStops = null;
  35172. this._extend(this, layerOptions);
  35173. }
  35174. /**
  35175. * @function UniqueTheme3DLayer.prototype.getLayerStyleOptions
  35176. * @description 获取图层样式。
  35177. * @returns {Object} Mapbox GL 样式对象。
  35178. */
  35179. getLayerStyleOptions() {
  35180. var opacity = this.opacity == null ? 1 : this.opacity;
  35181. opacity = isNaN(parseFloat(opacity)) ? 1 : parseFloat(opacity);
  35182. var options = {
  35183. 'fill-extrusion-color': {
  35184. 'stops': this.colorStops,
  35185. 'property': this.themeField,
  35186. 'type': 'categorical'
  35187. },
  35188. 'fill-extrusion-opacity': opacity
  35189. };
  35190. if (this.height != null) {
  35191. options['fill-extrusion-height'] = this.height;
  35192. } else {
  35193. options['fill-extrusion-height'] = {
  35194. 'property': this.heightField || 'height',
  35195. 'type': 'categorical'
  35196. };
  35197. }
  35198. if (this.baseHeightField) {
  35199. options['fill-extrusion-base'] = {
  35200. 'property': this.baseHeightField,
  35201. 'type': 'identity'
  35202. }
  35203. }
  35204. return options;
  35205. }
  35206. /**
  35207. * @function UniqueTheme3DLayer.prototype.getHighlightStyleOptions
  35208. * @description 获取高亮样式。
  35209. * @returns {Object} Mapbox GL 样式对象。
  35210. */
  35211. getHighlightStyleOptions() {
  35212. var color = (this.highlight && this.highlight.color != null) ? this.highlight.color : '#ADA91E';
  35213. var paint = {
  35214. 'fill-extrusion-color': color,
  35215. 'fill-extrusion-height': {
  35216. "stops": this.heightStops,
  35217. "property": this.heightField,
  35218. 'type': 'categorical'
  35219. },
  35220. 'fill-extrusion-opacity': this.highlight && this.highlight.opacity || 0.6
  35221. };
  35222. if (this.height != null) {
  35223. paint['fill-extrusion-height'] = this.height || 0;
  35224. }
  35225. return paint;
  35226. }
  35227. _createLegendElement() {
  35228. var legendListElement = "<ul>";
  35229. var len = this.colorStops && this.colorStops.length || 0;
  35230. for (var i = 0; i < len; i++) {
  35231. var text = this.colorStops[i][0];
  35232. var color = this.colorStops[i][1];
  35233. legendListElement += "<li><span style='background-color:" + color + ";'></span><span>" + text + "</span></li>";
  35234. }
  35235. legendListElement += "</ul>";
  35236. return legendListElement;
  35237. }
  35238. }
  35239. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/UniqueThemeLayer.js
  35240. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35241. * This program are made available under the terms of the Apache License, Version 2.0
  35242. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35243. /**
  35244. * @class UniqueThemeLayer
  35245. * @category Visualization Theme
  35246. * @classdesc 单值专题图层类。
  35247. * @modulecategory Overlay
  35248. * @param {string} name - 图层名。
  35249. * @param {Object} opt_options - 参数。
  35250. * @param {string} opt_options.themeField - 指定创建专题图字段。
  35251. * @param {Object} opt_options.style - 专题图样式。
  35252. * @param {Object} opt_options.styleGroups - 各专题类型样式组。
  35253. * @param {mapboxgl.Map} opt_options.map - MapBoxGL Map 对象。
  35254. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  35255. * @param {boolean} [opt_options.loadWhileAnimating=true] - 是否实时重绘。
  35256. * @param {number} [opt_options.opacity=1] - 图层不透明度。
  35257. * @param {boolean} [opt_options.isHoverAble=false] - 是否开启 hover 事件。
  35258. * @param {Object} [opt_options.highlightStyle] - hover 的高亮样式。
  35259. * @extends {GeoFeatureThemeLayer}
  35260. * @usage
  35261. */
  35262. class Unique extends GeoFeature {
  35263. constructor(name, opt_options) {
  35264. super(name, opt_options);
  35265. this.themeField = opt_options.themeField;
  35266. this.style = opt_options.style;
  35267. this.styleGroups = opt_options.styleGroups;
  35268. this.isHoverAble = opt_options.isHoverAble;
  35269. this.highlightStyle = opt_options.highlightStyle;
  35270. }
  35271. /**
  35272. * @private
  35273. * @function UniqueThemeLayer.prototype.createThematicFeature
  35274. * @description 创建专题图要素。
  35275. * @param {Object} feature - 要创建的专题图形要素。
  35276. */
  35277. createThematicFeature(feature) {
  35278. //赋 style
  35279. var style = this.getStyleByData(feature);
  35280. //创建专题要素时的可选参数
  35281. var options = {};
  35282. options.nodesClipPixel = this.nodesClipPixel;
  35283. options.isHoverAble = this.isHoverAble;
  35284. options.isMultiHover = this.isMultiHover;
  35285. options.isClickAble = this.isClickAble;
  35286. options.highlightStyle = ShapeFactory.transformStyle(this.highlightStyle);
  35287. //将数据转为专题要素(Vector)
  35288. var thematicFeature = new ThemeVector(feature, this, ShapeFactory.transformStyle(style), options);
  35289. //直接添加图形到渲染器
  35290. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  35291. this.renderer.addShape(thematicFeature.shapes[m]);
  35292. }
  35293. return thematicFeature;
  35294. }
  35295. /**
  35296. * @private
  35297. * @function UniqueThemeLayer.prototype.getStyleByData
  35298. * @description 通过数据获取 style。
  35299. * @param {Object} fea - 要素数据。
  35300. */
  35301. getStyleByData(fea) {
  35302. var style = {};
  35303. var feature = fea;
  35304. style = Util_Util.copyAttributesWithClip(style, this.style);
  35305. if (this.themeField && this.styleGroups && this.styleGroups.length > 0 && feature.attributes) {
  35306. var tf = this.themeField;
  35307. var Attrs = feature.attributes;
  35308. var Gro = this.styleGroups;
  35309. var isSfInAttrs = false; //指定的 themeField 是否是 feature 的属性字段之一
  35310. var attr = null; //属性值
  35311. for (var property in Attrs) {
  35312. if (tf === property) {
  35313. isSfInAttrs = true;
  35314. attr = Attrs[property];
  35315. break;
  35316. }
  35317. }
  35318. //判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
  35319. if (isSfInAttrs) {
  35320. for (var i = 0, len = Gro.length; i < len; i++) {
  35321. if ((attr).toString() === ( Gro[i].value).toString()) {
  35322. //feature.style = CommonUtil.copyAttributes(feature.style, this.defaultStyle);
  35323. var sty1 = Gro[i].style;
  35324. style = Util_Util.copyAttributesWithClip(style, sty1);
  35325. }
  35326. }
  35327. }
  35328. }
  35329. if (feature.style && this.isAllowFeatureStyle === true) {
  35330. style = Util_Util.copyAttributesWithClip(feature.style);
  35331. }
  35332. return style;
  35333. }
  35334. }
  35335. ;// CONCATENATED MODULE: ./src/common/overlay/graphic/GraphicLayerRenderer.js
  35336. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35337. * This program are made available under the terms of the Apache License, Version 2.0
  35338. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35339. const defaultProps = {
  35340. color: [0, 0, 0, 255],
  35341. opacity: 0.8,
  35342. radius: 10,
  35343. radiusScale: 1,
  35344. radiusMinPixels: 0,
  35345. radiusMaxPixels: Number.MAX_SAFE_INTEGER,
  35346. strokeWidth: 1,
  35347. outline: false
  35348. };
  35349. /**
  35350. * @private
  35351. * @class GraphicLayerRenderer
  35352. * @category Visualization Graphic
  35353. * @classdesc 高效率点图层。
  35354. * @param {string} [id] - 图层id。
  35355. * @param {Object} options - 参数。
  35356. * @param {Array.<Graphic>} options.graphics - 点要素对象数组 。
  35357. * @param {Array.<number>} [options.color=[0, 0, 0, 255]] - 颜色,目前只支持 rgba 数组。
  35358. * @param {number} [options.radius=10] - 半径。
  35359. * @param {number} [options.opacity=0.8] - 不透明度。
  35360. * @param {Array.<number>} [options.highlightColor=[0, 0, 128, 128]] - 高亮颜色,目前只支持 rgba 数组。
  35361. * @param {number} [options.radiusScale=1] - 点放大倍数。
  35362. * @param {number} [options.radiusMinPixels=0] - 半径最小值(像素)。
  35363. * @param {number} [options.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  35364. * @param {number} [options.strokeWidth=1] - 边框大小。
  35365. * @param {boolean} [options.outline=false] - 是否显示边框。
  35366. * @param {Object} [functions] - 图层传递给渲染器调用的方法。
  35367. * @param {Object} [mapOptions] - 图层传递给渲染器的地图元素信息。
  35368. * @usage
  35369. */
  35370. class GraphicLayerRenderer {
  35371. constructor(id, options, functions, mapOptions) {
  35372. let opt = Util_Util.assign(this, defaultProps, options);
  35373. /**
  35374. * @member {string} GraphicLayerRenderer.prototype.id
  35375. * @description 高效率点图层 ID。
  35376. */
  35377. this.id = id;
  35378. /**
  35379. * @member {Array.<Graphic>} GraphicLayerRenderer.prototype.graphics
  35380. * @description 点要素对象数组。
  35381. */
  35382. this.graphics = [].concat(opt.graphics);
  35383. /**
  35384. * @member {boolean} [GraphicLayerRenderer.prototype.visibility=true]
  35385. * @description 图层显示状态属性。
  35386. */
  35387. this.mapOptions = mapOptions;
  35388. this.functions = functions;
  35389. this.visibility = true;
  35390. this.init();
  35391. }
  35392. init() {
  35393. if (this.canvas) {
  35394. this.mapOptions.targetElement.appendChild(this.canvas);
  35395. }
  35396. this._initContainer();
  35397. let mapState = this.getState();
  35398. let {
  35399. data,
  35400. color,
  35401. radius,
  35402. opacity,
  35403. highlightColor,
  35404. radiusScale,
  35405. radiusMinPixels,
  35406. radiusMaxPixels,
  35407. strokeWidth,
  35408. outline
  35409. } = mapState;
  35410. let me = this;
  35411. let layerOptions = {
  35412. id: 'scatter-plot',
  35413. data,
  35414. pickable: Boolean(this.onClick) || Boolean(this.onHover),
  35415. autoHighlight: true,
  35416. color: color,
  35417. opacity: opacity,
  35418. radius: radius,
  35419. radiusScale: radiusScale,
  35420. highlightColor: highlightColor,
  35421. radiusMinPixels: radiusMinPixels,
  35422. radiusMaxPixels: radiusMaxPixels,
  35423. strokeWidth: strokeWidth,
  35424. outline: outline,
  35425. isGeographicCoordinateSystem: this.isGeographicCoordinateSystem,
  35426. coordinateSystem: this.coordinateSystem,
  35427. getPosition: function (point) {
  35428. if (!point) {
  35429. return [0, 0, 0];
  35430. }
  35431. let lngLat = point.getLngLat();
  35432. return lngLat && [lngLat.lng, lngLat.lat, 0];
  35433. },
  35434. getColor: function (point) {
  35435. let style = point && point.getStyle();
  35436. let color1 = style && style.color || me.color;
  35437. return color1;
  35438. },
  35439. getRadius: function (point) {
  35440. let style = point && point.getStyle();
  35441. return style && style.radius || me.radius
  35442. },
  35443. updateTriggers: {
  35444. getColor: [color],
  35445. getRadius: [radius]
  35446. }
  35447. };
  35448. if (this.onClick) {
  35449. layerOptions.onClick = this.onClick;
  35450. }
  35451. if (this.onHover) {
  35452. layerOptions.onHover = this.onHover;
  35453. }
  35454. this.layer = new window.DeckGL.ScatterplotLayer(layerOptions);
  35455. let deckOptions = {};
  35456. for (let key in mapState) {
  35457. deckOptions[key] = mapState[key];
  35458. }
  35459. let width = parseInt(this.canvas.style.width);
  35460. let height = parseInt(this.canvas.style.height);
  35461. deckOptions.width = width;
  35462. deckOptions.height = height;
  35463. deckOptions.layers = [this.layer];
  35464. deckOptions.canvas = this.canvas;
  35465. this.deckGL = new window.DeckGL.experimental.DeckGLJS(deckOptions);
  35466. this.draw();
  35467. }
  35468. /**
  35469. * @function GraphicLayerRenderer.prototype.setStyle
  35470. * @description 设置图层整体样式。
  35471. * @param {Object} styleOptions - 样式对象。
  35472. * @param {Array.<number>} [styleOptions.color=[0, 0, 0, 255]] - 点颜色。
  35473. * @param {number} [styleOptions.radius=10] - 点半径。
  35474. * @param {number} [styleOptions.opacity=0.8] - 不透明度。
  35475. * @param {Array.<number>} [styleOptions.highlightColor=[0, 0, 128, 128]] - 高亮颜色,目前只支持 rgba 数组。
  35476. * @param {number} [styleOptions.radiusScale=1] - 点放大倍数。
  35477. * @param {number} [styleOptions.radiusMinPixels=0] - 半径最小值(像素)。
  35478. * @param {number} [styleOptions.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  35479. * @param {number} [styleOptions.strokeWidth=1] - 边框大小。
  35480. * @param {boolean} [styleOptions.outline=false] - 是否显示边框。
  35481. */
  35482. setStyle(styleOptions) {
  35483. let styleOpt = {
  35484. color: this.color,
  35485. radius: this.radius,
  35486. opacity: this.opacity,
  35487. highlightColor: this.highlightColor,
  35488. radiusScale: this.radiusScale,
  35489. radiusMinPixels: this.radiusMinPixels,
  35490. radiusMaxPixels: this.radiusMaxPixels,
  35491. strokeWidth: this.strokeWidth,
  35492. outline: this.outline
  35493. };
  35494. Util_Util.assign(this, styleOpt, styleOptions);
  35495. this.update();
  35496. }
  35497. /**
  35498. * @function GraphicLayerRenderer.prototype.setGraphics
  35499. * @description 设置绘制的点要素数据,会覆盖之前的所有要素。
  35500. * @param {Array.<Graphic>} graphics - 点要素对象数组。
  35501. */
  35502. setGraphics(graphics) {
  35503. this.graphics = this.graphics || [];
  35504. this.graphics.length = 0;
  35505. let sGraphics = !Util_Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  35506. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  35507. if (!this.layer.props.data) {
  35508. this.layer.props.data = [];
  35509. }
  35510. this.layer.props.data.length = 0;
  35511. for (let i = 0; i < sGraphics.length; i++) {
  35512. this.layer.props.data.push(sGraphics[i]);
  35513. }
  35514. this.update();
  35515. }
  35516. /**
  35517. * @function GraphicLayerRenderer.prototype.addGraphics
  35518. * @description 添加点要素,不会覆盖之前的要素。
  35519. * @param {Array.<Graphic>} graphics - 点要素对象数组。
  35520. */
  35521. addGraphics(graphics) {
  35522. this.graphics = this.graphics || [];
  35523. let sGraphics = !Util_Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  35524. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  35525. if (!this.layer.props.data) {
  35526. this.layer.props.data = [];
  35527. }
  35528. for (let i = 0; i < sGraphics.length; i++) {
  35529. this.layer.props.data.push(sGraphics[i]);
  35530. }
  35531. this.update();
  35532. }
  35533. /**
  35534. * @function GraphicLayerRenderer.prototype.getGraphicBy
  35535. * @description 在 Vector 的要素数组 graphics 里面遍历每一个 graphic,当 graphic[property]===value 时,返回此 graphic(并且只返回第一个)。
  35536. * @param {string} property - graphic 的某个属性名称。
  35537. * @param {string} value - property 所对应的值。
  35538. * @returns {Graphic} 一个匹配的 graphic。
  35539. */
  35540. getGraphicBy(property, value) {
  35541. let graphic = null;
  35542. for (let index in this.graphics) {
  35543. if (this.graphics[index][property] === value) {
  35544. graphic = this.graphics[index];
  35545. break;
  35546. }
  35547. }
  35548. return graphic;
  35549. }
  35550. /**
  35551. * @function GraphicLayerRenderer.prototype.getGraphicById
  35552. * @description 通过给定一个 ID,返回对应的矢量要素。
  35553. * @param {string} graphicId - 矢量要素的属性 ID。
  35554. * @returns {Graphic} 一个匹配的 graphic。
  35555. */
  35556. getGraphicById(graphicId) {
  35557. return this.getGraphicBy("id", graphicId);
  35558. }
  35559. /**
  35560. * @function GraphicLayerRenderer.prototype.getGraphicsByAttribute
  35561. * @description 通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
  35562. * @param {string} attrName - graphic 的某个属性名称。
  35563. * @param {string} attrValue - property 所对应的值。
  35564. * @returns {Array.<Graphic>} 一个匹配的 graphic 数组。
  35565. */
  35566. getGraphicsByAttribute(attrName, attrValue) {
  35567. var graphic,
  35568. foundgraphics = [];
  35569. for (let index in this.graphics) {
  35570. graphic = this.graphics[index];
  35571. if (graphic && graphic.attributes) {
  35572. if (graphic.attributes[attrName] === attrValue) {
  35573. foundgraphics.push(graphic);
  35574. }
  35575. }
  35576. }
  35577. return foundgraphics;
  35578. }
  35579. /**
  35580. * @function GraphicLayerRenderer.prototype.removeGraphics
  35581. * @description 删除要素数组,默认将删除所有要素
  35582. * @param {Array.<Graphic>} [graphics=null] - 删除的 graphics 数组
  35583. */
  35584. removeGraphics(graphics = null) {
  35585. //当 graphics 为 null 、为空数组,或 === this.graphics,则清除所有要素
  35586. if (!graphics || graphics.length === 0 || graphics === this.graphics) {
  35587. this.graphics.length = 0;
  35588. if (this.layer.props.data) {
  35589. this.layer.props.data.length = 0;
  35590. }
  35591. this.update();
  35592. return;
  35593. }
  35594. if (!(Util_Util.isArray(graphics))) {
  35595. graphics = [graphics];
  35596. }
  35597. for (let i = graphics.length - 1; i >= 0; i--) {
  35598. let graphic = graphics[i];
  35599. //如果我们传入的grapchic在graphics数组中没有的话,则不进行删除,
  35600. //并将其放入未删除的数组中。
  35601. let findex = Util_Util.indexOf(this.graphics, graphic);
  35602. if (findex === -1) {
  35603. continue;
  35604. }
  35605. this.graphics.splice(findex, 1);
  35606. }
  35607. //删除完成后重新设置 setGraphics,以更新
  35608. this.update();
  35609. }
  35610. /**
  35611. * @function GraphicLayerRenderer.prototype.update
  35612. * @description 更新图层。
  35613. */
  35614. update() {
  35615. if (this.layer.lifecycle !== 'Awaiting state') {
  35616. this.layer.setChangeFlags({
  35617. dataChanged: true,
  35618. propsChanged: true,
  35619. viewportChanged: true,
  35620. updateTriggersChanged: true
  35621. });
  35622. let state = this.getState();
  35623. let width = parseInt(this.canvas.style.width);
  35624. let height = parseInt(this.canvas.style.height);
  35625. state.width = width;
  35626. state.height = height;
  35627. this.layer.setState(state);
  35628. }
  35629. }
  35630. /**
  35631. * @function GraphicLayerRenderer.prototype.clear
  35632. * @description 释放图层资源。
  35633. */
  35634. clear() {
  35635. this.removeGraphics();
  35636. this.deckGL.finalize();
  35637. }
  35638. /**
  35639. * @function GraphicLayerRenderer.prototype.remove
  35640. * @description 删除该图层。
  35641. */
  35642. remove() {
  35643. this.mapOptions.targetElement.removeChild(this.canvas);
  35644. }
  35645. /**
  35646. * @function GraphicLayerRenderer.prototype.destroy
  35647. * @deprecated
  35648. * @description 删除该图层,并释放图层资源。
  35649. */
  35650. destroy() {
  35651. this.remove();
  35652. this.clear();
  35653. }
  35654. /**
  35655. * @function GraphicLayerRenderer.prototype.moveTo
  35656. * @description 将图层移动到某个图层之前。
  35657. * @param {string} layerID - 待插入的图层 ID。
  35658. * @param {boolean} [before=true] - 是否将本图层插入到图层 ID 为 layerID 的图层之前。
  35659. */
  35660. moveTo(layerID, before) {
  35661. var layer = document.getElementById(this.id);
  35662. before = before !== undefined ? before : true;
  35663. if (before) {
  35664. var beforeLayer = document.getElementById(layerID);
  35665. if (layer && beforeLayer) {
  35666. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  35667. }
  35668. return;
  35669. }
  35670. var nextLayer = document.getElementById(layerID);
  35671. if (layer) {
  35672. if (nextLayer.nextSibling) {
  35673. nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
  35674. return;
  35675. }
  35676. nextLayer.parentNode.appendChild(layer);
  35677. }
  35678. }
  35679. /**
  35680. * @function GraphicLayerRenderer.prototype.setVisibility
  35681. * @description 设置图层可见性。
  35682. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  35683. */
  35684. setVisibility(visibility) {
  35685. if (this.canvas && visibility !== this.visibility) {
  35686. this.visibility = visibility;
  35687. this.canvas.style.display = visibility ? "block" : "none";
  35688. }
  35689. }
  35690. /**
  35691. * @function GraphicLayerRenderer.prototype.draw
  35692. * @description 绘制图层。
  35693. */
  35694. draw() {
  35695. let mapState = this.getState();
  35696. let deckOptions = {};
  35697. for (let key in mapState) {
  35698. deckOptions[key] = mapState[key];
  35699. }
  35700. let width = parseInt(this.canvas.style.width);
  35701. let height = parseInt(this.canvas.style.height);
  35702. deckOptions.width = width;
  35703. deckOptions.height = height;
  35704. deckOptions.layers = [this.layer];
  35705. deckOptions.canvas = this.canvas;
  35706. this.deckGL.setProps(deckOptions);
  35707. }
  35708. _initContainer() {
  35709. this.canvas = this._createCanvas(this.mapOptions.mapElement);
  35710. this.mapOptions.targetElement.appendChild(this.canvas);
  35711. }
  35712. _createCanvas(mapElement) {
  35713. let canvas = document.createElement('canvas');
  35714. if (this.id) {
  35715. canvas.id = this.id;
  35716. }
  35717. canvas.style.position = 'absolute';
  35718. canvas.style.top = 0 + "px";
  35719. canvas.style.left = 0 + "px";
  35720. canvas.style.cursor = "";
  35721. canvas.width = parseInt(mapElement.style.width);
  35722. canvas.height = parseInt(mapElement.style.height);
  35723. canvas.style.width = mapElement.style.width;
  35724. canvas.style.height = mapElement.style.height;
  35725. return canvas;
  35726. }
  35727. getState() {
  35728. let mapState = this.functions.getMapState();
  35729. return {
  35730. data: this.graphics,
  35731. color: this.color,
  35732. radius: this.radius,
  35733. opacity: this.opacity,
  35734. highlightColor: this.highlightColor,
  35735. radiusScale: this.radiusScale,
  35736. radiusMinPixels: this.radiusMinPixels,
  35737. radiusMaxPixels: this.radiusMaxPixels,
  35738. strokeWidth: this.strokeWidth,
  35739. outline: this.outline,
  35740. ...mapState
  35741. };
  35742. }
  35743. }
  35744. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/GraphicLayer.js
  35745. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35746. * This program are made available under the terms of the Apache License, Version 2.0
  35747. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35748. /**
  35749. * @class GraphicLayer
  35750. * @category Visualization Graphic
  35751. * @classdesc 高效率点图层类。
  35752. * @modulecategory Overlay
  35753. * @version 11.1.0
  35754. * @param {string} [id] - 图层id。默认使用 CommonUtil.createUniqueID("graphicLayer_") 创建专题图层 ID。
  35755. * @param {Object} options - 参数。
  35756. * @param {Array.<Graphic>} options.graphics - 点要素对象数组 。
  35757. * @param {Array.<number>} [options.color=[0, 0, 0, 255]] - 颜色,目前只支持 rgba 数组。
  35758. * @param {number} [options.radius=10] - 半径。
  35759. * @param {number} [options.opacity=0.8] - 不透明度。
  35760. * @param {Array.<number>} [options.highlightColor=[0, 0, 128, 128]] - 高亮颜色,目前只支持 rgba 数组。
  35761. * @param {number} [options.radiusScale=1] - 点放大倍数。
  35762. * @param {number} [options.radiusMinPixels=0] - 半径最小值(像素)。
  35763. * @param {number} [options.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  35764. * @param {number} [options.strokeWidth=1] - 边框大小。
  35765. * @param {boolean} [options.outline=false] - 是否显示边框。
  35766. * @usage
  35767. */
  35768. class GraphicLayer {
  35769. constructor(id, options) {
  35770. this.options = options;
  35771. /**
  35772. * @member {string} GraphicLayer.prototype.id
  35773. * @description 高效率点图层 ID。
  35774. */
  35775. this.id = id || Util_Util.createUniqueID("graphicLayer_");
  35776. this.type = 'custom';
  35777. this.renderingMode = '3d';
  35778. this.overlay = true;
  35779. }
  35780. /**
  35781. * @function GraphicLayer.prototype.addTo
  35782. * @deprecated
  35783. * @description 添加该图层,将在下个版本废弃,请使用 onAdd() 代替。
  35784. * @param {mapboxgl.Map} map - mapboxgl Map 对象。
  35785. * @returns this
  35786. */
  35787. addTo(map) {
  35788. this.onAdd(map);
  35789. return this;
  35790. }
  35791. /**
  35792. * @function GraphicLayer.prototype.onAdd
  35793. * @description 添加该图层。
  35794. * @param {mapboxgl.Map} map - mapboxgl Map 对象。
  35795. * @returns {GraphicLayer}
  35796. */
  35797. onAdd(map) {
  35798. this.map = map;
  35799. this.renderer = new GraphicLayerRenderer(this.id, this.options, {
  35800. getMapState: this.getMapState.bind(this)
  35801. }, { targetElement: this.map.getCanvasContainer(), mapElement: this.map.getCanvas() });
  35802. }
  35803. /**
  35804. * @function GraphicLayer.prototype.onRemove
  35805. * @deprecated
  35806. * @description 删除该图层,并释放图层资源。
  35807. */
  35808. onRemove() {
  35809. this.remove();
  35810. this.clear();
  35811. }
  35812. /**
  35813. * @function GraphicLayer.prototype.render
  35814. * @description 渲染图层。
  35815. */
  35816. render() {
  35817. this.renderer.draw();
  35818. }
  35819. /**
  35820. * @function GraphicLayer.prototype.setStyle
  35821. * @description 设置图层整体样式。
  35822. * @param {Object} styleOptions - 样式对象。
  35823. * @param {Array.<number>} [styleOptions.color=[0, 0, 0, 255]] - 点颜色。
  35824. * @param {number} [styleOptions.radius=10] - 点半径。
  35825. * @param {number} [styleOptions.opacity=0.8] - 不透明度。
  35826. * @param {Array.<number>} [styleOptions.highlightColor=[0, 0, 128, 128]] - 高亮颜色,目前只支持 rgba 数组。
  35827. * @param {number} [styleOptions.radiusScale=1] - 点放大倍数。
  35828. * @param {number} [styleOptions.radiusMinPixels=0] - 半径最小值(像素)。
  35829. * @param {number} [styleOptions.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  35830. * @param {number} [styleOptions.strokeWidth=1] - 边框大小。
  35831. * @param {boolean} [styleOptions.outline=false] - 是否显示边框。
  35832. */
  35833. setStyle(styleOptions) {
  35834. this.renderer && this.renderer.setStyle(styleOptions);
  35835. }
  35836. /**
  35837. * @function GraphicLayer.prototype.setGraphics
  35838. * @description 设置绘制的点要素数据,会覆盖之前的所有要素。
  35839. * @param {Array.<Graphic>} graphics - 点要素对象数组。
  35840. */
  35841. setGraphics(graphics) {
  35842. this.renderer && this.renderer.setGraphics(graphics);
  35843. }
  35844. /**
  35845. * @function GraphicLayer.prototype.addGraphics
  35846. * @description 添加点要素,不会覆盖之前的要素。
  35847. * @param {Array.<Graphic>} graphics - 点要素对象数组。
  35848. */
  35849. addGraphics(graphics) {
  35850. this.renderer && this.renderer.addGraphics(graphics);
  35851. }
  35852. /**
  35853. * @function GraphicLayer.prototype.getGraphicBy
  35854. * @description 在 Vector 的要素数组 graphics 里面遍历每一个 graphic,当 graphic[property]===value 时,返回此 graphic(并且只返回第一个)。
  35855. * @param {string} property - graphic 的某个属性名称。
  35856. * @param {string} value - property 所对应的值。
  35857. * @returns {Graphic} 一个匹配的 graphic。
  35858. */
  35859. getGraphicBy(property, value) {
  35860. return this.renderer && this.renderer.getGraphicBy(property, value);
  35861. }
  35862. /**
  35863. * @function GraphicLayer.prototype.getGraphicById
  35864. * @description 通过给定一个 ID,返回对应的矢量要素。
  35865. * @param {string} graphicId - 矢量要素的属性 ID。
  35866. * @returns {Graphic} 一个匹配的 graphic。
  35867. */
  35868. getGraphicById(graphicId) {
  35869. return this.getGraphicBy("id", graphicId);
  35870. }
  35871. /**
  35872. * @function GraphicLayer.prototype.getGraphicsByAttribute
  35873. * @description 通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
  35874. * @param {string} attrName - graphic 的某个属性名称。
  35875. * @param {string} attrValue - property 所对应的值。
  35876. * @returns {Array.<Graphic>} 一个匹配的 graphic 数组。
  35877. */
  35878. getGraphicsByAttribute(attrName, attrValue) {
  35879. return this.renderer && this.renderer.getGraphicsByAttribute(attrName, attrValue);
  35880. }
  35881. /**
  35882. * @function GraphicLayer.prototype.removeGraphics
  35883. * @description 删除要素数组,默认将删除所有要素
  35884. * @param {Array.<Graphic>} [graphics=null] - 删除的 graphics 数组
  35885. */
  35886. removeGraphics(graphics = null) {
  35887. this.renderer && this.renderer.removeGraphics(graphics);
  35888. }
  35889. /**
  35890. * @function GraphicLayer.prototype.clear
  35891. * @description 释放图层资源。
  35892. */
  35893. clear() {
  35894. this.renderer && this.renderer.clear();
  35895. }
  35896. /**
  35897. * @function GraphicLayer.prototype.remove
  35898. * @description 删除该图层。
  35899. */
  35900. remove() {
  35901. this.renderer && this.renderer.remove();
  35902. }
  35903. /**
  35904. * @function GraphicLayer.prototype.moveTo
  35905. * @description 将图层移动到某个图层之前。
  35906. * @param {string} layerID - 待插入的图层 ID。
  35907. * @param {boolean} [before=true] - 是否将本图层插入到图层 ID 为 layerID 的图层之前。
  35908. */
  35909. moveTo(layerID, before) {
  35910. this.renderer.moveTo(layerID, before);
  35911. }
  35912. /**
  35913. * @function GraphicLayer.prototype.setVisibility
  35914. * @description 设置图层可见性。
  35915. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  35916. */
  35917. setVisibility(visibility) {
  35918. this.renderer.setVisibility(visibility);
  35919. }
  35920. /**
  35921. * @function GraphicLayer.prototype.getState
  35922. * @description 获取当前地图及图层状态。
  35923. * @returns {Object} 地图及图层状态,包含地图状态信息和本图层相关状态。
  35924. */
  35925. getState() {
  35926. return this.renderer.getState();
  35927. }
  35928. /**
  35929. * @function GraphicLayer.prototype.getMapState
  35930. * @description 获取当前地图状态。
  35931. * @returns {Object} 地图状态,包含地图状态信息。
  35932. */
  35933. getMapState() {
  35934. let state = {};
  35935. let center = this.map.getCenter();
  35936. let longitude = center.lng;
  35937. let latitude = center.lat;
  35938. let zoom = this.map.getZoom();
  35939. let maxZoom = this.map.getMaxZoom();
  35940. let pitch = this.map.getPitch();
  35941. let bearing = this.map.getBearing();
  35942. let mapViewport = {
  35943. longitude: longitude,
  35944. latitude: latitude,
  35945. zoom: zoom,
  35946. maxZoom: maxZoom,
  35947. pitch: pitch,
  35948. bearing: bearing
  35949. };
  35950. for (let key in mapViewport) {
  35951. state[key] = mapViewport[key];
  35952. }
  35953. //当使用扩展的mapboxgl代码时有效
  35954. if (this.map.getCRS && this.map.getCRS() !== (external_mapboxgl_default()).CRS.EPSG3857) {
  35955. state.coordinateSystem = this.coordinateSystem;
  35956. state.isGeographicCoordinateSystem = this.isGeographicCoordinateSystem;
  35957. }
  35958. return state;
  35959. }
  35960. }
  35961. ;// CONCATENATED MODULE: external "function(){try{return THREE}catch(e){return {}}}()"
  35962. const external_function_try_return_THREE_catch_e_return_namespaceObject = function(){try{return THREE}catch(e){return {}}}();
  35963. ;// CONCATENATED MODULE: ./src/common/overlay/threejs/Transform.js
  35964. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35965. * This program are made available under the terms of the Apache License, Version 2.0
  35966. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35967. function wrap(source, min, max) {
  35968. if (source === max || source === min) {
  35969. return source;
  35970. }
  35971. let len = max - min;
  35972. return ((source - min) % len + len) % len + min
  35973. }
  35974. function rad(angle) {
  35975. return angle * Math.PI / 180;
  35976. }
  35977. var Projection = {
  35978. R: 6378137,
  35979. minZoom: 0,
  35980. maxZoom: 22,
  35981. nativeMaxZoom: 19,
  35982. RAD: Math.PI / 180,
  35983. METERS_PER_DEGREE: 6378137 * Math.PI / 180,
  35984. MAX_LATITUDE: 85.0511287798,
  35985. project: function (lngLat) {
  35986. const rad = this.RAD,
  35987. metersPerDegree = this.METERS_PER_DEGREE,
  35988. max = this.MAX_LATITUDE;
  35989. let ll = (lngLat instanceof Array)
  35990. ? {lng: lngLat[0], lat: lngLat[1]}
  35991. : {lng: lngLat.lng, lat: lngLat.lat};
  35992. let lng = ll.lng, lat = Math.max(Math.min(max, ll.lat), -max);
  35993. let c;
  35994. if (lat === 0) {
  35995. c = 0;
  35996. } else {
  35997. c = Math.log(Math.tan((90 + lat) * rad / 2)) / rad;
  35998. }
  35999. return {x: lng * metersPerDegree, y: c * metersPerDegree};
  36000. },
  36001. unproject: function (point) {
  36002. const x = point.x,
  36003. y = point.y;
  36004. const rad = this.RAD,
  36005. metersPerDegree = this.METERS_PER_DEGREE;
  36006. let c;
  36007. if (y === 0) {
  36008. c = 0;
  36009. } else {
  36010. c = y / metersPerDegree;
  36011. c = (2 * Math.atan(Math.exp(c * rad)) - Math.PI / 2) / rad;
  36012. }
  36013. return {lng: wrap(x / metersPerDegree, -180, 180), lat: wrap(c, -this.MAX_LATITUDE, this.MAX_LATITUDE)};
  36014. },
  36015. locate: function (lngLat, dx, dy) {
  36016. if (!lngLat) {
  36017. return null;
  36018. }
  36019. dx = !dx ? 0 : dx;
  36020. dy = !dy ? 0 : dy;
  36021. if (!dx && !dy) {
  36022. return lngLat;
  36023. }
  36024. let lng = lngLat.lng;
  36025. if (dx !== 0) {
  36026. let ndx = Math.abs(dx), radLng = rad(lngLat.lng);
  36027. let sLng = 2 * Math.sqrt(Math.pow(Math.sin(ndx / (2 * this.R)), 2) / Math.pow(Math.cos(radLng), 2));
  36028. radLng = radLng + sLng * (ndx > 0 ? 1 : -1);
  36029. lng = wrap(radLng * 180 / Math.PI, -180, 180);
  36030. }
  36031. let lat = lngLat.lat;
  36032. if (dy !== 0) {
  36033. let ndy = Math.abs(dy), radLat = rad(lngLat.lat);
  36034. let sLat = Math.sin(ndy / (2 * this.R)) * 2;
  36035. radLat = radLat + sLat * (ndy > 0 ? 1 : -1);
  36036. lat = wrap(radLat * 180 / Math.PI, -90, 90);
  36037. }
  36038. return {lng, lat};
  36039. },
  36040. getResolution: function (zoom) {
  36041. if (!this.resolutions) {
  36042. var resolutions = [];
  36043. var d = 2 * 6378137 * Math.PI;
  36044. for (var i = 0; i <= this.maxZoom; i++) {
  36045. resolutions[i] = d / (256 * Math.pow(2, i));
  36046. }
  36047. this.resolutions = resolutions;
  36048. }
  36049. let z = (zoom | 0), length = this.resolutions.length;
  36050. z = z < 0 ? 0 : z > length - 1 ? length - 1 : z;
  36051. const res = this.resolutions[z];
  36052. if ((zoom | 0) !== zoom && z !== length - 1) {
  36053. const next = this.resolutions[z + 1];
  36054. return res + (next - res) * (zoom - z);
  36055. }
  36056. return res;
  36057. }
  36058. };
  36059. var Transform = {
  36060. matrix: [1, -1, 0, 0],
  36061. projection: Projection,
  36062. project: function (lngLat) {
  36063. return this.projection.project(lngLat);
  36064. },
  36065. unproject: function (point) {
  36066. return this.projection.unproject(point);
  36067. },
  36068. lngLatToPoint: function (lngLat, zoom) {
  36069. var pt = this.project(lngLat);
  36070. return this.transform(pt, this.projection.getResolution(zoom));
  36071. },
  36072. locate: function (lngLat, dx, dy) {
  36073. return this.projection.locate(lngLat, dx, dy);
  36074. },
  36075. transform: function (point, scale) {
  36076. return {
  36077. x: this.matrix[0] * (point.x - this.matrix[2]) / scale,
  36078. y: this.matrix[1] * (point.y - this.matrix[3]) / scale
  36079. };
  36080. }
  36081. };
  36082. ;// CONCATENATED MODULE: ./src/common/overlay/threejs/ThreeLayerRenderer.js
  36083. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36084. * This program are made available under the terms of the Apache License, Version 2.0
  36085. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36086. /**
  36087. * reference and modification
  36088. * maptalks.three
  36089. * (https://github.com/maptalks/maptalks.three)
  36090. * Apache Licene 2.0
  36091. * thanks maptalks
  36092. */
  36093. const projection = Transform.projection;
  36094. const {
  36095. Color: ThreeLayerRenderer_Color,
  36096. Scene,
  36097. WebGLRenderer,
  36098. PerspectiveCamera,
  36099. Vector3,
  36100. Shape: ThreeLayerRenderer_Shape,
  36101. Mesh,
  36102. ExtrudeGeometry
  36103. } = external_function_try_return_THREE_catch_e_return_namespaceObject;
  36104. const RADIAN = Math.PI / 180;
  36105. const ThreeLayerRenderer_frame = window.requestAnimationFrame ||
  36106. window.mozRequestAnimationFrame ||
  36107. window.webkitRequestAnimationFrame ||
  36108. window.msRequestAnimationFrame;
  36109. const cancel = window.cancelAnimationFrame ||
  36110. window.mozCancelAnimationFrame ||
  36111. window.webkitCancelAnimationFrame ||
  36112. window.msCancelAnimationFrame;
  36113. /**
  36114. * @private
  36115. * @class ThreeLayerRenderer
  36116. * @category Visualization Three
  36117. * @classdesc Three 图层渲染器
  36118. * @param {ThreeLayer} layer - ThreeJs图层。
  36119. * @param {string} [renderer="gl"] - 图层渲染器,仅支持"gl"。'canvas'在v11.1.0后被弃用。
  36120. * @param {Object} options - threejs渲染器初始化参数对象。参数内容详见:
  36121. * [WebGLRenderer]{@link https://threejs.org/docs/index.html#api/renderers/WebGLRenderer}
  36122. *
  36123. */
  36124. class ThreeLayerRenderer {
  36125. constructor(layer, renderer, options) {
  36126. this._layer = layer;
  36127. this.renderer = renderer || "gl";
  36128. this.options = options;
  36129. }
  36130. setMap(map) {
  36131. this.map = map;
  36132. }
  36133. //开始渲染
  36134. render() {
  36135. if (!this._layer) {
  36136. return;
  36137. }
  36138. this.prepare();
  36139. /**
  36140. * @event ThreeLayer#initialized
  36141. * @description three 初始化之后后触发。
  36142. */
  36143. this._layer.fire("initialized");
  36144. this._layer && this._layer.draw(this.context, this.scene, this.camera);
  36145. /**
  36146. * @event ThreeLayer#draw
  36147. * @description draw 绘制事件,调用提供给外部绘制的接口后触发。
  36148. */
  36149. this._layer.fire("draw");
  36150. this.renderScene();
  36151. }
  36152. update() {
  36153. this.remove();
  36154. this.render();
  36155. }
  36156. //渲染场景(模型已经添加到图层)
  36157. renderScene() {
  36158. this.locationCamera();
  36159. this.animationFrame = this.renderFrame((function () {
  36160. this.animationFrame = null;
  36161. this.context && this.context.render(this.scene, this.camera);
  36162. }).bind(this));
  36163. }
  36164. renderFrame(fn) {
  36165. var render = function () {
  36166. fn && typeof fn === "function" && fn();
  36167. };
  36168. return ThreeLayerRenderer_frame(render);
  36169. }
  36170. resize() {
  36171. this._resetElementSize(this.container);
  36172. this._resetElementSize(this.canvas);
  36173. let width = this.canvas.width,
  36174. height = this.canvas.height;
  36175. let size = this.getMapSize();
  36176. this.camera.aspect = width / height;
  36177. this.camera.updateProjectionMatrix();
  36178. this.context.setSize(size.width, size.height);
  36179. this.renderScene();
  36180. }
  36181. //创建画布、初始化渲染器、初始化相机等
  36182. prepare() {
  36183. if (!this.map) {
  36184. return new Error("map object is necessary");
  36185. }
  36186. if (!this.canvas) {
  36187. this._initContainer();
  36188. this._initThreeRenderer();
  36189. /**
  36190. * @event ThreeLayer#rendererinitialized
  36191. * @description rendererinitialized 事件,初始化 three 渲染器后触发。
  36192. */
  36193. this._layer.fire("rendererinitialized");
  36194. } else {
  36195. this.clear(this.context);
  36196. }
  36197. }
  36198. getMapSize() {
  36199. let container = this.map.getContainer();
  36200. return { width: container.clientWidth, height: container.clientHeight };
  36201. }
  36202. cancelFrame() {
  36203. if (this.animationFrame != null) {
  36204. cancel(this.animationFrame);
  36205. }
  36206. }
  36207. remove() {
  36208. if (this.animationFrame != null) {
  36209. cancel(this.animationFrame);
  36210. }
  36211. this.container.removeChild(this.canvas);
  36212. this.container.parentNode.removeChild(this.container);
  36213. this.context = null;
  36214. this.canvas = null;
  36215. this.container = null;
  36216. }
  36217. //清理画布内容
  36218. clear(context) {
  36219. context && context.clear && context.clear();
  36220. context && context.clearRect && context.clearRect(0, 0, context.canvas.width, context.canvas.height);
  36221. }
  36222. //计算缩放比例
  36223. getScale(zoom) {
  36224. let map = this.map;
  36225. let z = zoom == null ? map.getZoom() : zoom;
  36226. let max = projection.getResolution(projection.nativeMaxZoom),
  36227. res = projection.getResolution(z);
  36228. return res / max;
  36229. }
  36230. getCanvasContainer() {
  36231. return this.container;
  36232. }
  36233. getCanvas() {
  36234. return this.canvas;
  36235. }
  36236. //重新设置相机位置
  36237. locationCamera() {
  36238. let map = this.map;
  36239. let size = this.getMapSize();
  36240. let scale = map.transform.zoomScale(projection.nativeMaxZoom - map.getZoom() - 1);
  36241. let fovRatio = Math.tan(map.transform.fov / 2 * RADIAN);
  36242. let camera = this.camera;
  36243. //倾斜时,相机位置低于Z轴
  36244. let pitch = map.getPitch() * RADIAN;
  36245. let pZ = -scale * size.height / 2 / fovRatio;
  36246. camera.position.z = pZ * Math.cos(pitch);
  36247. let centerPoint = Transform.lngLatToPoint(map.getCenter(), projection.nativeMaxZoom);
  36248. let distance = Math.sin(pitch) * pZ;
  36249. let bearing = map.getBearing() * RADIAN;
  36250. camera.position.x = centerPoint.x + distance * Math.sin(bearing);
  36251. camera.position.y = centerPoint.y - distance * Math.cos(bearing);
  36252. camera.up.set(Math.sin(bearing), -Math.cos(bearing), 0);
  36253. camera.lookAt(new external_function_try_return_THREE_catch_e_return_namespaceObject.Vector3(centerPoint.x, centerPoint.y, 0));
  36254. camera.updateProjectionMatrix();
  36255. }
  36256. /**
  36257. * @function ThreeLayerRenderer.prototype.toThreeShape
  36258. * @description 创建 threejs shape 对象。
  36259. * @param {Array} coordinates - 坐标点数组。
  36260. * @returns {THREE.Shape} threejs shape 对象。
  36261. */
  36262. toThreeShape(coordinates) {
  36263. if (!coordinates) {
  36264. return null;
  36265. }
  36266. let center = this.getCoordinatesCenter(coordinates);
  36267. let centerPoint = this.lngLatToPosition(center);
  36268. let outer = coordinates.map(coords => this.lngLatToPosition({
  36269. lng: coords[0],
  36270. lat: coords[1]
  36271. }).sub(centerPoint));
  36272. return new ThreeLayerRenderer_Shape(outer);
  36273. }
  36274. /**
  36275. * @function ThreeLayerRenderer.prototype.toThreeMesh
  36276. * @description 创建 threejs Mesh 对象。将地理坐标转换成 threejs 3D 模型(适用于挤压模型,如城市建筑)。
  36277. * @param {Array.<Object>} coordinates - 坐标点数组。
  36278. * @param {number} amount - 高度。
  36279. * @param {THREE.Material} material - Threejs 材质对象。
  36280. * @param {boolean} [removeDuplicated] - 是否移除重复的坐标点。
  36281. * @returns {THREE.Mesh} threejs Mesh 对象。
  36282. */
  36283. toThreeMesh(coordinates, amount, material, removeDuplicated) {
  36284. if (!coordinates) {
  36285. return null;
  36286. }
  36287. let coords = coordinates;
  36288. if (removeDuplicated) {
  36289. coords = this.removeDuplicatedCoordinates(coordinates)
  36290. }
  36291. let targetAmount = this.distanceToThreeVector3(amount, amount).x;
  36292. let shape = this.toThreeShape(coords);
  36293. let geometry = new ExtrudeGeometry(shape, {
  36294. 'amount': targetAmount,
  36295. 'bevelEnabled': true
  36296. });
  36297. let mesh = new Mesh(geometry, material);
  36298. let center = this.lngLatToPosition(this.getCoordinatesCenter(coords));
  36299. mesh.position.set(center.x, center.y, -targetAmount);
  36300. return mesh;
  36301. }
  36302. /**
  36303. * @function ThreeLayerRenderer.prototype.addObject
  36304. * @description 设置threejs 3D 对象的坐标(经纬度)。
  36305. * @param {THREE.Object3D} object3D - threejs 3D 对象及子类对象。
  36306. * @param {(Array.<number>|Object)} coordinate - 添加的 three 对象坐标(经纬度)。
  36307. * @returns {ThreeLayer} ThreeLayer的实例对象。
  36308. */
  36309. addObject(object3D, coordinate) {
  36310. if (coordinate && object3D) {
  36311. this.setPosition(object3D, coordinate);
  36312. }
  36313. this.scene.add(object3D);
  36314. }
  36315. /**
  36316. * @function ThreeLayerRenderer.prototype.clearMesh
  36317. * @description 清除所有 threejs mesh 对象。
  36318. * @returns {ThreeLayer} ThreeLayer的实例对象。
  36319. */
  36320. clearMesh() {
  36321. let scene = this.scene;
  36322. if (!scene) {
  36323. return this;
  36324. }
  36325. for (let i = scene.children.length - 1; i >= 0; i--) {
  36326. if (scene.children[i] instanceof external_function_try_return_THREE_catch_e_return_namespaceObject.Mesh) {
  36327. scene.remove(scene.children[i]);
  36328. }
  36329. }
  36330. return this;
  36331. }
  36332. /**
  36333. * @function ThreeLayerRenderer.prototype.clearAll
  36334. * @description 清除所有 threejs 对象。
  36335. * @param {boolean} clearCamera - 是否清除相机。
  36336. * @returns {ThreeLayer} ThreeLayer的实例对象。
  36337. */
  36338. clearAll(clearCamera) {
  36339. let scene = this.scene;
  36340. if (!scene) {
  36341. return this;
  36342. }
  36343. for (let i = scene.children.length - 1; i >= 0; i--) {
  36344. if (!clearCamera && scene.children[i] instanceof external_function_try_return_THREE_catch_e_return_namespaceObject.Camera) {
  36345. continue;
  36346. }
  36347. scene.remove(scene.children[i]);
  36348. }
  36349. return this;
  36350. }
  36351. /**
  36352. * @function ThreeLayerRenderer.prototype.setPosition
  36353. * @description 设置 threejs 3D 对象的坐标(经纬度)。
  36354. * @param {THREE.Object3D} object3D - threejs 3D 对象及子类对象。
  36355. * @param {(Array.<number>|Object)} coordinate - 添加的 three 对象坐标(经纬度)。
  36356. * @returns {ThreeLayer} ThreeLayer的实例对象。
  36357. */
  36358. setPosition(object3D, coordinate) {
  36359. if (!object3D || !coordinate) {
  36360. return this;
  36361. }
  36362. var pos = this.lngLatToPosition(coordinate);
  36363. object3D.position.set(pos.x, pos.y, pos.z);
  36364. return this;
  36365. }
  36366. /**
  36367. * @function ThreeLayerRenderer.prototype.lngLatToPosition
  36368. * @description 经纬度转threejs 3D 矢量对象。
  36369. * @param {(Array.<number>|Object)} lngLat - 经纬度坐标。
  36370. * @returns {THREE.Vector3} threejs 3D 矢量对象。
  36371. */
  36372. lngLatToPosition(lngLat) {
  36373. let zoom = Transform.projection.nativeMaxZoom;
  36374. let point = Transform.lngLatToPoint(lngLat, zoom);
  36375. return new Vector3(point.x, point.y, -0);
  36376. }
  36377. /**
  36378. * @function ThreeLayerRenderer.prototype.distanceToThreeVector3
  36379. * @description 计算距离指定坐标给定距离的新坐标的 threejs 3D 矢量对象。
  36380. * @param {number} x - x 轴距离,单位米。
  36381. * @param {number} y - y 轴距离,单位米。
  36382. * @param {(Array.<number>|Object)} lngLat - 源坐标。
  36383. * @returns {THREE.Vector3} 目标点的 threejs 3D 矢量对象。
  36384. */
  36385. distanceToThreeVector3(x, y, lngLat) {
  36386. let map = this.map;
  36387. let center = lngLat || map.getCenter(),
  36388. maxZoom = Transform.projection.nativeMaxZoom,
  36389. targetLngLat = Transform.locate(center, x, y);
  36390. let point1 = Transform.lngLatToPoint(center, maxZoom),
  36391. point2 = Transform.lngLatToPoint(targetLngLat, maxZoom);
  36392. let targetX = Math.abs(point2.x - point1.x) * Math.sign(x);
  36393. let targetY = Math.abs(point2.y - point1.y) * Math.sign(y);
  36394. return new Vector3(targetX, targetY, 0);
  36395. }
  36396. /**
  36397. * @function ThreeLayerRenderer.prototype.removeDuplicatedCoordinates
  36398. * @description 移除数组中的重复坐标。
  36399. * @param {(Array.<Array.<number>>)} coordinates - 坐标数组。
  36400. * @returns {(Array.<Array.<number>>)} 新的坐标数组。
  36401. */
  36402. removeDuplicatedCoordinates(coordinates) {
  36403. function equals(point1, point2) {
  36404. return point1[0] === point2[0] && point1[1] === point2[1]
  36405. }
  36406. let coords = [].concat(coordinates);
  36407. let length = coords.length;
  36408. for (let i = length - 1; i >= 1; i--) {
  36409. if (equals(coords[i], coords[i - 1])) {
  36410. coords.splice(i, 1);
  36411. }
  36412. }
  36413. let isClose = equals(coords[0], coords[coords.length - 1]);
  36414. isClose && coords.splice(coords.length - 1, 1);
  36415. return coords;
  36416. }
  36417. /**
  36418. * @function ThreeLayerRenderer.prototype.getCoordinatesCenter
  36419. * @description 获取给定坐标数组的中心坐标。
  36420. * @param {(Array.<Array.<number>>)} coordinates - 坐标数组。
  36421. * @returns {Object} 包含经纬度的坐标对象。
  36422. */
  36423. // 提工具
  36424. getCoordinatesCenter(coordinates) {
  36425. let sumX = 0, sumY = 0, count = 0;
  36426. let i = 0, len = coordinates.length;
  36427. for (; i < len; i++) {
  36428. if (coordinates[i]) {
  36429. sumX += coordinates[i][0];
  36430. sumY += coordinates[i][1];
  36431. count++;
  36432. }
  36433. }
  36434. return {
  36435. lng: sumX / count,
  36436. lat: sumY / count
  36437. };
  36438. }
  36439. _initContainer() {
  36440. var canvas = this._createCanvas();
  36441. var container = this.container = document.createElement("div");
  36442. container.id = this._layer.id;
  36443. container.className = "threejs-wrapper";
  36444. container.style.position = "absolute";
  36445. container.style.left = "0px";
  36446. container.style.top = "0px";
  36447. container.style.overflow = "hidden";
  36448. this._resetElementSize(container);
  36449. container.appendChild(canvas);
  36450. var targetElement = this.map.getCanvasContainer();
  36451. targetElement.appendChild(container)
  36452. }
  36453. _createCanvas() {
  36454. if (this.canvas) {
  36455. return;
  36456. }
  36457. const canvas = this.canvas = document.createElement('canvas');
  36458. canvas.className = "threejs-overlay";
  36459. canvas.style.outline = "none";
  36460. this._resetElementSize(canvas);
  36461. return canvas;
  36462. }
  36463. _resetElementSize(element) {
  36464. if (!element) {
  36465. return;
  36466. }
  36467. const size = this.getMapSize();
  36468. const dpr = window.devicePixelRatio ? window.devicePixelRatio : 1;
  36469. const width = dpr * size.width;
  36470. const height = dpr * size.height;
  36471. element.width = width;
  36472. element.height = height;
  36473. element.style.width = size.width + 'px';
  36474. element.style.height = size.height + 'px';
  36475. }
  36476. _initThreeRenderer() {
  36477. let map = this.map;
  36478. let size = this.getMapSize();
  36479. let renderer = this.renderer || 'gl';
  36480. let context;
  36481. if (renderer === 'gl') {
  36482. context = new WebGLRenderer({
  36483. 'canvas': this.canvas,
  36484. 'alpha': true,
  36485. 'antialias': true,
  36486. 'preserveDrawingBuffer': true
  36487. }, this.options);
  36488. context.autoClear = true;
  36489. context.clear();
  36490. }
  36491. context.setClearColor(new ThreeLayerRenderer_Color(1, 1, 1), 0);
  36492. context.canvas = this.canvas;
  36493. this.context = context;
  36494. let fov = map.transform.fov;
  36495. let fovRatio = Math.tan(fov / 2 * RADIAN);
  36496. let maxScale = this.getScale(projection.minZoom) / this.getScale(projection.nativeMaxZoom);
  36497. let far = maxScale * size.height / 2 / fovRatio;
  36498. this.camera = new PerspectiveCamera(fov, size.width / size.height, 1, far);
  36499. this.scene = new Scene();
  36500. this.scene.add(this.camera);
  36501. }
  36502. }
  36503. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/ThreeLayer.js
  36504. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36505. * This program are made available under the terms of the Apache License, Version 2.0
  36506. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36507. /**
  36508. * reference and modification
  36509. * maptalks.three
  36510. * (https://github.com/maptalks/maptalks.three)
  36511. * Apache Licene 2.0
  36512. * thanks maptalks
  36513. */
  36514. /**
  36515. * @class ThreeLayer
  36516. * @category Visualization Three
  36517. * @classdesc Three 图层类。
  36518. * @modulecategory Overlay
  36519. * @param {string} id - 图层 ID。
  36520. * @param {string} [renderer="gl"] - 图层渲染器,仅支持"gl"。'canvas'在v11.1.0后被弃用。
  36521. * @param {Object} options - 初始化参数。
  36522. * @param {Object} options.threeOptions - threejs 渲染器初始化参数对象。参数内容详见:
  36523. * {@link THREE.WebGLRenderer}
  36524. *
  36525. * @extends {mapboxgl.Evented}
  36526. * @fires ThreeLayer#render
  36527. * @fires ThreeLayer#renderscene
  36528. * @example
  36529. * var threeLayer = new ThreeLayer('three');
  36530. * //模型绘制
  36531. * threeLayer.on("initialized", draw);
  36532. * threeLayer.addTo(map);
  36533. *
  36534. * function draw() {
  36535. * var scene=threeLayer.getScene();
  36536. * camera=threeLayer.getCamera();
  36537. * var light = new THREE.PointLight(0xffffff);
  36538. * camera.add(light);
  36539. * var material = new THREE.MeshPhongMaterial({color: 0xff0000});
  36540. * //根据坐标点转换成模型
  36541. * var mesh = this.toThreeMesh(feature.geometry.coordinates, 10, material, true);
  36542. * //模型添加到3D场景
  36543. * scene.add(mesh);
  36544. * }
  36545. *
  36546. * 叠加模型可以通过两种方式:</br>
  36547. * 1.调用 threeLayer.toThreeMesh 直接将地理坐标转换成 threejs 3D 模型(适用于挤压模型,如城市建筑),然后添加到 3D 场景
  36548. * 2.使用 ThreeJS 的接口创建好 Mesh,然后调用 threeLayer.setPosition 设置地理位置,然后添加到 3D 场景
  36549. *
  36550. * @usage
  36551. */
  36552. class ThreeLayer extends (external_mapboxgl_default()).Evented {
  36553. //options.threeOptions是初始化threejs renderer的参数对象
  36554. constructor(id, renderer, options) {
  36555. super();
  36556. this.id = id;
  36557. this.type = 'custom';
  36558. this.renderingMode = '3d';
  36559. this.overlay = true;
  36560. this.options = options;
  36561. let threeOptions = options && options.threeOptions;
  36562. this.renderer = new ThreeLayerRenderer(this, renderer, threeOptions);
  36563. }
  36564. /**
  36565. * @function ThreeLayer.prototype.onAdd
  36566. * @description 添加图层到地图。
  36567. * @param {Object} map - 地图对象。
  36568. */
  36569. onAdd(map) {
  36570. var me = this;
  36571. me._map = map;
  36572. me.renderer.setMap(map);
  36573. me.renderer.render();
  36574. me.on('render', (function () {
  36575. this.context && this.context.render(this.scene, this.camera);
  36576. }).bind(me.renderer));
  36577. return this;
  36578. }
  36579. /**
  36580. * @function ThreeLayer.prototype.addTo
  36581. * @deprecated
  36582. * @description 添加图层到地图。
  36583. * @param {Object} map - 地图对象。
  36584. * @returns {ThreeLayer} ThreeLayer的实例对象。
  36585. */
  36586. addTo(map) {
  36587. map.addLayer(this);
  36588. return this;
  36589. }
  36590. /**
  36591. * @function ThreeLayer.prototype.toThreeShape
  36592. * @description 创建 threejs shape 对象。
  36593. * @param {Array} coordinates - 坐标点数组。
  36594. * @returns {THREE.Shape} threejs shape 对象。
  36595. */
  36596. toThreeShape(coordinates) {
  36597. return this.renderer.toThreeShape(coordinates);
  36598. }
  36599. /**
  36600. * @function ThreeLayer.prototype.toThreeMesh
  36601. * @description 创建 threejs Mesh 对象。将地理坐标转换成 threejs 3D 模型(适用于挤压模型,如城市建筑)。
  36602. * @param {Array.<Object>} coordinates - 坐标点数组。
  36603. * @param {number} amount - 高度。
  36604. * @param {THREE.Material} material - Threejs 材质对象。
  36605. * @param {boolean} [removeDuplicated] - 是否移除重复的坐标点。
  36606. * @returns {THREE.Mesh} threejs Mesh 对象。
  36607. */
  36608. toThreeMesh(coordinates, amount, material, removeDuplicated) {
  36609. return this.renderer.toThreeMesh(coordinates, amount, material, removeDuplicated);
  36610. }
  36611. /**
  36612. * @function ThreeLayer.prototype.addObject
  36613. * @description 设置threejs 3D 对象的坐标(经纬度)。
  36614. * @param {THREE.Object3D} object3D - threejs 3D 对象及子类对象。
  36615. * @param {(Array.<number>|Object)} coordinate - 添加的 three 对象坐标(经纬度)。
  36616. * @returns {ThreeLayer} ThreeLayer的实例对象。
  36617. */
  36618. addObject(object3D, coordinate) {
  36619. this.renderer && this.renderer.addObject(object3D, coordinate);
  36620. }
  36621. /**
  36622. * @function ThreeLayer.prototype.getScene
  36623. * @description 获取 threejs 场景对象。
  36624. * @returns {THREE.Scene} threejs 场景对象。
  36625. */
  36626. getScene() {
  36627. return this.renderer.scene;
  36628. }
  36629. /**
  36630. * @function ThreeLayer.prototype.getCamera
  36631. * @description 获取 threejs 相机。
  36632. * @returns {THREE.Camera} threejs 相机。
  36633. */
  36634. getCamera() {
  36635. return this.renderer.camera;
  36636. }
  36637. /**
  36638. * @function ThreeLayer.prototype.getThreeRenderer
  36639. * @description 获取 threejs renderer。
  36640. * @returns {THREE.WebGLRenderer} threejs renderer。
  36641. */
  36642. getThreeRenderer() {
  36643. return this.renderer.context;
  36644. }
  36645. /**
  36646. * @function ThreeLayer.prototype.clearMesh
  36647. * @description 清除所有 threejs mesh 对象。
  36648. * @returns {ThreeLayer} ThreeLayer的实例对象。
  36649. */
  36650. clearMesh() {
  36651. this.renderer.clearMesh();
  36652. return this;
  36653. }
  36654. /**
  36655. * @function ThreeLayer.prototype.clearAll
  36656. * @description 清除所有 threejs 对象。
  36657. * @param {boolean} clearCamera - 是否清除相机。
  36658. * @returns {ThreeLayer} ThreeLayer的实例对象。
  36659. */
  36660. clearAll(clearCamera) {
  36661. this.renderer.clearAll(clearCamera);
  36662. return this;
  36663. }
  36664. /**
  36665. * @function ThreeLayer.prototype.setPosition
  36666. * @description 设置 threejs 3D 对象的坐标(经纬度)。
  36667. * @param {THREE.Object3D} object3D - threejs 3D 对象及子类对象。
  36668. * @param {(Array.<number>|Object)} coordinate - 添加的 three 对象坐标(经纬度)。
  36669. * @returns {ThreeLayer} ThreeLayer的实例对象。
  36670. */
  36671. setPosition(object3D, coordinate) {
  36672. return this.renderer.setPosition(object3D, coordinate);
  36673. }
  36674. /**
  36675. * @function ThreeLayer.prototype.lngLatToPosition
  36676. * @description 经纬度转threejs 3D 矢量对象。
  36677. * @param {(Array.<number>|Object)} lngLat - 经纬度坐标。
  36678. * @returns {THREE.Vector3} threejs 3D 矢量对象。
  36679. */
  36680. lngLatToPosition(lngLat) {
  36681. return this.renderer.lngLatToPosition(lngLat);
  36682. }
  36683. /**
  36684. * @function ThreeLayer.prototype.distanceToThreeVector3
  36685. * @description 计算距离指定坐标给定距离的新坐标的 threejs 3D 矢量对象。
  36686. * @param {number} x - x 轴距离,单位米。
  36687. * @param {number} y - y 轴距离,单位米。
  36688. * @param {(Array.<number>|Object)} lngLat - 源坐标。
  36689. * @returns {THREE.Vector3} 目标点的 threejs 3D 矢量对象。
  36690. */
  36691. distanceToThreeVector3(x, y, lngLat) {
  36692. let map = this._map;
  36693. let center = lngLat || map.getCenter();
  36694. return this.renderer.distanceToThreeVector3(x, y, center);
  36695. }
  36696. /**
  36697. * @function ThreeLayer.prototype.removeDuplicatedCoordinates
  36698. * @description 移除数组中的重复坐标。
  36699. * @param {(Array.<Array.<number>>)} coordinates - 坐标数组。
  36700. * @returns {(Array.<Array.<number>>)} 新的坐标数组。
  36701. */
  36702. removeDuplicatedCoordinates(coordinates) {
  36703. this.renderer.removeDuplicatedCoordinates(coordinates);
  36704. }
  36705. /**
  36706. * @function ThreeLayer.prototype.getCoordinatesCenter
  36707. * @description 获取给定坐标数组的中心坐标。
  36708. * @param {(Array.<Array.<number>>)} coordinates - 坐标数组。
  36709. * @returns {Object} 包含经纬度的坐标对象。
  36710. */
  36711. getCoordinatesCenter(coordinates) {
  36712. return this.renderer.getCoordinatesCenter(coordinates);
  36713. }
  36714. /**
  36715. * @function ThreeLayer.prototype.render
  36716. */
  36717. render() {
  36718. this._update();
  36719. }
  36720. /**
  36721. * @function ThreeLayer.prototype.getCanvasContainer
  36722. * @description 获取 three 图层容器。
  36723. * @returns {HTMLElement} three 图层的容器。
  36724. */
  36725. getCanvasContainer() {
  36726. return this.renderer.getCanvasContainer();
  36727. }
  36728. /**
  36729. * @function ThreeLayer.prototype.getCanvas
  36730. * @description 获取 three 图层画布。
  36731. * @returns {HTMLCanvasElement} three 图层画布。
  36732. */
  36733. getCanvas() {
  36734. return this.renderer.getCanvas();
  36735. }
  36736. /**
  36737. * @function ThreeLayer.prototype.remove
  36738. * @description 移除图层。
  36739. */
  36740. remove() {
  36741. this.renderer.remove();
  36742. this._map = null;
  36743. }
  36744. /**
  36745. * @function ThreeLayer.prototype.draw
  36746. * @description 提供给外部的 threejs 模型绘制接口。
  36747. * @returns {ThreeLayer} ThreeLayer的实例对象。
  36748. * @example
  36749. * var threeLayer = new ThreeLayer('three');
  36750. * //可以通过重写 draw 实现模型绘制
  36751. * threeLayer.draw = function (gl, scene, camera) {
  36752. * //TODO 绘制操作
  36753. * }
  36754. * threeLayer.addTo(map);
  36755. */
  36756. draw() {
  36757. return this;
  36758. }
  36759. /**
  36760. * @function ThreeLayer.prototype.renderScene
  36761. * @description 渲染场景。
  36762. * @returns {ThreeLayer} ThreeLayer的实例对象。
  36763. */
  36764. renderScene() {
  36765. this.renderer.renderScene();
  36766. /**
  36767. * @event ThreeLayer#renderscene
  36768. * @description renderScene 事件,场景渲染后触发。
  36769. */
  36770. this.fire("renderscene");
  36771. return this;
  36772. }
  36773. _update() {
  36774. /**
  36775. * @event ThreeLayer#render
  36776. * @description render 事件,地图渲染时(地图状态改变时)触发。
  36777. */
  36778. this.renderScene();
  36779. this.fire('render');
  36780. return this;
  36781. }
  36782. }
  36783. ;// CONCATENATED MODULE: ./src/common/overlay/heatmap/HeatMapLayerRenderer.js
  36784. /**
  36785. * @private
  36786. * @class HeatMapLayerRenderer
  36787. * @classdesc 热力图层渲染器类。
  36788. * @category Visualization HeatMap
  36789. * @param {string} name - 图层名称。
  36790. * @param {Object} options - 构造参数。
  36791. * @param {string} options.featureWeight - 对应 feature 属性中的热点权重字段名称,权重值类型为 float。
  36792. * @param {string} [options.id] - 专题图层ID。默认使用 CommonUtil.createUniqueID("HeatMapLayer_") 创建专题图层 ID。
  36793. * @param {number} [options.radius=50] - 热点渲染的最大半径(热点像素半径),单位为 px,当 useGeoUnit参数 为 true 时,单位使用当前图层地理坐标单位。热点显示的时候以精确点为中心点开始往四周辐射衰减,其衰减半径和权重值成比列。
  36794. * @param {boolean} [options.loadWhileAnimating=true] - 是否实时重绘。(当绘制大数据量要素的情况下会出现卡顿,建议把该参数设为false)。
  36795. * @param {number} [options.opacity=1] - 图层不透明度。
  36796. * @param {Array.<string>} [options.colors=['blue','cyan','lime','yellow','red']] - 颜色线性渐变数组,颜色值必须为canvas所支。
  36797. * @param {boolean} [options.useGeoUnit=false] - 使用地理单位,即默认热点半径默认使用像素单位。当设置为 true 时,热点半径和图层地理坐标保持一致。
  36798. * @usage
  36799. */
  36800. class HeatMapLayerRenderer {
  36801. constructor(options) {
  36802. this.options = options;
  36803. /**
  36804. * @member {Object} HeatMapLayerRenderer.prototype.rootCanvas
  36805. * @description 热点图主绘制面板。
  36806. */
  36807. this.rootCanvas = null;
  36808. /**
  36809. * @member {Array.<FeatureVector>} HeatMapLayerRenderer.prototype.features
  36810. * @description 热点信息数组,记录存储图层上添加的所有热点信息。
  36811. */
  36812. this.features = [];
  36813. /**
  36814. * @member {boolean} [HeatMapLayerRenderer.prototype.visibility=true]
  36815. * @description 图层显示状态属性。
  36816. */
  36817. this.visibility = true;
  36818. /**
  36819. * @member {number} [HeatMapLayerRenderer.prototype.opacity=1]
  36820. * @description 图层不透明度,取值范围[0,1]。
  36821. */
  36822. this.opacity = options.opacity ? options.opacity : 1;
  36823. /**
  36824. * @member {Array.<string>} [HeatMapLayerRenderer.prototype.colors=['blue','cyan','lime','yellow','red']]
  36825. * @description 颜色线性渐变数组。
  36826. */
  36827. this.colors = options.colors ? options.colors : ['blue', 'cyan', 'lime', 'yellow', 'red'];
  36828. /**
  36829. * @member {boolean} [HeatMapLayerRenderer.prototype.useGeoUnit=false]
  36830. * @description 使用地理单位,即默认热点半径默认使用像素单位。当设置为 true 时,热点半径和图层地理坐标保持一致。
  36831. */
  36832. this.useGeoUnit = options.useGeoUnit ? options.useGeoUnit : false;
  36833. /**
  36834. * @member {number} [HeatMapLayerRenderer.prototype.radius=50]
  36835. * @description 热点渲染的最大半径(热点像素半径),
  36836. * 热点显示的时候以精确点为中心点开始往四周辐射衰减,
  36837. * 其衰减半径和权重值成比列。
  36838. */
  36839. this.radius = options.radius ? options.radius : 50;
  36840. /**
  36841. * @member {string} HeatMapLayerRenderer.prototype.featureWeight
  36842. * @description 对应 feature 属性中的热点权重字段名称,权重值类型为 number。
  36843. * @example
  36844. * //feature.attributes中表示权重的字段为 height,则在 HeatMapLayer 的 featureWeight 参数赋值为 "height"。
  36845. * feature1.attributes.height = 7.0;
  36846. * feature2.attributes.height = 6.0;
  36847. * var heatMapLayer = new HeatMapLayer("heatmaplayer",{"featureWeight":"height"});
  36848. * heatMapLayer.addFeatures([feature1,feature2]);
  36849. */
  36850. this.featureWeight = options.featureWeight ? options.featureWeight : null;
  36851. /**
  36852. * @member {number} HeatMapLayerRenderer.prototype.maxWeight
  36853. * @description 设置权重最大值。默认将按照当前屏幕范围内热点所拥有的权重最大值绘制热点图。
  36854. */
  36855. this.maxWeight = null;
  36856. /**
  36857. * @member {number} HeatMapLayerRenderer.prototype.minWeight
  36858. * @description 设置权重最小值。默认将按照当前屏幕范围内热点所拥有的权重最小值绘制热点图。
  36859. */
  36860. this.minWeight = null;
  36861. /**
  36862. * @member {Object} HeatMapLayerRenderer.prototype.canvasContext
  36863. * @description 热点图主绘制对象。
  36864. */
  36865. this.canvasContext = null;
  36866. /**
  36867. * @member {number} HeatMapLayerRenderer.prototype.maxWidth
  36868. * @description 当前绘制面板宽度。默认和当前 map 窗口宽度一致。
  36869. */
  36870. this.maxWidth = null;
  36871. /**
  36872. * @member {number} HeatMapLayerRenderer.prototype.maxHeight
  36873. * @description 当前绘制面板宽度。默认和当前 map 窗口高度一致。
  36874. */
  36875. this.maxHeight = null;
  36876. this.extent = {};
  36877. this.mapElement = options.mapElement;
  36878. this._createCanvasContainer(options.targetElement, options.size);
  36879. }
  36880. /**
  36881. * @function HeatMapLayerRenderer.prototype.addFeatures
  36882. * @description 添加热点信息。
  36883. * @param {GeoJSONObject} features - 待添加的要素数组。
  36884. * @example
  36885. * var geojson = {
  36886. * "type": "FeatureCollection",
  36887. * "features": [
  36888. * {
  36889. * "type": "feature",
  36890. * "geometry": {
  36891. * "type": "Point", //只支持point类型
  36892. * "coordinates": [0, 0]
  36893. * },
  36894. * "properties": {
  36895. * "height": Math.random()*9,
  36896. * "geoRadius": useGeoRadius?radius:null
  36897. * }
  36898. * }
  36899. * ]
  36900. * };
  36901. * var HeatMapLayerRenderer = new HeatMapLayerRenderer("HeatMapLayerRenderer",{"featureWeight":"height"}); pLayer = new HeatMapLayerRenderer("HeatMapLayerRenderer",{"featureWeight":"height"});
  36902. * HeatMapLayerRenderer.addFeatures(geojson);
  36903. * map.addLayer(HeatMapLayerRenderer);
  36904. */
  36905. addFeatures(features) {
  36906. this.features = this.toiClientFeature(features);
  36907. //支持更新features,刷新底图
  36908. this.refresh();
  36909. }
  36910. /**
  36911. * @function HeatMapLayerRenderer.prototype.refresh
  36912. * @description 强制刷新当前热点显示,在图层热点数组发生变化后调用,更新显示。
  36913. */
  36914. refresh() {
  36915. if (this.features.length === 0) {
  36916. return;
  36917. }
  36918. this.updateHeatPoints(this.extent);
  36919. }
  36920. /**
  36921. * @function HeatMapLayerRenderer.prototype.setOpacity
  36922. * @description 设置图层的不透明度,取值[0-1]之间。
  36923. * @param {number} [opacity] - 不透明度。
  36924. */
  36925. setOpacity(opacity) {
  36926. if (opacity !== this.opacity) {
  36927. this.opacity = opacity;
  36928. Util_Util.modifyDOMElement(this.rootCanvas, null, null, null,
  36929. null, null, null, opacity);
  36930. }
  36931. }
  36932. /**
  36933. * @function HeatMapLayerRenderer.prototype.updateHeatPoints
  36934. * @description 刷新热点图显示。
  36935. * @param {mapboxgl.LngLatBounds} bounds - 当前显示范围。
  36936. */
  36937. updateHeatPoints(bounds) {
  36938. if (this.features && this.features.length > 0) {
  36939. this.convertFastToPixelPoints(bounds);
  36940. } else {
  36941. this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxWidth);
  36942. }
  36943. }
  36944. /**
  36945. * @function HeatMapLayerRenderer.prototype.convertFastToPixelPoints
  36946. * @description 过滤位于当前显示范围内的热点,并转换其为当前分辨率下的像素坐标。
  36947. * @param {mapboxgl.LngLatBounds} bounds - 当前显示范围。
  36948. * @private
  36949. */
  36950. convertFastToPixelPoints(bounds) {
  36951. var data = [], x, y, k, resolution, maxTemp, minTemp, maxWeightTemp;
  36952. //获取当前像素下的地理范围
  36953. var dw = bounds.getEast() - bounds.getWest();
  36954. var dh = bounds.getNorth() - bounds.getSouth();
  36955. var mapElement = this.mapElement;
  36956. if (dw / mapElement.width > dh / mapElement.height) {
  36957. resolution = dw / mapElement.width;
  36958. } else {
  36959. resolution = dh / mapElement.height;
  36960. }
  36961. //热点半径
  36962. this.useRadius = this.useGeoUnit ? parseInt(this.radius / resolution) : this.radius;
  36963. for (var i = 0; i < this.features.length; i++) {
  36964. var feature = this.features[i];
  36965. var point = feature.geometry;
  36966. //可通过bounds过滤需绘制的features以优化性能,但mapboxgl旋转获取得bounds不适
  36967. var pixelPoint = this.getPixelXY(new LonLat(point.x, point.y));
  36968. if (this.featureWeight) {
  36969. pixelPoint.weight = feature.attributes[this.featureWeight];//point.value;
  36970. if (!this.maxWeight) {
  36971. //找出最大最小权重值
  36972. maxTemp = maxTemp ? maxTemp : pixelPoint.weight;
  36973. minTemp = minTemp ? minTemp : pixelPoint.weight;
  36974. maxTemp = Math.max(maxTemp, pixelPoint.weight);
  36975. minTemp = Math.min(minTemp, pixelPoint.weight);
  36976. }
  36977. } else {
  36978. pixelPoint.weight = 1;
  36979. }
  36980. x = Math.floor(pixelPoint.x);
  36981. y = Math.floor(pixelPoint.y);
  36982. k = pixelPoint.weight;
  36983. data.push([x, y, k]);
  36984. }
  36985. //无最大权重设置
  36986. if (!this.maxWeight) {
  36987. if (maxTemp && minTemp) {
  36988. maxWeightTemp = (maxTemp + minTemp) / 2;
  36989. } else {
  36990. maxWeightTemp = 1;
  36991. }
  36992. this.draw(data, maxWeightTemp);
  36993. } else {
  36994. this.draw(data, this.maxWeight);
  36995. }
  36996. }
  36997. /**
  36998. * @function HeatMapLayerRenderer.prototype.draw
  36999. * @description 绘制热点图。
  37000. * @param {Array} data - convertToPixelPoints方法计算出的点。
  37001. * @private
  37002. */
  37003. draw(data, maxWeight) {
  37004. if (this.maxHeight > 0 && this.maxWidth > 0) {
  37005. //清空
  37006. var ctx = this.canvasContext;
  37007. ctx.setTransform(1, 0, 0, 1, 0, 0);
  37008. this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxHeight);
  37009. this.drawCircle(this.useRadius);
  37010. this.createGradient();
  37011. for (var i = 0; i < data.length; i++) {
  37012. var p = data[i];
  37013. this.canvasContext.globalAlpha = Math.max(p[2] / maxWeight, 0.05);
  37014. this.canvasContext.drawImage(this.circle, p[0] - this.useRadius, p[1] - this.useRadius);
  37015. }
  37016. var colored = ctx.getImageData(0, 0, this.maxWidth, this.maxHeight);
  37017. this.colorize(colored.data, this.grad);
  37018. ctx.putImageData(colored, 0, 0);
  37019. } else {
  37020. return false;
  37021. }
  37022. }
  37023. /**
  37024. * @function HeatMapLayerRenderer.prototype.colorize
  37025. * @description 根据渐变色重置热点图rgb值。
  37026. * @param {Array} pixels - 像素 RGBA 值。
  37027. * @param {Array} gradient - 渐变 canvas.getImageData.data。
  37028. * @private
  37029. */
  37030. colorize(pixels, gradient) {
  37031. for (var i = 0, j; i < pixels.length; i += 4) {
  37032. j = pixels[i + 3] * 4;
  37033. if (j) {
  37034. pixels[i] = gradient[j];
  37035. pixels[i + 1] = gradient[j + 1];
  37036. pixels[i + 2] = gradient[j + 2];
  37037. }
  37038. }
  37039. }
  37040. /**
  37041. * @function HeatMapLayerRenderer.drawCircle
  37042. * @description 绘制热点半径圆。
  37043. * @param {number} r - 热点半径。
  37044. * @private
  37045. */
  37046. drawCircle(r) {
  37047. var blur = r / 2;
  37048. var circle = this.circle = document.createElement('canvas'),
  37049. ctx = circle.getContext("2d");
  37050. circle.height = 2 * r;
  37051. circle.width = 2 * r;
  37052. ctx.shadowOffsetX = ctx.shadowOffsetY = 2 * r;
  37053. ctx.shadowBlur = blur;
  37054. ctx.shadowColor = "#000000";
  37055. ctx.beginPath();
  37056. ctx.arc(-r, -r, r / 2, 0, Math.PI * 2, true);
  37057. ctx.closePath();
  37058. ctx.fill();
  37059. }
  37060. /**
  37061. * @function HeatMapLayerRenderer.createGradient
  37062. * @description 根据 options.colors 设置渐变。
  37063. * @private
  37064. */
  37065. createGradient() {
  37066. var colors = this.colors;
  37067. var canvas = document.createElement('canvas'),
  37068. ctx = canvas.getContext("2d"),
  37069. gradient = ctx.createLinearGradient(0, 0, 0, 256);
  37070. canvas.height = 256;
  37071. canvas.width = 1;
  37072. var index = 1;
  37073. for (var i = 0, len = colors.length; i < len; i++) {
  37074. gradient.addColorStop(index / len, colors[i]);
  37075. index++;
  37076. }
  37077. ctx.fillStyle = gradient;
  37078. ctx.fillRect(0, 0, 1, 256);
  37079. this.grad = ctx.getImageData(0, 0, 1, 256).data;
  37080. }
  37081. /**
  37082. * @function HeatMapLayerRenderer.prototype.getPixelXY
  37083. * @description 转换地理坐标为相对于当前窗口左上角的像素坐标。
  37084. * @param {number} x - 热点的像素 x 坐标。
  37085. * @param {number} y - 热点的像素 y 坐标。
  37086. */
  37087. getPixelXY(coordinate) {
  37088. let pixelP;
  37089. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  37090. let tempPoint = this.options.convertLatlonToPixel({ lon: coordinate.x, lat: coordinate.y });
  37091. pixelP = { x: parseInt(tempPoint.x), y: parseInt(tempPoint.y) };
  37092. }
  37093. if (coordinate instanceof LonLat) {
  37094. let tempPoint = this.options.convertLatlonToPixel(coordinate);
  37095. pixelP = { x: parseInt(tempPoint.x), y: parseInt(tempPoint.y) };
  37096. }
  37097. return pixelP;
  37098. }
  37099. /**
  37100. * @function HeatMapLayerRenderer.prototype._createCanvasContainer
  37101. * @description 创建热力图绘制容器。
  37102. * @private
  37103. */
  37104. _createCanvasContainer(targetElement) {
  37105. //热点图要求使用canvas绘制,判断是否支持
  37106. this.rootCanvas = document.createElement("canvas");
  37107. this.rootCanvas.id = this.options.id;
  37108. this.rootCanvas.width = this.maxWidth = parseInt(this.mapElement.style.width);
  37109. this.rootCanvas.height = this.maxHeight = parseInt(this.mapElement.style.height);
  37110. this.canvasContext = this.rootCanvas.getContext('2d');
  37111. const devicePixelRatio = window.devicePixelRatio || 1;
  37112. devicePixelRatio !== 1 && this.canvasContext && this.canvasContext.scale(devicePixelRatio, devicePixelRatio);
  37113. Util_Util.modifyDOMElement(this.rootCanvas, null, { x: 0, y: 0 }, { w: this.maxWidth, h: this.maxHeight },
  37114. "absolute", null, null, this.opacity);
  37115. targetElement.appendChild(this.rootCanvas);
  37116. }
  37117. /**
  37118. * @function HeatMapLayerRenderer.prototype.toiClientFeature
  37119. * @description 转为 iClient 要素。
  37120. * @param {GeoJSONObject} features - 待添加的要素数组。
  37121. */
  37122. // 提到 common
  37123. toiClientFeature(features) {
  37124. if (!Util_Util.isArray(features)) {
  37125. features = [features];
  37126. }
  37127. let featuresTemp = [];
  37128. for (let i = 0; i < features.length; i++) {
  37129. if (features[i] instanceof Vector) {
  37130. // 若是 FeatureVector 直接返回
  37131. featuresTemp.push(features[i]);
  37132. } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
  37133. //GeoJSON 规范数据类型
  37134. let format = new GeoJSON();
  37135. featuresTemp = featuresTemp.concat(format.read(features[i]));
  37136. } else if (features[i].geometry && features[i].geometry.parts) {
  37137. //iServer服务器返回数据格式
  37138. featuresTemp.push(ServerFeature.fromJson(features[i]).toFeature());
  37139. } else {
  37140. throw new Error(`Features[${i}]'s type does not match, please check.`);
  37141. }
  37142. }
  37143. return featuresTemp;
  37144. }
  37145. /**
  37146. * @function HeatMapLayerRenderer.prototype.removeFeatures
  37147. * @description 移除指定的热点信息。
  37148. * @param {Array.<FeatureVector>|FeatureVector} features - 热点信息数组。
  37149. */
  37150. removeFeatures(features) {
  37151. if (!features || features.length === 0 || !this.features || this.features.length === 0) {
  37152. return;
  37153. }
  37154. if (features === this.features) {
  37155. return this.removeAllFeatures();
  37156. }
  37157. if (!(Util_Util.isArray(features))) {
  37158. features = [features];
  37159. }
  37160. var heatPoint, index, heatPointsFailedRemoved = [];
  37161. for (var i = 0, len = features.length; i < len; i++) {
  37162. heatPoint = features[i];
  37163. index = Util_Util.indexOf(this.features, heatPoint);
  37164. //找不到视为删除失败
  37165. if (index === -1) {
  37166. heatPointsFailedRemoved.push(heatPoint);
  37167. continue;
  37168. }
  37169. //删除热点
  37170. this.features.splice(index, 1);
  37171. }
  37172. var succeed = heatPointsFailedRemoved.length == 0 ? true : false;
  37173. //派发删除features成功的事件
  37174. /**
  37175. * @event HeatMapLayerRenderer#featuresremoved
  37176. * @description 要素删除之后触发。
  37177. * @property {Array.<FeatureVector>} features - 需要被删除的要素。
  37178. * @property {boolean} succeed - 要素删除成功与否。
  37179. */
  37180. this.refresh();
  37181. return { succeed, heatPointsFailedRemoved }
  37182. }
  37183. /**
  37184. * @function HeatMapLayerRenderer.prototype.removeAllFeatures
  37185. * @description 移除全部的热点信息。
  37186. */
  37187. removeAllFeatures() {
  37188. this.features = [];
  37189. this.refresh();
  37190. }
  37191. /**
  37192. * @function HeatMapLayerRenderer.prototype.removeFromMap
  37193. * @description 删除该图层。
  37194. */
  37195. removeFromMap() {
  37196. this.removeAllFeatures();
  37197. this.options.targetElement.removeChild(this.rootCanvas);
  37198. }
  37199. /**
  37200. * @function HeatMapLayerRenderer.prototype.setVisibility
  37201. * @description 设置图层可见性。
  37202. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  37203. */
  37204. setVisibility(visibility) {
  37205. if (this.rootCanvas && visibility !== this.visibility) {
  37206. this.visibility = visibility;
  37207. this.rootCanvas.style.display = visibility ? "block" : "none";
  37208. }
  37209. }
  37210. setExtent(extent) {
  37211. this.extent = extent;
  37212. }
  37213. _hide() {
  37214. this.rootCanvas.style.display = 'none';
  37215. }
  37216. _show() {
  37217. this.rootCanvas.style.display = 'block';
  37218. }
  37219. }
  37220. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/HeatMapLayer.js
  37221. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37222. * This program are made available under the terms of the Apache License, Version 2.0
  37223. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37224. /**
  37225. * @class HeatMapLayer
  37226. * @classdesc 热力图层类。
  37227. * @category Visualization HeatMap
  37228. * @modulecategory Overlay
  37229. * @param {string} name - 图层名称。
  37230. * @param {Object} options - 构造参数。
  37231. * @param {mapboxgl.Map} options.map - MapBoxGL Map 对象。
  37232. * @param {string} options.featureWeight - 对应 feature 属性中的热点权重字段名称,权重值类型为 float。
  37233. * @param {string} [options.id] - 专题图层ID。默认使用 CommonUtil.createUniqueID("HeatMapLayer_") 创建专题图层 ID。
  37234. * @param {number} [options.radius=50] - 热点渲染的最大半径(热点像素半径),单位为 px,当 useGeoUnit参数 为 true 时,单位使用当前图层地理坐标单位。热点显示的时候以精确点为中心点开始往四周辐射衰减,其衰减半径和权重值成比列。
  37235. * @param {boolean} [options.loadWhileAnimating=true] - 是否实时重绘。(当绘制大数据量要素的情况下会出现卡顿,建议把该参数设为false)。
  37236. * @param {number} [options.opacity=1] - 图层不透明度。
  37237. * @param {Array.<string>} [options.colors=['blue','cyan','lime','yellow','red']] - 颜色线性渐变数组,颜色值必须为canvas所支。
  37238. * @param {boolean} [options.useGeoUnit=false] - 使用地理单位,即默认热点半径默认使用像素单位。当设置为 true 时,热点半径和图层地理坐标保持一致。
  37239. * @extends {mapboxgl.Evented}
  37240. * @fires HeatMapLayer#featuresadded
  37241. * @fires HeatMapLayer#changelayer
  37242. * @fires HeatMapLayer#featuresremoved
  37243. * @usage
  37244. */
  37245. class HeatMapLayer extends (external_mapboxgl_default()).Evented {
  37246. constructor(name, options) {
  37247. super();
  37248. var _options = options ? options : {};
  37249. this.options = _options;
  37250. /**
  37251. * @member {string} HeatMapLayer.prototype.name
  37252. * @description 图层名字。
  37253. */
  37254. this.name = name;
  37255. /**
  37256. * @member {string} HeatMapLayer.prototype.id
  37257. * @description 热力图图层 ID。
  37258. */
  37259. this.id = _options.id ? _options.id : Util_Util.createUniqueID("HeatMapLayer_");
  37260. /**
  37261. * @member {boolean} [HeatMapLayer.prototype.loadWhileAnimating=true]
  37262. * @description 是否实时重绘。(当绘制大数据量要素的情况下会出现卡顿,建议把该参数设为false)。
  37263. */
  37264. this.loadWhileAnimating = _options.loadWhileAnimating === undefined ? true : _options.loadWhileAnimating;
  37265. /**
  37266. * @member {GeoJSONObject} HeatMapLayer.prototype.features
  37267. * @description 热点信息数组,记录存储图层上添加的所有热点信息。
  37268. */
  37269. this.features = {};
  37270. /**
  37271. * @member HeatMapLayer.prototype.EVENT_TYPES
  37272. * @description 监听一个自定义事件可用如下方式:
  37273. * 热点图自定义事件信息,事件调用时的属性与具体事件类型相对应。
  37274. *
  37275. * 支持的事件如下 (另外包含 <Layer 中定义的其他事件>):
  37276. * featuresadded - 热点添加完成时触发。回调参数为添加的热点信息数组和操作成功与否信息。
  37277. * 参数类型:{features: features, succeed: succeed}
  37278. * featuresremoved - 热点被删除时触发。回调参数为删除的热点信息数组和操作成功与否信息。
  37279. * 参数类型:{features: features, succeed: succeed}
  37280. * featuresdrawcompleted - 热点图渲染完成时触发。
  37281. */
  37282. this.EVENT_TYPES = ["featuresadded", "featuresremoved", "featuresdrawcompleted"];
  37283. this.type = 'custom';
  37284. this.renderingMode = '3d';
  37285. this.overlay = true;
  37286. }
  37287. /**
  37288. * @function HeatMapLayer.prototype.onAdd
  37289. * @description 添加该图层
  37290. */
  37291. onAdd(map) {
  37292. this.map = map;
  37293. const targetElement = this.map.getCanvasContainer();
  37294. const mapElement = this.map.getCanvas();
  37295. this.renderer = new HeatMapLayerRenderer({ id: this.id, ...this.options, convertLatlonToPixel: this._convertLatlonToPixel.bind(this), targetElement, mapElement });
  37296. if (this.features.features && this.features.features.length) {
  37297. this.renderer.setExtent(this.map.getBounds());
  37298. this.renderer.addFeatures(this.features);
  37299. }
  37300. }
  37301. /**
  37302. * @function HeatMapLayer.prototype.removeFromMap
  37303. * @description 删除该图层。
  37304. */
  37305. onRemove() {
  37306. this.removeAllFeatures();
  37307. this.renderer.removeFromMap();
  37308. this.features = {};
  37309. this.renderer = null;
  37310. }
  37311. render() {
  37312. this.refresh();
  37313. }
  37314. /**
  37315. * @function HeatMapLayer.prototype.addFeatures
  37316. * @description 添加热点信息。
  37317. * @param {GeoJSONObject} features - 待添加的要素数组。
  37318. *
  37319. * @example
  37320. * var geojson = {
  37321. * "type": "FeatureCollection",
  37322. * "features": [
  37323. * {
  37324. * "type": "feature",
  37325. * "geometry": {
  37326. * "type": "Point", //只支持point类型
  37327. * "coordinates": [0, 0]
  37328. * },
  37329. * "properties": {
  37330. * "height": Math.random()*9,
  37331. * "geoRadius": useGeoRadius?radius:null
  37332. * }
  37333. * }
  37334. * ]
  37335. * };
  37336. * var heatMapLayer = new HeatMapLayer("heatmaplayer",{"featureWeight":"height"}); pLayer = new HeatMapLayer("heatmaplayer",{"featureWeight":"height"});
  37337. * heatMapLayer.addFeatures(geojson);
  37338. * map.addLayer(heatMapLayer);
  37339. */
  37340. addFeatures(features) {
  37341. if (this.renderer) {
  37342. this.renderer.addFeatures(features);
  37343. } else {
  37344. this.features = features;
  37345. }
  37346. /**
  37347. * @event HeatMapLayer#featuresadded
  37348. * @description 要素添加完成之后触发。
  37349. * @property {GeoJSONObject} features - 被添加的要素。
  37350. * @property {boolean} succeed - 要素是否成功添加。
  37351. */
  37352. this.fire(this.EVENT_TYPES[0], { features: features, succeed: true });
  37353. }
  37354. /**
  37355. * @function HeatMapLayer.prototype.refresh
  37356. * @description 强制刷新当前热点显示,在图层热点数组发生变化后调用,更新显示。
  37357. */
  37358. refresh() {
  37359. if (this.map) {
  37360. this.renderer.setExtent(this.map.getBounds());
  37361. this.renderer.refresh();
  37362. }
  37363. }
  37364. /**
  37365. * @function HeatMapLayer.prototype.setOpacity
  37366. * @description 设置图层的不透明度,取值[0-1]之间。
  37367. * @param {number} [opacity] - 不透明度。
  37368. */
  37369. setOpacity(opacity) {
  37370. if (opacity !== this.opacity) {
  37371. this.renderer.setOpacity(opacity);
  37372. if (this.map !== null) {
  37373. /**
  37374. * @event HeatMapLayer#changelayer
  37375. * @description 图层属性改变之后触发。
  37376. * @property {Object} layer - 图层。
  37377. * @property {string} property - 被改变的图层属性。
  37378. */
  37379. this.fire('changelayer', {layer: this, property: "opacity"});
  37380. }
  37381. }
  37382. }
  37383. /**
  37384. * @function HeatMapLayer.prototype.updateHeatPoints
  37385. * @description 刷新热点图显示。
  37386. * @param {mapboxgl.LngLatBounds} bounds - 当前显示范围。
  37387. */
  37388. updateHeatPoints(bounds) {
  37389. this.renderer.updateHeatPoints(bounds);
  37390. }
  37391. /**
  37392. * @function HeatMapLayer.prototype.getPixelXY
  37393. * @description 转换地理坐标为相对于当前窗口左上角的像素坐标。
  37394. * @param {number} x - 热点的像素 x 坐标。
  37395. * @param {number} y - 热点的像素 y 坐标。
  37396. */
  37397. getPixelXY(coordinate) {
  37398. return this.renderer.getPixelXY(coordinate);
  37399. }
  37400. /**
  37401. * @function HeatMapLayer.prototype.removeFeatures
  37402. * @description 移除指定的热点信息。
  37403. * @param {Array.<FeatureVector>|FeatureVector} features - 热点信息数组。
  37404. */
  37405. removeFeatures(features) {
  37406. const removeFeaturesRes = this.renderer.removeFeatures(features);
  37407. if(!removeFeaturesRes) {
  37408. return;
  37409. }
  37410. const { heatPointsFailedRemoved, succeed } = removeFeaturesRes;
  37411. //派发删除features成功的事件
  37412. /**
  37413. * @event HeatMapLayer#featuresremoved
  37414. * @description 要素删除之后触发。
  37415. * @property {Array.<FeatureVector>} features - 需要被删除的要素。
  37416. * @property {boolean} succeed - 要素删除成功与否。
  37417. */
  37418. this.fire(this.EVENT_TYPES[1], { features: heatPointsFailedRemoved, succeed });
  37419. }
  37420. /**
  37421. * @function HeatMapLayer.prototype.removeAllFeatures
  37422. * @description 移除全部的热点信息。
  37423. */
  37424. removeAllFeatures() {
  37425. this.renderer.removeAllFeatures();
  37426. }
  37427. /**
  37428. * @function HeatMapLayer.prototype.moveTo
  37429. * @description 将图层移动到某个图层之前。
  37430. * @param {string} layerID - 待插入的图层ID。
  37431. * @param {boolean} [before=true] - 是否将本图层插入到图层 ID 为 layerID 的图层之前(如果为 false 则将本图层插入到图层 ID 为 layerID 的图层之后)。
  37432. */
  37433. moveTo(layerID, before) {
  37434. var layer = document.getElementById(this.renderer.rootCanvas.id);
  37435. before = before !== undefined ? before : true;
  37436. if (before) {
  37437. var beforeLayer = document.getElementById(layerID);
  37438. if (layer && beforeLayer) {
  37439. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  37440. }
  37441. return;
  37442. }
  37443. var nextLayer = document.getElementById(layerID);
  37444. if (layer) {
  37445. if (nextLayer.nextSibling) {
  37446. nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
  37447. return;
  37448. }
  37449. nextLayer.parentNode.appendChild(layer);
  37450. }
  37451. }
  37452. /**
  37453. * @function HeatMapLayer.prototype.setVisibility
  37454. * @description 设置图层可见性。
  37455. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  37456. */
  37457. setVisibility(visibility) {
  37458. this.renderer.setVisibility(visibility);
  37459. }
  37460. _convertLatlonToPixel(coordinate) {
  37461. return this.map.project(new (external_mapboxgl_default()).LngLat(coordinate.lon, coordinate.lat));
  37462. }
  37463. }
  37464. ;// CONCATENATED MODULE: ./src/common/overlay/deckgl/DeckglLayerBase.js
  37465. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37466. * This program are made available under the terms of the Apache License, Version 2.0
  37467. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37468. /**
  37469. * @class DeckglLayerBase
  37470. * @category Visualization DeckGL
  37471. * @classdesc Deckgl 高效率图层,该图图层为综合图层,通过该图层可创建 高效率点图层、路径图层(线图层)、高效率面图层、曲线图层、
  37472. * 正六边形图层(蜂巢图层)、网格图层,只需给定相依配置,因此,在创建图层之前,请仔细阅读参数配置。
  37473. * @param {string} layerTypeID - 高效率图层类型 ID,包括 "scatter-plot" 高效率点图层、"path-layer" 路径图层(线图层)、
  37474. * "polygon-layer" 高效率面图层、"arc-layer" 曲线图层、"hexagon-layer" 正六边形图层(蜂巢图层)、"screen-grid-layer" 网格图层。
  37475. *
  37476. * @param {Object} options - 图层配置项,包括以下参数:
  37477. * @param {Object} [options.layerId] - DeckglLayerBase 图层 Dom 元素 ID。默认使用 CommonUtil.createUniqueID("graphicLayer_" + this.layerTypeID + "_") 创建专题图层 ID。
  37478. * @param {Array.<GeoJSONObject>} options.data - 图层数据,支持 GeoJSON 规范数据类型。
  37479. * @param {Object} options.callback - deckgl 图层回调函数配置项。
  37480. * @param {Object} options.props - deckgl 图层配置项, 在该参数下配置图层配置项:
  37481. * @param {boolean} options.props.coverage - "hexagon-layer" 配置项:六边形半径乘数,介于0 - 1之间。六边形的最终半径通过覆盖半径计算。注意:覆盖范围不会影响分数的分配方式。分配方式的半径仅由半径属性确定;
  37482. * @param {boolean} options.props.hexagonAggregator - "hexagon-layer" 配置项:* @param {boolean}
  37483. * @param {Object} options.props.lightSettings - 光照配置项。
  37484. * @param {Array} options.props.lightSettings.lightsPosition - 光照配置项:指定为`[x,y,z]`的光在平面阵列中的位置`, 在一个平面阵列。长度应该是 `3 x numberOfLights`。
  37485. * @param {Array} options.props.lightSettings.lightsStrength - 光照配置项:平面阵列中指定为“[x,y]`的灯的强度。长度应该是`2 x numberOfLights`。
  37486. * @param {number} [options.props.lightSettings.numberOfLights=1] - 光照配置项:光照值,最大值为 `5`。
  37487. * @param {number} [options.props.lightSettings.coordinateSystem=COORDINATE_SYSTEM.LNGLAT] - 光照配置项:指定灯位置的坐标系。
  37488. * @param {number} [options.props.lightSettings.coordinateOrigin=[0, 0, 0]] - 光照配置项:指定灯位置的坐标原点。
  37489. * @param {number} [options.props.lightSettings.modelMatrix] - 光照配置项:光位置的变换矩阵。
  37490. * @param {number} [options.props.lightSettings.ambientRatio=0.4] - 光照配置项:光照的环境比例。
  37491. * @param {number} [options.props.lightSettings.diffuseRatio=0.6] - 光照配置项:光的漫反射率。
  37492. * @param {number} [options.props.lightSettings.specularRatio=0.8] - 光照配置项:光的镜面反射率。
  37493. * @param {number} [options.props.opacity=1] - 公共配置项:图层不透明度度。
  37494. * @param {boolean} [options.props.pickable=false] - 公共配置项:是否响应鼠标事件(鼠标点击,鼠标滑动)。
  37495. * @param {function} [options.props.autoHighlight=false] - 公共配置项:鼠标滑动高亮要素。
  37496. * @param {function} [options.props.highlightColor=[0, 0, 128, 128]] - 公共配置项:鼠标滑动高亮颜色。
  37497. * @param {function} [options.props.onClick] - 公共配置项:鼠标点击事件。
  37498. * @param {function} [options.props.onHover] - 公共配置项:鼠标滑动事件。
  37499. * @param {number} [options.props.radiusScale=1] - "scatter-plot" 配置项:散点半径比例。
  37500. * @param {boolean} [options.props.outline=false] - "scatter-plot" 配置项:是否边线显示。
  37501. * @param {number} [options.props.strokeWidth=1] - "scatter-plot" 配置项:边线宽度。
  37502. * @param {number} [options.props.radiusMinPixels=0] - "scatter-plot" 配置项:半径最小像素值。
  37503. * @param {number} [options.props.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - "scatter-plot" 配置项:半径最大像素值。
  37504. * @param {boolean} [options.props.fp64=false] - "scatter-plot" 配置项:否应以高精度64位模式呈现图层。
  37505. * @param {number} [options.props.widthScale=1] - "path-layer" 配置项:线宽比例。
  37506. * @param {number} [options.props.widthMinPixels=0] - "path-layer" 配置项:线宽最小像素值。
  37507. * @param {number} [options.props.widthMaxPixels=Number.MAX_SAFE_INTEGER] - "path-layer" 配置项:线宽最大像素值。
  37508. * @param {boolean} [options.props.rounded=false] - "path-layer" 配置项:节点是否绘制为弧形。
  37509. * @param {number} [options.props.miterLimit=4] - "path-layer" 配置项:节点相对于线宽的最大范围,仅在 rounded 为 false 时有效;
  37510. * @param {boolean} [options.props.fp64=false] - "path-layer" 配置项:否应以高精度64位模式呈现图层。
  37511. * @param {boolean} [options.props.dashJustified=false] - "path-layer" 配置项:是否虚线形式显示,仅在 getDashArray() 回调函数被指定时有效。
  37512. * @param {boolean} [options.props.filled=true] - "polygon-layer" 配置项:是否填充面。
  37513. * @param {boolean} [options.props.stroked=true] - "polygon-layer" 配置项:是否绘制边线。
  37514. * @param {boolean} [options.props.extruded=false] - "polygon-layer" 配置项:是否拉伸建筑。
  37515. * @param {boolean} [options.props.wireframe=false] - "polygon-layer" 配置项:当面被拉伸为建筑时,是否描绘建筑物边线。
  37516. * @param {boolean} [options.props.elevationScale=1] - "polygon-layer" 配置项:海拔比例。
  37517. * @param {boolean} [options.props.lineWidthScale=1] - "polygon-layer" 配置项:线宽比例。
  37518. * @param {boolean} [options.props.lineWidthMinPixels=0] - "polygon-layer" 配置项:线宽最小像素值。
  37519. * @param {boolean} [options.props.lineWidthMaxPixels=Number.MAX_SAFE_INTEGER] - "polygon-layer" 配置项:线宽最大像素值。
  37520. * @param {boolean} [options.props.lineJointRounded=false] - "polygon-layer" 配置项:节点是否绘制为弧形。
  37521. * @param {boolean} [options.props.lineMiterLimit=4] - "polygon-layer" 配置项:节点相对于线宽的最大范围,仅在 lineJointRounded 为 false 时有效。
  37522. * @param {boolean} [options.props.lineDashJustified=false] - "polygon-layer" 配置项:是否虚线形式显示,仅在 getLineDashArray() 回调函数被指定时有效。
  37523. * @param {boolean} [options.props.fp64=false] - "polygon-layer" 配置项:否应以高精度64位模式呈现图层。
  37524. * @param {boolean} [options.props.fp64=false] - "arc-layer" 配置项:否应以高精度64位模式呈现图层。
  37525. * @param {boolean} [options.props.strokeWidth=1] - "arc-layer" 配置项:线宽。
  37526. * @param {boolean} [options.props.radius=1000] - "hexagon-layer" 配置项:六边形半径值。
  37527. * @param {boolean} [options.props.extruded=false] - "hexagon-layer" 配置项:是否拉伸要素。
  37528. * @param {boolean} [options.props.upperPercentile=100] - "hexagon-layer" 配置项:筛选箱并通过upperPercentile重新计算颜色。颜色值大于upperPercentile的六边形将被隐藏。
  37529. * @param {boolean} [options.props.elevationScale=1] - "hexagon-layer" 配置项:高程乘数,实际海拔高度由 elevationScale * getElevation(d)计算。 elevationScale是一个方便的属性,可以在不更新数据的情况下缩放所有六边形。
  37530. * @param {boolean} [options.props.colorDomain=false] - "hexagon-layer" 配置项:色阶。
  37531. * @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" 配置项:色带。
  37532. * @usage
  37533. */
  37534. class DeckglLayerBase {
  37535. constructor(layerTypeID, options) {
  37536. /**
  37537. * @member {string} DeckglLayerBase.prototype.id
  37538. * @description 高效率点图层 ID。
  37539. */
  37540. this.layerTypeID = layerTypeID;
  37541. /**
  37542. * @member {Array.<Graphic>} DeckglLayerBase.prototype.graphics
  37543. * @description 点要素对象数组。
  37544. *
  37545. */
  37546. this.data = [].concat(options.data);
  37547. this.props = options.props ? options.props : {};
  37548. this.callback = options.callback ? options.callback : {};
  37549. this.id = options.layerId
  37550. ? options.layerId
  37551. : Util_Util.createUniqueID('graphicLayer_' + this.layerTypeID + '_');
  37552. }
  37553. /**
  37554. * @function DeckglLayerBase.prototype.onAdd
  37555. */
  37556. onAdd() {
  37557. }
  37558. /**
  37559. * @function DeckglLayerBase.prototype.render
  37560. */
  37561. render() {
  37562. }
  37563. /**
  37564. * @function DeckglLayerBase.prototype.setStyle
  37565. * @description 设置图层整体样式。
  37566. * @param {Object} styleOptions - 样式对象。
  37567. * @param {Array.<number>} [styleOptions.color=[0, 0, 0, 255]] - 点颜色。
  37568. * @param {number} [styleOptions.radius=10] - 点半径。
  37569. * @param {number} [styleOptions.opacity=0.8] - 不透明度。
  37570. * @param {Array.<number>} [styleOptions.highlightColor] - 高亮颜色,目前只支持 rgba 数组。
  37571. * @param {number} [styleOptions.radiusScale=1] - 点放大倍数。
  37572. * @param {number} [styleOptions.radiusMinPixels=0] - 半径最小值(像素)。
  37573. * @param {number} [styleOptions.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  37574. * @param {number} [styleOptions.strokeWidth=12] - 边框大小。
  37575. * @param {boolean} [styleOptions.outline=false] - 是否显示边框。
  37576. */
  37577. setStyle(styleOptions) {
  37578. Util_Util.extend(this.props, styleOptions);
  37579. this._createLayerByLayerTypeID();
  37580. this.update();
  37581. }
  37582. /**
  37583. * @function DeckglLayerBase.prototype.setData
  37584. * @description 设置绘制的点要素数据,会覆盖之前的所有要素。
  37585. * @param {Array.<Object>} data - 点要素对象数组。
  37586. */
  37587. setData(data) {
  37588. this.data = this.data || [];
  37589. this.data.length = 0;
  37590. let dataTemp = !Util_Util.isArray(data) ? [data] : [].concat(data);
  37591. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  37592. if (!this.layer.props.data) {
  37593. this.layer.props.data = [];
  37594. }
  37595. this.layer.props.data.length = 0;
  37596. for (let i = 0; i < dataTemp.length; i++) {
  37597. this.layer.props.data.push(dataTemp[i]);
  37598. }
  37599. this.data = this.layer.props.data;
  37600. this.update();
  37601. }
  37602. /**
  37603. * @function DeckglLayerBase.prototype.addData
  37604. * @description 添加点要素,不会覆盖之前的要素。
  37605. * @param {Array.<Object>} data - 点要素对象数组。
  37606. */
  37607. addData(data) {
  37608. this.data = this.data || [];
  37609. let dataTemp = !Util_Util.isArray(data) ? [data] : [].concat(data);
  37610. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  37611. if (!this.layer.props.data) {
  37612. this.layer.props.data = [];
  37613. }
  37614. for (let i = 0; i < dataTemp.length; i++) {
  37615. this.layer.props.data.push(dataTemp[i]);
  37616. }
  37617. this.update();
  37618. }
  37619. /**
  37620. * @function DeckglLayerBase.prototype.update
  37621. * @description 更新图层。
  37622. */
  37623. update() {
  37624. if (this.layer.lifecycle !== 'Awaiting state') {
  37625. let changeFlags = {
  37626. dataChanged: true,
  37627. propsChanged: true,
  37628. viewportChanged: true,
  37629. updateTriggersChanged: true
  37630. };
  37631. this.layer.setChangeFlags(changeFlags);
  37632. }
  37633. this._draw();
  37634. }
  37635. /**
  37636. * @function DeckglLayerBase.prototype.clear
  37637. * @description 释放图层资源。
  37638. */
  37639. // todo 还有哪些资源应该被释放?
  37640. clear() {
  37641. this.removeData();
  37642. this.deckGL.finalize();
  37643. }
  37644. /**
  37645. * @function DeckglLayerBase.prototype.removeData
  37646. * @description 移除所有要素。
  37647. */
  37648. removeData() {
  37649. this.data.length = 0;
  37650. if (this.layer.props.data) {
  37651. this.layer.props.data.length = 0;
  37652. }
  37653. this.update();
  37654. }
  37655. /**
  37656. * @function DeckglLayerBase.prototype.moveTo
  37657. * @description 将图层移动到某个图层之前。
  37658. * @param {string} layerID - 待插入的图层 ID。
  37659. * @param {boolean} [before=true] - 是否将本图层插入到图层 ID 为 layerID 的图层之前。
  37660. */
  37661. moveTo(layerID, before) {
  37662. var layer = document.getElementById(this.id);
  37663. before = before !== undefined ? before : true;
  37664. if (before) {
  37665. var beforeLayer = document.getElementById(layerID);
  37666. if (layer && beforeLayer) {
  37667. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  37668. }
  37669. return;
  37670. }
  37671. var nextLayer = document.getElementById(layerID);
  37672. if (layer) {
  37673. if (nextLayer.nextSibling) {
  37674. nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
  37675. return;
  37676. }
  37677. nextLayer.parentNode.appendChild(layer);
  37678. }
  37679. }
  37680. /**
  37681. * @function DeckglLayerBase.prototype.setVisibility
  37682. * @description 设置图层可见性。
  37683. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  37684. */
  37685. setVisibility(visibility) {
  37686. if (this.canvas && visibility !== this.visibility) {
  37687. this.visibility = visibility;
  37688. this.canvas.style.display = visibility ? 'block' : 'none';
  37689. }
  37690. }
  37691. _draw() {
  37692. let deckOptions = this._getState();
  37693. deckOptions.layers = [this.layer];
  37694. deckOptions.canvas = this.canvas;
  37695. this.deckGL.setProps(deckOptions);
  37696. }
  37697. _getState() {
  37698. //获取地图信息构建state
  37699. let width = parseInt(this.canvas.style.width);
  37700. let height = parseInt(this.canvas.style.height);
  37701. const mapInfo = this.getMapInfo();
  37702. let mapViewport = {
  37703. width: width,
  37704. height: height,
  37705. ...mapInfo
  37706. };
  37707. let state = {};
  37708. //克隆 mapViewport
  37709. for (let key in mapViewport) {
  37710. state[key] = mapViewport[key];
  37711. }
  37712. //克隆 props
  37713. for (let key in this.props) {
  37714. state[key] = this.props[key];
  37715. }
  37716. if (this._isEPSG3857 && this._isEPSG3857()) {
  37717. state.coordinateSystem = this.coordinateSystem;
  37718. state.isGeographicCoordinateSystem = this.isGeographicCoordinateSystem;
  37719. } else {
  37720. state.coordinateSystem = 1;
  37721. state.isGeographicCoordinateSystem = false
  37722. }
  37723. //更行数据
  37724. state.data = this.data;
  37725. return state;
  37726. }
  37727. /**
  37728. * @function DeckglLayerBase.prototype._createLayerByLayerTypeID
  37729. * @description 判别当前创建图层类型。
  37730. * @private
  37731. */
  37732. _createLayerByLayerTypeID() {
  37733. //统一处理公共属性:
  37734. this.props.data = this.data;
  37735. this.props.isGeographicCoordinateSystem = this.isGeographicCoordinateSystem;
  37736. this.props.coordinateSystem = this.coordinateSystem;
  37737. //添加事件监听
  37738. this.props.pickable = Boolean(this.props.onClick) || Boolean(this.props.onHover);
  37739. //各类型各自从 defaultProps 取出相形的参数:
  37740. if (this.layerTypeID === 'scatter-plot') {
  37741. this.props.id = 'scatter-plot';
  37742. this._createScatterPlotLayer();
  37743. } else if (this.layerTypeID === 'path-layer') {
  37744. this.props.id = 'path-layer';
  37745. this._createPathLayer();
  37746. } else if (this.layerTypeID === 'polygon-layer') {
  37747. this.props.id = 'polygon-layer';
  37748. this._createPolygonLayer();
  37749. } else if (this.layerTypeID === 'arc-layer') {
  37750. this.props.id = 'arc-layer';
  37751. this._createArcLineLayer();
  37752. } else if (this.layerTypeID === 'hexagon-layer') {
  37753. this.props.id = 'hexagon-layer';
  37754. this._createHexagonLayer();
  37755. } else {
  37756. throw new Error(this.layerTypeID + ' does not support');
  37757. }
  37758. }
  37759. /**
  37760. * @description scatter-plot
  37761. * @private
  37762. */
  37763. _createScatterPlotLayer() {
  37764. //处理回调
  37765. /* this.props.getPosition = this.callback.getPosition ? this.callback.getPosition : function (point) {
  37766. if (!point) {
  37767. return [0, 0, 0];
  37768. }
  37769. return point.geometry.coordinates;
  37770. };*/
  37771. var me = this;
  37772. this.props.getPosition = this.callback.getPosition
  37773. ? this.callback.getPosition
  37774. : function (point) {
  37775. if (!point) {
  37776. return [0, 0, 0];
  37777. }
  37778. let lngLat = point.getLngLat();
  37779. return lngLat && [lngLat.lng, lngLat.lat, 0];
  37780. };
  37781. if (this.callback.getColor) {
  37782. this.props.getColor = this.callback.getColor
  37783. ? this.callback.getColor
  37784. : function (point) {
  37785. let style = point && point.getStyle();
  37786. return (style && style.color) || me.props.color;
  37787. };
  37788. }
  37789. if (this.callback.getRadius) {
  37790. this.props.getRadius = this.callback.getRadius
  37791. ? this.callback.getRadius
  37792. : function (point) {
  37793. let style = point && point.getStyle();
  37794. return (style && style.radius) || me.props.radius;
  37795. };
  37796. }
  37797. if (this.props.color || this.props.radius) {
  37798. this.props.updateTriggers = {};
  37799. if (this.props.radius) {
  37800. this.props.updateTriggers.getRadius = [this.props.radius];
  37801. }
  37802. if (this.props.color) {
  37803. this.props.updateTriggers.getColor = [this.props.color];
  37804. }
  37805. }
  37806. this.layer = new window.DeckGL.ScatterplotLayer(this.props);
  37807. }
  37808. /**
  37809. * @description path-layer
  37810. * @private
  37811. */
  37812. _createPathLayer() {
  37813. this.props.getPath = this.callback.getPath
  37814. ? this.callback.getPath
  37815. : function (feature) {
  37816. return feature.geometry.coordinates;
  37817. };
  37818. //以下几个函数也可走默认值
  37819. if (this.callback.getColor) {
  37820. this.props.getColor = this.callback.getColor;
  37821. }
  37822. if (this.callback.getWidth) {
  37823. this.props.getWidth = this.callback.getWidth;
  37824. }
  37825. if (this.callback.getDashArray) {
  37826. this.props.getDashArray = this.callback.getDashArray;
  37827. }
  37828. this.layer = new window.DeckGL.PathLayer(this.props);
  37829. }
  37830. /**
  37831. * @description polygon-layer
  37832. * @private
  37833. */
  37834. _createPolygonLayer() {
  37835. this.props.getPolygon = this.callback.getPolygon
  37836. ? this.callback.getPolygon
  37837. : function (feature) {
  37838. return feature.geometry.coordinates;
  37839. };
  37840. //todo 思考下真的让用户配这么多回调么,或者先判断下数据属性里面有没有配置的属性值?
  37841. if (this.callback.getElevation) {
  37842. this.props.getElevation = this.callback.getElevation;
  37843. }
  37844. if (this.callback.getFillColor) {
  37845. this.props.getFillColor = this.callback.getFillColor;
  37846. }
  37847. if (this.callback.getLineColor) {
  37848. this.props.getLineColor = this.callback.getLineColor;
  37849. }
  37850. if (this.callback.getLineWidth) {
  37851. this.props.getLineWidth = this.callback.getLineWidth;
  37852. }
  37853. this.props.updateTriggers = {};
  37854. this.props.updateTriggers.getColor = this.props.color ? this.props.color : [0, 0, 128, 128];
  37855. this.layer = new window.DeckGL.PolygonLayer(this.props);
  37856. }
  37857. /**
  37858. * @description arc-layer
  37859. * @private
  37860. */
  37861. _createArcLineLayer() {
  37862. //todo ArcLineLayer geojson coordinates数组中只能有一个线段
  37863. this.props.getSourcePosition = this.callback.getSourcePosition
  37864. ? this.callback.getSourcePosition
  37865. : function (feature) {
  37866. if (!feature) {
  37867. return [0, 0, 0];
  37868. }
  37869. return feature.geometry.coordinates[0];
  37870. };
  37871. this.props.getTargetPosition = this.callback.getTargetPosition
  37872. ? this.callback.getTargetPosition
  37873. : function (feature) {
  37874. if (!feature) {
  37875. return [0, 0, 0];
  37876. }
  37877. return feature.geometry.coordinates[1];
  37878. };
  37879. if (this.callback.getStrokeWidth) {
  37880. this.props.getStrokeWidth = this.callback.getStrokeWidth;
  37881. }
  37882. if (this.callback.getSourceColor) {
  37883. this.props.getSourceColor = this.callback.getSourceColor;
  37884. }
  37885. if (this.callback.getTargetColor) {
  37886. this.props.getTargetColor = this.callback.getTargetColor;
  37887. }
  37888. this.layer = new window.DeckGL.ArcLayer(this.props);
  37889. }
  37890. /**
  37891. * @description hexagon-layer
  37892. * @private
  37893. */
  37894. _createHexagonLayer() {
  37895. this.props.getPosition = this.callback.getPosition
  37896. ? this.callback.getPosition
  37897. : function (feature) {
  37898. if (!feature) {
  37899. return [0, 0, 0];
  37900. }
  37901. return feature.geometry.coordinates;
  37902. };
  37903. if (this.callback.getColorValue) {
  37904. this.props.getColorValue = this.callback.getColorValue;
  37905. }
  37906. if (this.callback.getElevationValue) {
  37907. this.props.getElevationValue = this.callback.getElevationValue;
  37908. }
  37909. this.layer = new window.DeckGL.HexagonLayer(this.props);
  37910. }
  37911. _initContainer(targetElement, mapElement) {
  37912. const { width, height } = mapElement.style;
  37913. this.canvas = this._createCanvas(width, height);
  37914. targetElement.appendChild(this.canvas);
  37915. }
  37916. _createCanvas(width, height) {
  37917. let canvas = document.createElement('canvas');
  37918. canvas.id = this.id;
  37919. canvas.style.position = 'absolute';
  37920. canvas.style.top = 0 + 'px';
  37921. canvas.style.left = 0 + 'px';
  37922. canvas.style.cursor = '';
  37923. canvas.width = parseInt(width);
  37924. canvas.height = parseInt(height);
  37925. canvas.style.width = width;
  37926. canvas.style.height = height;
  37927. return canvas;
  37928. }
  37929. }
  37930. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/DeckglLayer.js
  37931. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37932. * This program are made available under the terms of the Apache License, Version 2.0
  37933. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37934. /**
  37935. * @class DeckglLayer
  37936. * @category Visualization DeckGL
  37937. * @classdesc Deckgl 高效率图层类。该图图层为综合图层,通过该图层可创建 高效率点图层、路径图层(线图层)、高效率面图层、曲线图层、
  37938. * 正六边形图层(蜂巢图层)、网格图层,只需给定相依配置,因此,在创建图层之前,请仔细阅读参数配置。
  37939. * @modulecategory Overlay
  37940. * @param {string} layerTypeID - 高效率图层类型 ID,包括 "scatter-plot" 高效率点图层、"path-layer" 路径图层(线图层)、
  37941. * "polygon-layer" 高效率面图层、"arc-layer" 曲线图层、"hexagon-layer" 正六边形图层(蜂巢图层)、"screen-grid-layer" 网格图层。
  37942. *
  37943. * @param {Object} options - 图层配置项,包括以下参数:
  37944. * @param {Object} [options.layerId] - DeckglLayer 图层 Dom 元素 ID。默认使用 CommonUtil.createUniqueID("graphicLayer_" + this.layerTypeID + "_") 创建专题图层 ID。
  37945. * @param {Array.<GeoJSONObject>} options.data - 图层数据,支持 GeoJSON 规范数据类型。
  37946. * @param {Object} options.callback - deckgl 图层回调函数配置项。
  37947. * @param {Object} options.props - deckgl 图层配置项, 在该参数下配置图层配置项:
  37948. * @param {boolean} options.props.coverage - "hexagon-layer" 配置项:六边形半径乘数,介于0 - 1之间。六边形的最终半径通过覆盖半径计算。注意:覆盖范围不会影响分数的分配方式。分配方式的半径仅由半径属性确定;
  37949. * @param {boolean} options.props.hexagonAggregator - "hexagon-layer" 配置项:* @param {boolean}
  37950. * @param {Object} options.props.lightSettings - 光照配置项。
  37951. * @param {Array} options.props.lightSettings.lightsPosition - 光照配置项:指定为`[x,y,z]`的光在平面阵列中的位置`, 在一个平面阵列。长度应该是 `3 x numberOfLights`。
  37952. * @param {Array} options.props.lightSettings.lightsStrength - 光照配置项:平面阵列中指定为“[x,y]`的灯的强度。长度应该是`2 x numberOfLights`。
  37953. * @param {number} [options.props.lightSettings.numberOfLights=1] - 光照配置项:光照值,最大值为 `5`。
  37954. * @param {number} [options.props.lightSettings.coordinateSystem=COORDINATE_SYSTEM.LNGLAT] - 光照配置项:指定灯位置的坐标系。
  37955. * @param {number} [options.props.lightSettings.coordinateOrigin=[0, 0, 0]] - 光照配置项:指定灯位置的坐标原点。
  37956. * @param {number} [options.props.lightSettings.modelMatrix] - 光照配置项:光位置的变换矩阵。
  37957. * @param {number} [options.props.lightSettings.ambientRatio=0.4] - 光照配置项:光照的环境比例。
  37958. * @param {number} [options.props.lightSettings.diffuseRatio=0.6] - 光照配置项:光的漫反射率。
  37959. * @param {number} [options.props.lightSettings.specularRatio=0.8] - 光照配置项:光的镜面反射率。
  37960. * @param {number} [options.props.opacity=1] - 公共配置项:图层不透明度度。
  37961. * @param {boolean} [options.props.pickable=false] - 公共配置项:是否响应鼠标事件(鼠标点击,鼠标滑动)。
  37962. * @param {function} [options.props.autoHighlight=false] - 公共配置项:鼠标滑动高亮要素。
  37963. * @param {function} [options.props.highlightColor=[0, 0, 128, 128]] - 公共配置项:鼠标滑动高亮颜色。
  37964. * @param {function} [options.props.onClick] - 公共配置项:鼠标点击事件。
  37965. * @param {function} [options.props.onHover] - 公共配置项:鼠标滑动事件。
  37966. * @param {number} [options.props.radiusScale=1] - "scatter-plot" 配置项:散点半径比例。
  37967. * @param {boolean} [options.props.outline=false] - "scatter-plot" 配置项:是否边线显示。
  37968. * @param {number} [options.props.strokeWidth=1] - "scatter-plot" 配置项:边线宽度。
  37969. * @param {number} [options.props.radiusMinPixels=0] - "scatter-plot" 配置项:半径最小像素值。
  37970. * @param {number} [options.props.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - "scatter-plot" 配置项:半径最大像素值。
  37971. * @param {boolean} [options.props.fp64=false] - "scatter-plot" 配置项:否应以高精度64位模式呈现图层。
  37972. * @param {number} [options.props.widthScale=1] - "path-layer" 配置项:线宽比例。
  37973. * @param {number} [options.props.widthMinPixels=0] - "path-layer" 配置项:线宽最小像素值。
  37974. * @param {number} [options.props.widthMaxPixels=Number.MAX_SAFE_INTEGER] - "path-layer" 配置项:线宽最大像素值。
  37975. * @param {boolean} [options.props.rounded=false] - "path-layer" 配置项:节点是否绘制为弧形。
  37976. * @param {number} [options.props.miterLimit=4] - "path-layer" 配置项:节点相对于线宽的最大范围,仅在 rounded 为 false 时有效;
  37977. * @param {boolean} [options.props.fp64=false] - "path-layer" 配置项:否应以高精度64位模式呈现图层。
  37978. * @param {boolean} [options.props.dashJustified=false] - "path-layer" 配置项:是否虚线形式显示,仅在 getDashArray() 回调函数被指定时有效。
  37979. * @param {boolean} [options.props.filled=true] - "polygon-layer" 配置项:是否填充面。
  37980. * @param {boolean} [options.props.stroked=true] - "polygon-layer" 配置项:是否绘制边线。
  37981. * @param {boolean} [options.props.extruded=false] - "polygon-layer" 配置项:是否拉伸建筑。
  37982. * @param {boolean} [options.props.wireframe=false] - "polygon-layer" 配置项:当面被拉伸为建筑时,是否描绘建筑物边线。
  37983. * @param {boolean} [options.props.elevationScale=1] - "polygon-layer" 配置项:海拔比例。
  37984. * @param {boolean} [options.props.lineWidthScale=1] - "polygon-layer" 配置项:线宽比例。
  37985. * @param {boolean} [options.props.lineWidthMinPixels=0] - "polygon-layer" 配置项:线宽最小像素值。
  37986. * @param {boolean} [options.props.lineWidthMaxPixels=Number.MAX_SAFE_INTEGER] - "polygon-layer" 配置项:线宽最大像素值。
  37987. * @param {boolean} [options.props.lineJointRounded=false] - "polygon-layer" 配置项:节点是否绘制为弧形。
  37988. * @param {boolean} [options.props.lineMiterLimit=4] - "polygon-layer" 配置项:节点相对于线宽的最大范围,仅在 lineJointRounded 为 false 时有效。
  37989. * @param {boolean} [options.props.lineDashJustified=false] - "polygon-layer" 配置项:是否虚线形式显示,仅在 getLineDashArray() 回调函数被指定时有效。
  37990. * @param {boolean} [options.props.fp64=false] - "polygon-layer" 配置项:否应以高精度64位模式呈现图层。
  37991. * @param {boolean} [options.props.fp64=false] - "arc-layer" 配置项:否应以高精度64位模式呈现图层。
  37992. * @param {boolean} [options.props.strokeWidth=1] - "arc-layer" 配置项:线宽。
  37993. * @param {boolean} [options.props.radius=1000] - "hexagon-layer" 配置项:六边形半径值。
  37994. * @param {boolean} [options.props.extruded=false] - "hexagon-layer" 配置项:是否拉伸要素。
  37995. * @param {boolean} [options.props.upperPercentile=100] - "hexagon-layer" 配置项:筛选箱并通过upperPercentile重新计算颜色。颜色值大于upperPercentile的六边形将被隐藏。
  37996. * @param {boolean} [options.props.elevationScale=1] - "hexagon-layer" 配置项:高程乘数,实际海拔高度由 elevationScale * getElevation(d)计算。 elevationScale是一个方便的属性,可以在不更新数据的情况下缩放所有六边形。
  37997. * @param {boolean} [options.props.colorDomain=false] - "hexagon-layer" 配置项:色阶。
  37998. * @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" 配置项:色带。
  37999. * @usage
  38000. * @extends {DeckglLayerBase}
  38001. */
  38002. class DeckglLayer extends DeckglLayerBase {
  38003. constructor(layerTypeID, options) {
  38004. super(layerTypeID, options);
  38005. this.type='custom';
  38006. this.renderingMode = '3d';
  38007. this.overlay = true;
  38008. }
  38009. /**
  38010. * @function DeckglLayer.prototype.onAdd
  38011. * @param {mapboxgl.Map} map - MapBoxGL Map 对象。
  38012. * @returns {DeckglLayer}
  38013. */
  38014. onAdd(map) {
  38015. this.map = map;
  38016. if (this.canvas) {
  38017. this.mapContainer = this.map.getCanvasContainer();
  38018. return this;
  38019. }
  38020. //当使用扩展的mapboxgl代码时有效
  38021. if (this._isEPSG3857()) {
  38022. this.coordinateSystem = 3;
  38023. this.isGeographicCoordinateSystem = true;
  38024. } else {
  38025. this.coordinateSystem = 1;
  38026. this.isGeographicCoordinateSystem = false;
  38027. }
  38028. //创建图层容器
  38029. this._initContainer(this.map.getCanvasContainer(), this.map.getCanvas());
  38030. //创建 deckgl 图层
  38031. this._createLayerByLayerTypeID();
  38032. var mapState = this._getState();
  38033. let deckOptions = {};
  38034. for (let key in mapState) {
  38035. deckOptions[key] = mapState[key];
  38036. }
  38037. deckOptions.layers = [this.layer];
  38038. deckOptions.canvas = this.canvas;
  38039. this.deckGL = new window.DeckGL.experimental.DeckGLJS(deckOptions);
  38040. this._draw();
  38041. return this;
  38042. }
  38043. /**
  38044. * @function DeckglLayer.prototype.onRemove
  38045. * @param {maplibregl.Map} map - MapLibreGL Map 对象。
  38046. */
  38047. onRemove() {
  38048. this.map.getCanvasContainer().removeChild(this.canvas);
  38049. this.clear();
  38050. }
  38051. /**
  38052. * @function DeckglLayer.prototype.getMapInfo
  38053. * @param {maplibregl.Map} map - MapLibreGL Map 对象。
  38054. */
  38055. getMapInfo() {
  38056. let center = this.map.getCenter();
  38057. let zoom = this.map.getZoom();
  38058. let maxZoom = this.map.getMaxZoom();
  38059. let pitch = this.map.getPitch();
  38060. let bearing = this.map.getBearing();
  38061. let longitude = center.lng;
  38062. let latitude = center.lat;
  38063. return { center, zoom, maxZoom, pitch, bearing, longitude, latitude };
  38064. }
  38065. /**
  38066. * @function DeckglLayer.prototype.render
  38067. */
  38068. render() {
  38069. this._draw();
  38070. }
  38071. _isEPSG3857() {
  38072. return this.map.getCRS && this.map.getCRS() !== (external_mapboxgl_default()).CRS.EPSG3857
  38073. }
  38074. }
  38075. ;// CONCATENATED MODULE: ./src/common/overlay/graticule/GraticuleLayerRenderer.js
  38076. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38077. * This program are made available under the terms of the Apache License, Version 2.0
  38078. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38079. /**
  38080. * reference and modification
  38081. * dereklieu/cool-grid, cloudybay/leaflet.latlng-graticule
  38082. * (https://github.com/dereklieu/cool-grid, https://github.com/cloudybay/leaflet.latlng-graticule)
  38083. * Apache Licene 2.0
  38084. * thanks dereklieu, cloudybay
  38085. */
  38086. /**
  38087. * @private
  38088. * @class GraticuleLayerRenderer
  38089. * @classdesc 经纬网。
  38090. * @version 11.1.1
  38091. * @param {Object} options - 参数。
  38092. * @param {boolean} [options.visible=true] - 是否显示经纬网。
  38093. * @param {boolean} [options.showLabel=true] - 是否显示标签。
  38094. * @param {number} [options.opacity=1] - 画布不透明度。
  38095. * @param {number|function} [options.interval = 10] - 经纬度的间隔(以度为单位),可以是数字,也可以是函数,参数是map。
  38096. * @param {Array.<number>} [options.extent] - 经纬网渲染的边界范围([minx, miny, maxx, maxy]),不传为整个地图范围。
  38097. * @param {number} [options.minZoom] - 最小视图缩放级别(不包括此级别),在该级别之上,该层将可见。
  38098. * @param {number} [options.maxZoom] - 该图层可见的最大视图缩放级别(含)。
  38099. * @param {function} [options.lngLabelFormatter = null] - 经度标签转换函数。
  38100. * @param {function} [options.latLabelFormatter = null] - 纬度标签转换函数。
  38101. * @param {GraticuleLayerRenderer.LabelStyle} [options.lngLabelStyle] - 经度标签样式。
  38102. * @param {GraticuleLayerRenderer.LabelStyle} [options.latLabelStyle] - 纬度标签样式。
  38103. * @param {GraticuleLayerRenderer.StrokeStyle} [options.strokeStyle] - 绘制经纬线的样式。
  38104. * @param {Object} [functions] - 图层传递给渲染器调用的方法。
  38105. * @param {Object} [mapOptions] - 图层传递给渲染器的地图元素信息。
  38106. * @usage
  38107. */
  38108. const defaultTextStyle = {
  38109. textSize: '12px',
  38110. textFont: ['12px Calibri', 'sans-serif'],
  38111. textAnchor: 'bottom',
  38112. textColor: 'rgba(0,0,0,1)',
  38113. textHaloColor: 'rgba(255,255,255,1)',
  38114. textHaloWidth: 1
  38115. };
  38116. const defaultStrokeStyle = {
  38117. lineColor: 'red',
  38118. lineCap: 'round', // butt, round, square
  38119. lineJoin: 'round', // bevel, round, miter
  38120. lindDasharray: [0.4, 5], // 数组|function
  38121. lineDashOffset: 0,
  38122. lineWidth: 1 // 数字|function
  38123. };
  38124. const defaultOptions = {
  38125. showLabel: true,
  38126. opacity: 1,
  38127. visible: true,
  38128. interval: 10, // function|number
  38129. extent: null,
  38130. minZoom: 0,
  38131. maxZoom: 50,
  38132. wrapX: true,
  38133. strokeStyle: defaultStrokeStyle,
  38134. lngLabelFormatter: null,
  38135. latLabelFormatter: null,
  38136. lngLabelStyle: defaultTextStyle,
  38137. latLabelStyle: defaultTextStyle
  38138. };
  38139. class GraticuleLayerRenderer {
  38140. constructor(map, options, functions, mapOptions) {
  38141. this.map = map;
  38142. this.id = mapOptions && mapOptions.id;
  38143. this.sourceId = this.id + '_line';
  38144. this.canvasId = this.id;
  38145. this.options = options;
  38146. this.mapElement = mapOptions.mapElement;
  38147. this.targetElement = mapOptions.targetElement;
  38148. this.getMapStateByKey = functions.getMapStateByKey;
  38149. this.getDefaultExtent = functions.getDefaultExtent;
  38150. this.setVisibility = functions.setVisibility;
  38151. this.updateGraticuleLayer = functions.updateGraticuleLayer;
  38152. this.init();
  38153. }
  38154. init() {
  38155. this._initialize();
  38156. this._createCanvas();
  38157. this._drawCanvas();
  38158. this.setVisibility();
  38159. this._drawLabel();
  38160. }
  38161. onRemove() {
  38162. this.targetElement.removeChild(this.canvas);
  38163. this.canvas = null;
  38164. }
  38165. /**
  38166. * @function GraticuleLayerRenderer.prototype.setMinZoom
  38167. * @description 设置最小视图缩放级别。
  38168. * @param {number} minZoom - 最小视图缩放级别(不包括此级别),在该级别之上,该层将可见。
  38169. */
  38170. setMinZoom(minZoom) {
  38171. this.options.minZoom = minZoom;
  38172. this.setVisibility();
  38173. }
  38174. /**
  38175. * @function GraticuleLayerRenderer.prototype.setMaxZoom
  38176. * @description 该图层可见的最大视图缩放级别。
  38177. * @param {number} maxZoom - 该图层可见的最大视图缩放级别(含)。
  38178. */
  38179. setMaxZoom(maxZoom) {
  38180. this.options.maxZoom = maxZoom;
  38181. this.setVisibility();
  38182. }
  38183. /**
  38184. * @function GraticuleLayerRenderer.prototype.setShowLabel
  38185. * @description 设置显示标签。
  38186. * @param {boolean} showLabel - 是否显示标签。
  38187. */
  38188. setShowLabel(showLabel) {
  38189. this.options.showLabel = showLabel;
  38190. this._drawLabel();
  38191. }
  38192. /**
  38193. * @function GraticuleLayerRenderer.prototype.setExtent
  38194. * @description 设置经纬网渲染的边界范围。
  38195. * @param {Array.<number>} extent - 经纬网渲染的边界范围。
  38196. */
  38197. setExtent(extent) {
  38198. this.options.extent = this.getDefaultExtent(extent);
  38199. this.features = this._getGraticuleFeatures();
  38200. this.updateGraticuleLayer();
  38201. this._drawLabel();
  38202. }
  38203. /**
  38204. * @function GraticuleLayerRenderer.prototype.setLngLabelStyle
  38205. * @description 设置经度标签样式。
  38206. * @param {GraticuleLayerRenderer.LabelStyle} labelStyle - 标签样式。
  38207. */
  38208. setLngLabelStyle(labelStyle) {
  38209. this.options.lngLabelStyle = labelStyle;
  38210. this._drawLabel();
  38211. }
  38212. /**
  38213. * @function GraticuleLayerRenderer.prototype.setLatLabelStyle
  38214. * @description 设置纬度标签样式。
  38215. * @param {GraticuleLayerRenderer.LabelStyle} labelStyle - 标签样式。
  38216. */
  38217. setLatLabelStyle(labelStyle) {
  38218. this.options.latLabelStyle = labelStyle;
  38219. this._drawLabel();
  38220. }
  38221. /**
  38222. * @function GraticuleLayerRenderer.prototype.setIntervals
  38223. * @description 设置经纬度的间隔(以度为单位)。
  38224. * @param {number|function} interval - 经纬度的间隔(以度为单位),可以是数字,也可以是函数,参数是map。
  38225. */
  38226. setIntervals(interval) {
  38227. this.options.interval = interval;
  38228. this._calcInterval();
  38229. this.features = this._getGraticuleFeatures();
  38230. this.updateGraticuleLayer();
  38231. this._drawLabel();
  38232. }
  38233. draw() {
  38234. this._reset();
  38235. }
  38236. _initialize(options = this.options) {
  38237. options = options || {};
  38238. options.strokeStyle = Object.assign({}, defaultStrokeStyle, options.strokeStyle || {});
  38239. options.lngLabelStyle = Object.assign({}, defaultTextStyle, options.lngLabelStyle || {});
  38240. options.latLabelStyle = Object.assign({}, defaultTextStyle, options.latLabelStyle || {});
  38241. this.options = Object.assign({}, defaultOptions, options, {
  38242. extent: this.getDefaultExtent(options.extent),
  38243. // 提出去
  38244. wrapX: options.wrapX
  38245. });
  38246. this.oldExtent = this.options.extent;
  38247. this._calcInterval();
  38248. this.isRotate = false;
  38249. this.visible = true;
  38250. this.features = this._getGraticuleFeatures();
  38251. }
  38252. _createCanvas() {
  38253. if (this.canvas) {
  38254. return;
  38255. }
  38256. const mapElement = this.mapElement;
  38257. this.canvas = document.createElement('canvas');
  38258. this.canvas.id = this.canvasId;
  38259. this.canvas.style.position = 'absolute';
  38260. this.canvas.style.top = 0 + 'px';
  38261. this.canvas.style.left = 0 + 'px';
  38262. var global$2 = typeof window === 'undefined' ? {} : window;
  38263. var devicePixelRatio = global$2.devicePixelRatio || 1;
  38264. this.canvas.width = parseInt(mapElement.style.width) * devicePixelRatio;
  38265. this.canvas.height = parseInt(mapElement.style.height) * devicePixelRatio;
  38266. this.canvas.style.width = mapElement.style.width;
  38267. this.canvas.style.height = mapElement.style.height;
  38268. this.canvas.globalAlpha = this.options.opacity;
  38269. this.targetElement.appendChild(this.canvas);
  38270. }
  38271. _drawCanvas() {
  38272. if (!this.canvas) {
  38273. this._createCanvas();
  38274. }
  38275. this.setVisibility();
  38276. this._reset();
  38277. }
  38278. _resizeCallback() {
  38279. this.targetElement && this.targetElement.removeChild(this.canvas);
  38280. this.canvas = null;
  38281. this._drawCanvas();
  38282. }
  38283. _reset() {
  38284. this._updateRotate();
  38285. this._updateExtent();
  38286. this._calcInterval();
  38287. this._drawLabel();
  38288. }
  38289. _updateRotate() {
  38290. const bearing = this.getMapStateByKey('getBearing');
  38291. this.isRotate = (bearing > -180 && bearing <= -90) || (bearing >= 90 && bearing < 180);
  38292. }
  38293. _updateExtent() {
  38294. if (this.options.wrapX && !this.oldExtent) {
  38295. const { _ne, _sw } = this.getMapStateByKey('getBounds');
  38296. this.options.extent = [_sw.lng, _sw.lat, _ne.lng, _ne.lat];
  38297. }
  38298. }
  38299. _calcInterval(interval = this.options.interval) {
  38300. if (typeof interval === 'function') {
  38301. interval = interval(this.map);
  38302. this._currLngInterval = interval;
  38303. this._currLatInterval = interval;
  38304. } else {
  38305. this._currLngInterval = interval;
  38306. this._currLatInterval = interval;
  38307. }
  38308. }
  38309. _formatLat(lat) {
  38310. if (this.options.latFormatTickLabel) {
  38311. return this.options.latLabelFormatter(lat);
  38312. }
  38313. if (lat < 0) {
  38314. return '' + conversionDegree(lat * -1) + 'S';
  38315. } else if (lat > 0) {
  38316. return '' + conversionDegree(lat) + 'N';
  38317. }
  38318. return '' + conversionDegree(lat);
  38319. }
  38320. _formatLng(lng) {
  38321. if (this.options.lngLabelFormatter) {
  38322. return this.options.lngLabelFormatter(lng);
  38323. }
  38324. lng = getWrapNum(lng);
  38325. if (lng > 0 && lng <= 180) {
  38326. return '' + conversionDegree(lng) + 'E';
  38327. } else if (lng < 0 && lng >= -180) {
  38328. return '' + conversionDegree(lng * -1) + 'W';
  38329. }
  38330. return '' + conversionDegree(lng);
  38331. }
  38332. _parsePxToInt(txt) {
  38333. if (txt.length > 2) {
  38334. if (txt.charAt(txt.length - 2) === 'p') {
  38335. txt = txt.substr(0, txt.length - 2);
  38336. }
  38337. }
  38338. try {
  38339. return parseInt(txt, 10);
  38340. } catch (e) {
  38341. console.log(e);
  38342. }
  38343. return 0;
  38344. }
  38345. _drawLabel(visible = this.visible) {
  38346. const canvas = this.canvas;
  38347. const ctx = canvas.getContext('2d');
  38348. if (!visible || !this.options.showLabel) {
  38349. ctx.clearRect(0, 0, canvas.width, canvas.height);
  38350. return;
  38351. }
  38352. if (this.mapElement) {
  38353. if (!this._currLngInterval || !this._currLatInterval) {
  38354. this._calcInterval();
  38355. }
  38356. ctx.clearRect(0, 0, canvas.width, canvas.height);
  38357. const { lngLabelStyle, latLabelStyle } = this.options;
  38358. const { lngPoints, latPonits } = this._getGridiculePoints();
  38359. lngPoints.forEach(point => {
  38360. this._drawLng(ctx, point[0], point[1], point[2], lngLabelStyle);
  38361. });
  38362. latPonits.forEach(point => {
  38363. this._drawLat(ctx, point[0], point[1], point[2], latLabelStyle);
  38364. });
  38365. }
  38366. }
  38367. _drawLat(ctx, latTick, bb, isIntersect, latLabelStyle) {
  38368. ctx = this._setLabelStyle(ctx, latLabelStyle);
  38369. const ww = this.canvas.width;
  38370. let txtHeight = 12;
  38371. try {
  38372. const fontSize = ctx.font.split(' ')[0];
  38373. txtHeight = this._parsePxToInt(fontSize);
  38374. } catch (e) {
  38375. console.log(e);
  38376. }
  38377. if (!isIntersect) {
  38378. const lngR = latTick;
  38379. latTick = bb;
  38380. bb = this.getMapStateByKey('project', [lngR, latTick]);
  38381. }
  38382. const latstr = this._formatLat(latTick);
  38383. const txtWidth = ctx.measureText(latstr).width;
  38384. ctx.strokeText(latstr, (isIntersect ? ww : bb.x) - txtWidth, (isIntersect ? bb : bb.y) + txtHeight / 2);
  38385. ctx.fillText(latstr, (isIntersect ? ww : bb.x) - txtWidth, (isIntersect ? bb : bb.y) + txtHeight / 2);
  38386. }
  38387. _drawLng(ctx, lngTick, bb, isIntersect, lngLabelStyle) {
  38388. ctx = this._setLabelStyle(ctx, lngLabelStyle);
  38389. const hh = this.canvas.height;
  38390. if (!isIntersect) {
  38391. const latTick = bb;
  38392. bb = this.getMapStateByKey('project', [lngTick, latTick]);
  38393. }
  38394. const lngstr = this._formatLng(lngTick);
  38395. const txtWidth = ctx.measureText(lngstr).width;
  38396. ctx.strokeText(lngstr, (isIntersect ? bb : bb.x) - txtWidth / 2, isIntersect ? hh : bb.y);
  38397. ctx.fillText(lngstr, (isIntersect ? bb : bb.x) - txtWidth / 2, isIntersect ? hh : bb.y);
  38398. }
  38399. _getLatPoints(lngRange = [-180, 180], firstLng, lastLng, features = this.features) {
  38400. if (!features) {
  38401. return;
  38402. }
  38403. if (this.options.wrapX && lngRange[0] === -180 && lngRange[1] === 180) {
  38404. return [];
  38405. }
  38406. let points = [];
  38407. features.forEach(feature => {
  38408. const lat = feature.geometry.coordinates[0][1];
  38409. const isLatFeature = feature.geometry.coordinates[1][1] === lat;
  38410. if (isLatFeature) {
  38411. let lng = typeof lastLng === 'number' ? lastLng : lngRange[1];
  38412. if (this.isRotate) {
  38413. lng = typeof firstLng === 'number' ? firstLng : lngRange[0];
  38414. }
  38415. if (this.options.wrapX) {
  38416. points = points.concat(this._getWrapPoints(lng, lat, [lng, lng]));
  38417. }
  38418. points.push([lng, lat]);
  38419. }
  38420. });
  38421. return points;
  38422. }
  38423. _getLngPoints(latRange = [-90, 90], firstLat, lastLat, features = this.features) {
  38424. if (!features) {
  38425. return;
  38426. }
  38427. let lat = typeof firstLat === 'number' ? firstLat : latRange[0];
  38428. if (this.isRotate) {
  38429. lat = typeof lastLat === 'number' ? lastLat : latRange[1];
  38430. }
  38431. let points = [];
  38432. features.forEach(feature => {
  38433. let lng = feature.geometry.coordinates[0][0];
  38434. const isLngFeature = feature.geometry.coordinates[1][0] === lng;
  38435. if (isLngFeature) {
  38436. points.push([lng, lat]);
  38437. if (this.options.wrapX) {
  38438. points = points.concat(this._getWrapPoints(lng, lat));
  38439. }
  38440. }
  38441. });
  38442. return points;
  38443. }
  38444. _getWrapPoints(lng, lat, extent = this.oldExtent) {
  38445. const points = [];
  38446. const { _ne, _sw } = this.getMapStateByKey('getBounds');
  38447. const lastLng = extent.length > 2 ? extent[2] : extent[1];
  38448. while (lng >= _sw.lng) {
  38449. const wrapNum = getWrapNum(lng, lastLng === 180, extent[0] === -180);
  38450. if (!extent || (wrapNum >= extent[0] && wrapNum <= lastLng)) {
  38451. points.push([lng, lat]);
  38452. }
  38453. lng -= 360;
  38454. }
  38455. while (lng <= _ne.lng) {
  38456. const wrapNum = getWrapNum(lng, lastLng === 180, extent[0] === -180);
  38457. if (!extent || (wrapNum >= extent[0] && wrapNum <= lastLng)) {
  38458. points.push([lng, lat]);
  38459. }
  38460. lng += 360;
  38461. }
  38462. return points;
  38463. }
  38464. _getGridiculePoints() {
  38465. const intersectLatPoints = this._getEdgeLat();
  38466. const intersectLngPoints = this._getEdgeLng();
  38467. const { latRange, lngRange, firstLat, firstLng, lastLat, lastLng } = this._getRange();
  38468. const latPonits = this._getUniquePoint(this._getLatPoints(lngRange, firstLng, lastLng), intersectLatPoints, 1);
  38469. const lngPoints = this._getUniquePoint(this._getLngPoints(latRange, firstLat, lastLat), intersectLngPoints, 0);
  38470. return { latPonits, lngPoints };
  38471. }
  38472. _getEdgeLat(_currLatInterval = this._currLatInterval) {
  38473. let latPoints = [];
  38474. let latCoordinates = [];
  38475. let firstLat;
  38476. const ww = this.canvas.width;
  38477. const hh = this.canvas.height;
  38478. const { extent } = this._getRange();
  38479. const { _ne } = this.getMapStateByKey('getBounds');
  38480. if (this.options.wrapX && getWrapNum(_ne.lng) > extent[2]) {
  38481. return [];
  38482. }
  38483. const countDecimals = this._countDecimals(_currLatInterval);
  38484. for (let i = 0; i <= hh; i++) {
  38485. const point = this.getMapStateByKey('unproject', [ww, i]);
  38486. const wrapNum = getWrapNum(point.lng);
  38487. const lngEdge = this.options.wrapX
  38488. ? wrapNum >= extent[0] && wrapNum <= extent[2]
  38489. : point.lng >= extent[0] && point.lng <= extent[2];
  38490. if (lngEdge && point.lat >= extent[1] && point.lat <= extent[3]) {
  38491. latPoints.push([point.lat, i]);
  38492. latCoordinates.push(point.lat);
  38493. if (firstLat === undefined && point.lat.toFixed(countDecimals) % _currLatInterval === 0) {
  38494. firstLat = Number(point.lat.toFixed(countDecimals));
  38495. }
  38496. }
  38497. }
  38498. const { first, last, coordinates, points } = this._getIntersectRange(
  38499. firstLat,
  38500. latCoordinates,
  38501. latPoints,
  38502. _currLatInterval
  38503. );
  38504. firstLat = Math.min(Math.max(first, -90), 90);
  38505. const lastLat = Math.max(Math.min(Math.round(last), 90), -90);
  38506. if (firstLat !== -90 || lastLat !== -90) {
  38507. return this._getClosestCoordinate(firstLat, lastLat, coordinates, points, _currLatInterval);
  38508. }
  38509. return [];
  38510. }
  38511. _getEdgeLng(_currLngInterval = this._currLngInterval) {
  38512. let lngPoints = [];
  38513. let lngCoordinates = [];
  38514. let firstLng;
  38515. const ww = this.canvas.width;
  38516. const hh = this.canvas.height;
  38517. const extent = this.options.extent;
  38518. const countDecimals = this._countDecimals(_currLngInterval);
  38519. const { _sw } = this.getMapStateByKey('getBounds');
  38520. if (this.options.wrapX && getWrapNum(_sw.lat) > extent[3]) {
  38521. return [];
  38522. }
  38523. for (let i = 0; i <= ww; i++) {
  38524. const point = this.getMapStateByKey('unproject', [i, hh]);
  38525. const wrapNum = getWrapNum(point.lng);
  38526. const lngEdge = this.options.wrapX
  38527. ? wrapNum >= extent[0] && wrapNum <= extent[2]
  38528. : point.lng >= extent[0] && point.lng <= extent[2];
  38529. if (lngEdge && point.lat >= extent[1] && point.lat <= extent[3]) {
  38530. lngPoints.push([point.lng, i]);
  38531. lngCoordinates.push(point.lng);
  38532. if (firstLng === undefined && point.lng.toFixed(countDecimals) % _currLngInterval === 0) {
  38533. firstLng = Number(point.lng.toFixed(countDecimals));
  38534. }
  38535. }
  38536. }
  38537. const { first, last: lastLng, coordinates, points } = this._getIntersectRange(
  38538. firstLng,
  38539. lngCoordinates,
  38540. lngPoints,
  38541. _currLngInterval
  38542. );
  38543. firstLng = first;
  38544. return this._getClosestCoordinate(firstLng, lastLng, coordinates, points, _currLngInterval);
  38545. }
  38546. _getIntersectRange(first, coordinates, points, interval) {
  38547. let last = coordinates[coordinates.length - 1];
  38548. if (first > last) {
  38549. last = first;
  38550. coordinates.reverse();
  38551. points.reverse();
  38552. const countDecimals = this._countDecimals(interval);
  38553. for (let i = 0; i <= coordinates.length; i++) {
  38554. const point = coordinates[i];
  38555. if (point.toFixed(countDecimals) % interval === 0) {
  38556. first = Number(point.toFixed(countDecimals));
  38557. break;
  38558. }
  38559. }
  38560. }
  38561. return { first, last, coordinates, points };
  38562. }
  38563. _getClosestCoordinate(first, last, coordinates, points, interval) {
  38564. let result = [];
  38565. let graticule = first;
  38566. while (graticule <= last) {
  38567. const index = this._getClosestNumberIndex(graticule, coordinates);
  38568. const point = points[index];
  38569. result.push([Math.round(point[0]), point[1], true]);
  38570. graticule += interval;
  38571. coordinates = coordinates.slice(index);
  38572. points = points.slice(index);
  38573. }
  38574. return result;
  38575. }
  38576. _getClosestNumberIndex(num, arr) {
  38577. var index = 0;
  38578. var diffValue = Number.MAX_VALUE;
  38579. for (var i = 0; i < arr.length; i++) {
  38580. var newDiffValue = Math.abs(arr[i] - num);
  38581. if (newDiffValue <= diffValue) {
  38582. if (newDiffValue === diffValue && arr[i] < arr[index]) {
  38583. continue;
  38584. }
  38585. index = i;
  38586. diffValue = newDiffValue;
  38587. }
  38588. }
  38589. return index;
  38590. }
  38591. _getUniquePoint(points, intersectPoints, index = 0) {
  38592. if (this.options.wrapX) {
  38593. return points.concat(intersectPoints);
  38594. }
  38595. if (!intersectPoints || intersectPoints.length === 0) {
  38596. return points;
  38597. }
  38598. var tmp = intersectPoints;
  38599. const width = this.canvas.width;
  38600. const height = this.canvas.height;
  38601. for (var i in points) {
  38602. const edgePoint = this.getMapStateByKey('project', points[i]);
  38603. const intersetIndex = tmp.findIndex(item => item[0] === points[i][index]);
  38604. if (intersetIndex <= -1) {
  38605. tmp.push(points[i]);
  38606. } else if (
  38607. edgePoint &&
  38608. edgePoint.x >= 0 &&
  38609. edgePoint.x <= width &&
  38610. edgePoint.y >= 0 &&
  38611. edgePoint.y <= height
  38612. ) {
  38613. tmp[intersetIndex] = points[i];
  38614. }
  38615. }
  38616. return tmp;
  38617. }
  38618. _countDecimals(value) {
  38619. if (Math.floor(value) !== value) {
  38620. return value.toString().split('.')[1].length || 0;
  38621. }
  38622. return 0;
  38623. }
  38624. _getGraticuleFeatures() {
  38625. const _currLngInterval = this._currLngInterval || 10;
  38626. const _currLatInterval = this._currLatInterval || 10;
  38627. const features = [];
  38628. let { latRange, lngRange, firstLat, firstLng, lastLat, lastLng } = this._getRange();
  38629. if (this.options.wrapX && !this.oldExtent) {
  38630. latRange = [-90, 90];
  38631. lngRange = [-180, 180];
  38632. firstLat = firstLng = lastLat = lastLng = null;
  38633. }
  38634. if (typeof firstLng === 'number') {
  38635. features.unshift(this._makeLineFeature(this._makeLineCoords(firstLng, latRange, firstLat, lastLat)));
  38636. }
  38637. if (typeof lastLng === 'number') {
  38638. features.unshift(this._makeLineFeature(this._makeLineCoords(lastLng, latRange, firstLat, lastLat)));
  38639. }
  38640. for (var lng = lngRange[0]; lng <= lngRange[1]; lng += _currLngInterval) {
  38641. features.unshift(this._makeLineFeature(this._makeLineCoords(lng, latRange, firstLat, lastLat)));
  38642. }
  38643. if (typeof firstLat === 'number') {
  38644. features.unshift(this._makeLineFeature(this._makeLineCoords(firstLat, lngRange, firstLng, lastLng, 'lat')));
  38645. }
  38646. if (typeof lastLat === 'number') {
  38647. features.unshift(this._makeLineFeature(this._makeLineCoords(lastLat, lngRange, firstLng, lastLng, 'lat')));
  38648. }
  38649. for (var lat = latRange[0]; lat <= latRange[1]; lat += _currLatInterval) {
  38650. features.unshift(this._makeLineFeature(this._makeLineCoords(lat, lngRange, firstLng, lastLng, 'lat')));
  38651. }
  38652. return features;
  38653. }
  38654. _getRange(extent = this.options.extent && [...this.options.extent]) {
  38655. if (!extent || extent.length === 0) {
  38656. extent = this.getDefaultExtent();
  38657. }
  38658. extent = extent.map(item => {
  38659. return Number(item.toFixed(6));
  38660. });
  38661. const realExtent = {};
  38662. if (extent[1] % this._currLatInterval !== 0) {
  38663. realExtent.firstLat = extent[1];
  38664. const intNumber = Math.ceil(extent[1] / this._currLatInterval);
  38665. extent[1] = intNumber * this._currLatInterval;
  38666. }
  38667. if (extent[3] % this._currLatInterval !== 0) {
  38668. realExtent.lastLat = extent[3];
  38669. const intNumber = Math.floor(extent[3] / this._currLatInterval);
  38670. extent[3] = intNumber * this._currLatInterval;
  38671. }
  38672. if (extent[0] % this._currLngInterval !== 0) {
  38673. realExtent.firstLng = extent[0];
  38674. const intNumber = Math.ceil(extent[0] / this._currLngInterval);
  38675. extent[0] = intNumber * this._currLngInterval;
  38676. }
  38677. if (extent[2] % this._currLngInterval !== 0) {
  38678. realExtent.lastLng = extent[2];
  38679. const intNumber = Math.floor(extent[2] / this._currLngInterval);
  38680. extent[2] = intNumber * this._currLngInterval;
  38681. }
  38682. const result = Object.assign(
  38683. { latRange: [extent[1], extent[3]], lngRange: [extent[0], extent[2]], extent },
  38684. realExtent
  38685. );
  38686. return result;
  38687. }
  38688. _makeLineCoords(fixedDegree, range = [-90, 90], first, last, type = 'lng') {
  38689. fixedDegree = type === 'lng' ? this._lngFix(fixedDegree) : fixedDegree;
  38690. first = typeof first === 'number' ? first : range[0];
  38691. last = typeof last === 'number' ? last : range[1];
  38692. const interval = Math.abs(first - last);
  38693. const coords = [];
  38694. for (var changedDegree = first; changedDegree <= last; changedDegree += interval) {
  38695. if (type === 'lng') {
  38696. coords.push([fixedDegree, changedDegree]);
  38697. } else {
  38698. coords.push([changedDegree, fixedDegree]);
  38699. }
  38700. }
  38701. return coords;
  38702. }
  38703. _makeLineFeature(coordinates, type = 'LineString') {
  38704. return {
  38705. type: 'Feature',
  38706. geometry: {
  38707. type,
  38708. coordinates
  38709. }
  38710. };
  38711. }
  38712. _lngFix(lng) {
  38713. if (lng >= 180) {
  38714. return 180;
  38715. }
  38716. if (lng <= -180) {
  38717. return -180;
  38718. }
  38719. return lng;
  38720. }
  38721. _transformStrokeStyle(strokeStyle = this.options.strokeStyle) {
  38722. if (!strokeStyle || typeof strokeStyle === 'string') {
  38723. return { paint: { 'line-color': strokeStyle || 'rgba(0,0,0,0.2)' } };
  38724. }
  38725. const layout = {
  38726. visibility: this.visible ? 'visible' : 'none',
  38727. 'line-join': strokeStyle.lineJoin || 'round',
  38728. 'line-cap': strokeStyle.lineCap || 'round'
  38729. };
  38730. const paint = {
  38731. 'line-color': strokeStyle.lineColor || 'rgba(0,0,0,0.2)',
  38732. 'line-width': strokeStyle.lineWidth || 1,
  38733. 'line-offset': strokeStyle.lineDashOffset || 0,
  38734. 'line-translate-anchor': 'viewport'
  38735. };
  38736. if (strokeStyle.lineWidth) {
  38737. if (typeof strokeStyle.lineWidth === 'function') {
  38738. paint['line-width'] = strokeStyle.lineWidth(this.map);
  38739. } else {
  38740. paint['line-width'] = strokeStyle.lineWidth;
  38741. }
  38742. }
  38743. if (strokeStyle.lindDasharray) {
  38744. if (typeof strokeStyle.lindDasharray === 'function') {
  38745. paint['line-dasharray'] = strokeStyle.lindDasharray(this.map);
  38746. } else {
  38747. paint['line-dasharray'] = strokeStyle.lindDasharray;
  38748. }
  38749. }
  38750. return { layout, paint };
  38751. }
  38752. _setLabelStyle(ctx, labelStyle) {
  38753. if (labelStyle.textColor) {
  38754. ctx.fillStyle = labelStyle.textColor;
  38755. }
  38756. if (labelStyle.textSize) {
  38757. ctx.font = labelStyle.textSize + ' ' + (labelStyle.textFont || ['Calibri', 'sans-serif']).join(',');
  38758. }
  38759. if (labelStyle.textHaloColor) {
  38760. ctx.strokeStyle = labelStyle.textHaloColor;
  38761. ctx.lineWidth = labelStyle.textHaloWidth || 1;
  38762. }
  38763. if (labelStyle.textAnchor) {
  38764. ctx.textBaseline = this._getTxetBaseline(labelStyle.textAnchor);
  38765. ctx.textAligin = this._getTxetAlign(labelStyle.textAligin);
  38766. }
  38767. return ctx;
  38768. }
  38769. _getTxetBaseline(textAnchor) {
  38770. if (!textAnchor) {
  38771. return 'bottom';
  38772. }
  38773. const textStyle = textAnchor.split('-');
  38774. if (textStyle.includes('bottom')) {
  38775. return 'bottom';
  38776. }
  38777. if (textStyle.includes('top')) {
  38778. return 'top';
  38779. }
  38780. if (textStyle.includes('center')) {
  38781. return 'middle';
  38782. }
  38783. }
  38784. _getTxetAlign(textAnchor) {
  38785. if (!textAnchor) {
  38786. return 'center';
  38787. }
  38788. const textStyle = textAnchor.split('-');
  38789. if (textStyle.includes('left')) {
  38790. return 'left';
  38791. }
  38792. if (textStyle.includes('right')) {
  38793. return 'right';
  38794. }
  38795. if (textStyle.includes('center')) {
  38796. return 'center';
  38797. }
  38798. }
  38799. }
  38800. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/GraticuleLayer.js
  38801. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38802. * This program are made available under the terms of the Apache License, Version 2.0
  38803. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38804. /**
  38805. * reference and modification
  38806. * dereklieu/cool-grid, cloudybay/leaflet.latlng-graticule
  38807. * (https://github.com/dereklieu/cool-grid, https://github.com/cloudybay/leaflet.latlng-graticule)
  38808. * Apache Licene 2.0
  38809. * thanks dereklieu, cloudybay
  38810. */
  38811. /**
  38812. * @class GraticuleLayer
  38813. * @category Visualization GraticuleLayer
  38814. * @classdesc 经纬网类。
  38815. * @modulecategory Overlay
  38816. * @version 10.1.1
  38817. * @param {Object} options - 参数。
  38818. * @param {string} [options.layerID] - 图层 ID。默认使用 CommonUtil.createUniqueID("graticuleLayer_") 创建图层 ID。
  38819. * @param {boolean} [options.visible=true] - 是否显示经纬网。
  38820. * @param {boolean} [options.showLabel=true] - 是否显示标签。
  38821. * @param {number} [options.opacity=1] - 画布不透明度。
  38822. * @param {number|function} [options.interval = 10] - 经纬度的间隔(以度为单位),可以是数字,也可以是函数,参数是map。
  38823. * @param {mapboxgl.LngLatBounds} [options.extent] - 经纬网渲染的边界范围([minx, miny, maxx, maxy]),不传为整个地图范围。
  38824. * @param {number} [options.minZoom] - 最小视图缩放级别(不包括此级别),在该级别之上,该层将可见。
  38825. * @param {number} [options.maxZoom] - 该图层可见的最大视图缩放级别(含)。
  38826. * @param {function} [options.lngLabelFormatter = null] - 经度标签转换函数。
  38827. * @param {function} [options.latLabelFormatter = null] - 纬度标签转换函数。
  38828. * @param {GraticuleLayer.LabelStyle} [options.lngLabelStyle] - 经度标签样式。
  38829. * @param {GraticuleLayer.LabelStyle} [options.latLabelStyle] - 纬度标签样式。
  38830. * @param {GraticuleLayer.StrokeStyle} [options.strokeStyle] - 绘制经纬线的样式。
  38831. * @usage
  38832. */
  38833. /**
  38834. * @typedef {Object} GraticuleLayer.LabelStyle - 标签样式。
  38835. * @property {Array.<string>} [textFont = ['Calibri','sans-serif']] - 字体样式。
  38836. * @property {string} [textSize = '12px'] - 字体大小。
  38837. * @property {string} [textColor ='rgba(0,0,0,1)'] - 字体颜色。
  38838. * @property {string} [textHaloColor ='rgba(255,255,255,1)'] - 描边颜色。
  38839. * @property {number} [textHaloWidth = 1] - 描边宽度。
  38840. * @property {string} [textAnchor = 'bottom'] - 字体基线: "center", "left", "right", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"。
  38841. */
  38842. /**
  38843. * @typedef {Object} GraticuleLayer.StrokeStyle - 线样式。
  38844. * @property {string} [lineColor = 'red'] - 线颜色。
  38845. * @property {string} [lineCap = 'round'] - 线端点风格:butt, round, square。
  38846. * @property {string} [lineJoin = round] - 线连接样式:bevel, round, miter。
  38847. * @property {Array.<number>} [lindDasharray = [0.5,4]] - 虚线样式。
  38848. * @property {number} [lineWidth = 1] - 线宽。
  38849. */
  38850. const GraticuleLayer_defaultTextStyle = {
  38851. textSize: '12px',
  38852. textFont: ['12px Calibri', 'sans-serif'],
  38853. textAnchor: 'bottom',
  38854. textColor: 'rgba(0,0,0,1)',
  38855. textHaloColor: 'rgba(255,255,255,1)',
  38856. textHaloWidth: 1
  38857. };
  38858. const GraticuleLayer_defaultStrokeStyle = {
  38859. lineColor: 'red',
  38860. lineCap: 'round', // butt, round, square
  38861. lineJoin: 'round', // bevel, round, miter
  38862. lindDasharray: [0.4, 5], // 数组|function
  38863. lineDashOffset: 0,
  38864. lineWidth: 1 // 数字|function
  38865. };
  38866. const GraticuleLayer_defaultOptions = {
  38867. showLabel: true,
  38868. opacity: 1,
  38869. visible: true,
  38870. interval: 10, // function|number
  38871. extent: null,
  38872. minZoom: 0,
  38873. maxZoom: 50,
  38874. wrapX: true,
  38875. strokeStyle: GraticuleLayer_defaultStrokeStyle,
  38876. lngLabelFormatter: null,
  38877. latLabelFormatter: null,
  38878. lngLabelStyle: GraticuleLayer_defaultTextStyle,
  38879. latLabelStyle: GraticuleLayer_defaultTextStyle
  38880. };
  38881. class GraticuleLayer {
  38882. constructor(options) {
  38883. this.id = options && options.layerID ? options.layerID : Util_Util.createUniqueID('graticuleLayer_');
  38884. this.sourceId = this.id + '_line';
  38885. options = options || {};
  38886. options.strokeStyle = Object.assign({}, GraticuleLayer_defaultStrokeStyle, options.strokeStyle || {});
  38887. options.lngLabelStyle = Object.assign({}, GraticuleLayer_defaultTextStyle, options.lngLabelStyle || {});
  38888. options.latLabelStyle = Object.assign({}, GraticuleLayer_defaultTextStyle, options.latLabelStyle || {});
  38889. this.options = Object.assign({}, GraticuleLayer_defaultOptions, options);
  38890. this.type = 'custom';
  38891. this.renderingMode = '3d';
  38892. this.overlay = true;
  38893. this.styleDataEevent = this._setLayerTop.bind(this);
  38894. }
  38895. onAdd(map) {
  38896. this.map = map;
  38897. this.renderer = new GraticuleLayerRenderer(this.map, this.options, {
  38898. getMapStateByKey: this.getMapStateByKey,
  38899. getDefaultExtent: this.getDefaultExtent,
  38900. updateGraticuleLayer: this.updateGraticuleLayer.bind(this),
  38901. setVisibility: this.setVisibility.bind(this)
  38902. }, {
  38903. mapElement: this.map.getCanvas(),
  38904. targetElement: this.map.getCanvasContainer(),
  38905. id: this.id
  38906. });
  38907. this.addGraticuleLayer();
  38908. this.resizeEvent = this.renderer._resizeCallback.bind(this.renderer);
  38909. this.zoomendEvent = this.setVisibility.bind(this);
  38910. this._bindEvent()
  38911. }
  38912. onRemove() {
  38913. this.renderer.onRemove();
  38914. this._unbindEvent();
  38915. }
  38916. render() {
  38917. this.renderer.draw();
  38918. }
  38919. getMapStateByKey(key, params) {
  38920. if (key === 'getBearing') {
  38921. return this.map.getBearing();
  38922. } else if (key === 'getBounds') {
  38923. return this.map.getBounds();
  38924. } else if (key === 'project') {
  38925. return this.map.project(params);
  38926. } else if(key === 'unproject') {
  38927. return this.map.unproject(params);
  38928. }
  38929. }
  38930. /**
  38931. * @function GraticuleLayer.prototype.setVisibility
  38932. * @description 设置可见性。
  38933. * @param {boolean} visible - 是否可见。
  38934. */
  38935. setVisibility(visible) {
  38936. const zoom = this.map && this.map.getZoom();
  38937. this.options.visible = typeof visible === 'boolean' ? visible : this.options.visible;
  38938. this.visible =
  38939. typeof visible === 'boolean'
  38940. ? visible
  38941. : this.options.visible && zoom >= this.options.minZoom && zoom <= this.options.maxZoom;
  38942. if (this.renderer) {
  38943. this.renderer.visible = this.visible;
  38944. }
  38945. if (this.map.getLayer(this.sourceId)) {
  38946. this.map.setLayoutProperty(this.sourceId, 'visibility', this.visible ? 'visible' : 'none');
  38947. }
  38948. this.renderer && this.renderer._drawLabel();
  38949. }
  38950. /**
  38951. * @function GraticuleLayer.prototype.setMinZoom
  38952. * @description 设置最小视图缩放级别。
  38953. * @param {number} minZoom - 最小视图缩放级别(不包括此级别),在该级别之上,该层将可见。
  38954. */
  38955. setMinZoom(minZoom) {
  38956. this.options.minZoom = minZoom;
  38957. this.setVisibility();
  38958. }
  38959. /**
  38960. * @function GraticuleLayer.prototype.setMaxZoom
  38961. * @description 该图层可见的最大视图缩放级别。
  38962. * @param {number} maxZoom - 该图层可见的最大视图缩放级别(含)。
  38963. */
  38964. setMaxZoom(maxZoom) {
  38965. this.options.maxZoom = maxZoom;
  38966. this.setVisibility();
  38967. }
  38968. /**
  38969. * @function GraticuleLayer.prototype.setShowLabel
  38970. * @description 设置显示标签。
  38971. * @param {boolean} showLabel - 是否显示标签。
  38972. */
  38973. setShowLabel(showLabel) {
  38974. this.options.showLabel = showLabel;
  38975. this.renderer._drawLabel();
  38976. }
  38977. /**
  38978. * @function GraticuleLayer.prototype.setExtent
  38979. * @description 设置经纬网渲染的边界范围。
  38980. * @param {mapboxgl.LngLatBounds} extent - 经纬网渲染的边界范围。
  38981. */
  38982. setExtent(extent) {
  38983. this.options.extent = this.getDefaultExtent(extent, this.map);
  38984. // this.features = this._getGraticuleFeatures();
  38985. this.updateGraticuleLayer();
  38986. this.renderer._drawLabel();
  38987. }
  38988. /**
  38989. * @function GraticuleLayer.prototype.setStrokeStyle
  38990. * @description 设置经纬线样式。
  38991. * @param {GraticuleLayer.StrokeStyle} strokeStyle - 经纬线样式。
  38992. */
  38993. setStrokeStyle(strokeStyle) {
  38994. if (!this.map || !this.map.getLayer(this.sourceId)) {
  38995. return;
  38996. }
  38997. this.options.strokeStyle = strokeStyle;
  38998. const { layout, paint } = this.renderer._transformStrokeStyle(strokeStyle);
  38999. for (let key in layout) {
  39000. this.map.setLayoutProperty(this.sourceId, key, layout[key]);
  39001. }
  39002. for (let key in paint) {
  39003. this.map.setPaintProperty(this.sourceId, key, paint[key]);
  39004. }
  39005. }
  39006. /**
  39007. * @function GraticuleLayer.prototype.setLngLabelStyle
  39008. * @description 设置经度标签样式。
  39009. * @param {GraticuleLayer.LabelStyle} labelStyle - 标签样式。
  39010. */
  39011. setLngLabelStyle(labelStyle) {
  39012. this.options.lngLabelStyle = labelStyle;
  39013. this.renderer._drawLabel();
  39014. }
  39015. /**
  39016. * @function GraticuleLayer.prototype.setLatLabelStyle
  39017. * @description 设置纬度标签样式。
  39018. * @param {GraticuleLayer.LabelStyle} labelStyle - 标签样式。
  39019. */
  39020. setLatLabelStyle(labelStyle) {
  39021. this.options.latLabelStyle = labelStyle;
  39022. this.renderer._drawLabel();
  39023. }
  39024. /**
  39025. * @function GraticuleLayer.prototype.setIntervals
  39026. * @description 设置经纬度的间隔(以度为单位)。
  39027. * @param {number|function} interval - 经纬度的间隔(以度为单位),可以是数字,也可以是函数,参数是map。
  39028. */
  39029. setIntervals(interval) {
  39030. if (this.renderer) {
  39031. this.renderer.setIntervals(interval);
  39032. }
  39033. }
  39034. getDefaultExtent(extent, map = this.map) {
  39035. const crs = (map.getCRS && map.getCRS()) || {};
  39036. let { extent: crsExtent } = crs;
  39037. if (!crsExtent) {
  39038. crsExtent = [-180, -85.05119, 180, 85.05119];
  39039. }
  39040. if (!extent || extent.length === 0) {
  39041. return crsExtent;
  39042. }
  39043. const { _sw, _ne } = external_mapboxgl_default().LngLatBounds.convert(extent);
  39044. extent = [_sw.lng, _sw.lat, _ne.lng, _ne.lat];
  39045. extent = [
  39046. Math.max(crsExtent[0], extent[0]),
  39047. Math.max(crsExtent[1], extent[1]),
  39048. Math.min(crsExtent[2], extent[2]),
  39049. Math.min(crsExtent[3], extent[3])
  39050. ];
  39051. return extent;
  39052. }
  39053. addGraticuleLayer() {
  39054. if (!this.map.getSource(this.sourceId)) {
  39055. const source = {
  39056. type: 'geojson',
  39057. data: {
  39058. type: 'FeatureCollection',
  39059. features: this.renderer.features
  39060. }
  39061. };
  39062. this.map.addSource(this.sourceId, source);
  39063. }
  39064. if (!this.map.getLayer(this.sourceId)) {
  39065. const layer = Object.assign(
  39066. { id: this.sourceId, type: 'line', source: this.sourceId },
  39067. this.renderer._transformStrokeStyle()
  39068. );
  39069. this.map.addLayer(layer);
  39070. }
  39071. }
  39072. _getLatPoints(lngRange, firstLng, lastLng, features) {
  39073. return this.renderer._getLatPoints(lngRange, firstLng, lastLng, features);
  39074. }
  39075. _bindEvent() {
  39076. this.map.on('styledata', this.styleDataEevent);
  39077. this.map.on('resize', this.resizeEvent);
  39078. this.map.on('zoomend', this.zoomendEvent);
  39079. }
  39080. _unbindEvent() {
  39081. this.map.off('styledata', this.styleDataEevent);
  39082. this.map.off('resize', this.resizeEvent);
  39083. this.map.off('zoomend', this.zoomendEvent);
  39084. }
  39085. _setLayerTop() {
  39086. const map = this.map;
  39087. if (!map) {
  39088. return;
  39089. }
  39090. const layersOnMap = map.getStyle && map.getStyle().layers;
  39091. if (
  39092. layersOnMap &&
  39093. layersOnMap.length &&
  39094. layersOnMap.findIndex(item => item.id === this.sourceId) !== layersOnMap.length - 1
  39095. ) {
  39096. if (map.getLayer(this.sourceId)) {
  39097. map.removeLayer(this.sourceId);
  39098. this.addGraticuleLayer();
  39099. }
  39100. }
  39101. }
  39102. updateGraticuleLayer(features = this.features) {
  39103. if (this.map.getSource(this.sourceId)) {
  39104. const geoJSONData = {
  39105. type: 'FeatureCollection',
  39106. features
  39107. };
  39108. this.map.getSource(this.sourceId).setData(geoJSONData);
  39109. }
  39110. this.addGraticuleLayer();
  39111. }
  39112. }
  39113. // EXTERNAL MODULE: ./node_modules/promise-polyfill/dist/polyfill.js
  39114. var polyfill = __webpack_require__(107);
  39115. // EXTERNAL MODULE: ./node_modules/fetch-ie8/fetch.js
  39116. var fetch_ie8_fetch = __webpack_require__(693);
  39117. // EXTERNAL MODULE: ./node_modules/fetch-jsonp/build/fetch-jsonp.js
  39118. var fetch_jsonp = __webpack_require__(144);
  39119. var fetch_jsonp_default = /*#__PURE__*/__webpack_require__.n(fetch_jsonp);
  39120. ;// CONCATENATED MODULE: ./src/common/util/FetchRequest.js
  39121. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39122. * This program are made available under the terms of the Apache License, Version 2.0
  39123. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39124. let FetchRequest_fetch = window.fetch;
  39125. var setFetch = function (newFetch) {
  39126. FetchRequest_fetch = newFetch;
  39127. }
  39128. var RequestJSONPPromise = {
  39129. limitLength: 1500,
  39130. queryKeys: [],
  39131. queryValues: [],
  39132. supermap_callbacks: {},
  39133. addQueryStrings: function (values) {
  39134. var me = this;
  39135. for (var key in values) {
  39136. me.queryKeys.push(key);
  39137. if (typeof values[key] !== 'string') {
  39138. values[key] = Util_Util.toJSON(values[key]);
  39139. }
  39140. var tempValue = encodeURIComponent(values[key]);
  39141. me.queryValues.push(tempValue);
  39142. }
  39143. },
  39144. issue: function (config) {
  39145. var me = this,
  39146. uid = me.getUid(),
  39147. url = config.url,
  39148. splitQuestUrl = [];
  39149. // me.addQueryStrings({
  39150. // callback: "RequestJSONPPromise.supermap_callbacks[" + uid + "]"
  39151. // });
  39152. var sectionURL = url,
  39153. keysCount = 0; //此次sectionURL中有多少个key
  39154. var length = me.queryKeys ? me.queryKeys.length : 0;
  39155. for (var i = 0; i < length; i++) {
  39156. if (sectionURL.length + me.queryKeys[i].length + 2 >= me.limitLength) {
  39157. //+2 for ("&"or"?")and"="
  39158. if (keysCount == 0) {
  39159. return false;
  39160. }
  39161. splitQuestUrl.push(sectionURL);
  39162. sectionURL = url;
  39163. keysCount = 0;
  39164. i--;
  39165. } else {
  39166. if (sectionURL.length + me.queryKeys[i].length + 2 + me.queryValues[i].length > me.limitLength) {
  39167. var leftValue = me.queryValues[i];
  39168. while (leftValue.length > 0) {
  39169. var leftLength = me.limitLength - sectionURL.length - me.queryKeys[i].length - 2; //+2 for ("&"or"?")and"="
  39170. if (sectionURL.indexOf('?') > -1) {
  39171. sectionURL += '&';
  39172. } else {
  39173. sectionURL += '?';
  39174. }
  39175. var tempLeftValue = leftValue.substring(0, leftLength);
  39176. //避免 截断sectionURL时,将类似于%22这样的符号截成两半,从而导致服务端组装sectionURL时发生错误
  39177. if (tempLeftValue.substring(leftLength - 1, leftLength) === '%') {
  39178. leftLength -= 1;
  39179. tempLeftValue = leftValue.substring(0, leftLength);
  39180. } else if (tempLeftValue.substring(leftLength - 2, leftLength - 1) === '%') {
  39181. leftLength -= 2;
  39182. tempLeftValue = leftValue.substring(0, leftLength);
  39183. }
  39184. sectionURL += me.queryKeys[i] + '=' + tempLeftValue;
  39185. leftValue = leftValue.substring(leftLength);
  39186. if (tempLeftValue.length > 0) {
  39187. splitQuestUrl.push(sectionURL);
  39188. sectionURL = url;
  39189. keysCount = 0;
  39190. }
  39191. }
  39192. } else {
  39193. keysCount++;
  39194. if (sectionURL.indexOf('?') > -1) {
  39195. sectionURL += '&';
  39196. } else {
  39197. sectionURL += '?';
  39198. }
  39199. sectionURL += me.queryKeys[i] + '=' + me.queryValues[i];
  39200. }
  39201. }
  39202. }
  39203. splitQuestUrl.push(sectionURL);
  39204. return me.send(
  39205. splitQuestUrl,
  39206. 'SuperMapJSONPCallbacks_' + uid,
  39207. config && config.proxy
  39208. );
  39209. },
  39210. getUid: function () {
  39211. var uid = new Date().getTime(),
  39212. random = Math.floor(Math.random() * 1e17);
  39213. return uid * 1000 + random;
  39214. },
  39215. send: function (splitQuestUrl, callback, proxy) {
  39216. var len = splitQuestUrl.length;
  39217. if (len > 0) {
  39218. return new Promise((resolve) => {
  39219. var jsonpUserID = new Date().getTime();
  39220. for (var i = 0; i < len; i++) {
  39221. var url = splitQuestUrl[i];
  39222. if (url.indexOf('?') > -1) {
  39223. url += '&';
  39224. } else {
  39225. url += '?';
  39226. }
  39227. url += 'sectionCount=' + len;
  39228. url += '&sectionIndex=' + i;
  39229. url += '&jsonpUserID=' + jsonpUserID;
  39230. if (proxy) {
  39231. url = decodeURIComponent(url);
  39232. url = proxy + encodeURIComponent(url);
  39233. }
  39234. fetch_jsonp_default()(url, {
  39235. jsonpCallbackFunction: callback,
  39236. timeout: 30000
  39237. }).then((result) => {
  39238. resolve(result.json());
  39239. });
  39240. }
  39241. })
  39242. }
  39243. },
  39244. GET: function (config) {
  39245. var me = this;
  39246. me.queryKeys.length = 0;
  39247. me.queryValues.length = 0;
  39248. me.addQueryStrings(config.params);
  39249. return me.issue(config);
  39250. },
  39251. POST: function (config) {
  39252. var me = this;
  39253. me.queryKeys.length = 0;
  39254. me.queryValues.length = 0;
  39255. me.addQueryStrings({
  39256. requestEntity: config.data
  39257. });
  39258. return me.issue(config);
  39259. },
  39260. PUT: function (config) {
  39261. var me = this;
  39262. me.queryKeys.length = 0;
  39263. me.queryValues.length = 0;
  39264. me.addQueryStrings({
  39265. requestEntity: config.data
  39266. });
  39267. return me.issue(config);
  39268. },
  39269. DELETE: function (config) {
  39270. var me = this;
  39271. me.queryKeys.length = 0;
  39272. me.queryValues.length = 0;
  39273. me.addQueryStrings({
  39274. requestEntity: config.data
  39275. });
  39276. return me.issue(config);
  39277. }
  39278. };
  39279. var CORS;
  39280. var RequestTimeout;
  39281. /**
  39282. * @function setCORS
  39283. * @description 设置是否允许跨域请求,全局配置,优先级低于 service 下的 crossOring 参数。
  39284. * @category BaseTypes Util
  39285. * @param {boolean} cors - 是否允许跨域请求。
  39286. * @usage
  39287. * ```
  39288. * // 浏览器
  39289. * <script type="text/javascript" src="{cdn}"></script>
  39290. * <script>
  39291. * {namespace}.setCORS(cors);
  39292. *
  39293. * // 弃用的写法
  39294. * SuperMap.setCORS(cors);
  39295. *
  39296. * </script>
  39297. *
  39298. * // ES6 Import
  39299. * import { setCORS } from '{npm}';
  39300. *
  39301. * setCORS(cors);
  39302. * ```
  39303. */
  39304. var setCORS = function (cors) {
  39305. CORS = cors;
  39306. }
  39307. /**
  39308. * @function isCORS
  39309. * @description 是是否允许跨域请求。
  39310. * @category BaseTypes Util
  39311. * @returns {boolean} 是否允许跨域请求。
  39312. * @usage
  39313. * ```
  39314. * // 浏览器
  39315. * <script type="text/javascript" src="{cdn}"></script>
  39316. * <script>
  39317. * const result = {namespace}.isCORS();
  39318. *
  39319. * // 弃用的写法
  39320. * const result = SuperMap.isCORS();
  39321. *
  39322. * </script>
  39323. *
  39324. * // ES6 Import
  39325. * import { isCORS } from '{npm}';
  39326. *
  39327. * const result = isCORS();
  39328. * ```
  39329. */
  39330. var isCORS = function () {
  39331. if (CORS != undefined) {
  39332. return CORS;
  39333. }
  39334. return window.XMLHttpRequest && 'withCredentials' in new window.XMLHttpRequest();
  39335. }
  39336. /**
  39337. * @function setRequestTimeout
  39338. * @category BaseTypes Util
  39339. * @description 设置请求超时时间。
  39340. * @param {number} [timeout=45] - 请求超时时间,单位秒。
  39341. * @usage
  39342. * ```
  39343. * // 浏览器
  39344. <script type="text/javascript" src="{cdn}"></script>
  39345. <script>
  39346. {namespace}.setRequestTimeout(timeout);
  39347. // 弃用的写法
  39348. SuperMap.setRequestTimeout(timeout);
  39349. </script>
  39350. // ES6 Import
  39351. import { setRequestTimeout } from '{npm}';
  39352. setRequestTimeout(timeout);
  39353. * ```
  39354. */
  39355. var setRequestTimeout = function (timeout) {
  39356. return RequestTimeout = timeout;
  39357. }
  39358. /**
  39359. * @function getRequestTimeout
  39360. * @category BaseTypes Util
  39361. * @description 获取请求超时时间。
  39362. * @returns {number} 请求超时时间。
  39363. * @usage
  39364. * ```
  39365. * // 浏览器
  39366. <script type="text/javascript" src="{cdn}"></script>
  39367. <script>
  39368. {namespace}.getRequestTimeout();
  39369. // 弃用的写法
  39370. SuperMap.getRequestTimeout();
  39371. </script>
  39372. // ES6 Import
  39373. import { getRequestTimeout } from '{npm}';
  39374. getRequestTimeout();
  39375. * ```
  39376. */
  39377. var getRequestTimeout = function () {
  39378. return RequestTimeout || 45000;
  39379. }
  39380. /**
  39381. * @name FetchRequest
  39382. * @namespace
  39383. * @category BaseTypes Util
  39384. * @description 获取请求。
  39385. * @usage
  39386. * ```
  39387. * // 浏览器
  39388. * <script type="text/javascript" src="{cdn}"></script>
  39389. * <script>
  39390. * const result = {namespace}.FetchRequest.commit(method, url, params, options);
  39391. *
  39392. * </script>
  39393. *
  39394. * // ES6 Import
  39395. * import { FetchRequest } from '{npm}';
  39396. *
  39397. * const result = FetchRequest.commit(method, url, params, options);
  39398. *
  39399. * ```
  39400. */
  39401. var FetchRequest = {
  39402. /**
  39403. * @function FetchRequest.commit
  39404. * @description commit 请求。
  39405. * @param {string} method - 请求方法。
  39406. * @param {string} url - 请求地址。
  39407. * @param {string} params - 请求参数。
  39408. * @param {Object} options - 请求的配置属性。
  39409. * @returns {Promise} Promise 对象。
  39410. */
  39411. commit: function (method, url, params, options) {
  39412. method = method ? method.toUpperCase() : method;
  39413. switch (method) {
  39414. case 'GET':
  39415. return this.get(url, params, options);
  39416. case 'POST':
  39417. return this.post(url, params, options);
  39418. case 'PUT':
  39419. return this.put(url, params, options);
  39420. case 'DELETE':
  39421. return this.delete(url, params, options);
  39422. default:
  39423. return this.get(url, params, options);
  39424. }
  39425. },
  39426. /**
  39427. * @function FetchRequest.supportDirectRequest
  39428. * @description supportDirectRequest 请求。
  39429. * @param {string} url - 请求地址。
  39430. * @param {Object} options - 请求的配置属性。
  39431. * @returns {boolean} 是否允许跨域请求。
  39432. */
  39433. supportDirectRequest: function (url, options) {
  39434. if (Util_Util.isInTheSameDomain(url)) {
  39435. return true;
  39436. }
  39437. if (options.crossOrigin != undefined) {
  39438. return options.crossOrigin;
  39439. } else {
  39440. return isCORS() || options.proxy;
  39441. }
  39442. },
  39443. /**
  39444. * @function FetchRequest.get
  39445. * @description get 请求。
  39446. * @param {string} url - 请求地址。
  39447. * @param {string} params - 请求参数。
  39448. * @param {Object} options - 请求的配置属性。
  39449. * @returns {Promise} Promise 对象。
  39450. */
  39451. get: function (url, params, options) {
  39452. options = options || {};
  39453. var type = 'GET';
  39454. url = Util_Util.urlAppend(url, this._getParameterString(params || {}));
  39455. url = this._processUrl(url, options);
  39456. if (!this.supportDirectRequest(url, options)) {
  39457. url = url.replace('.json', '.jsonp');
  39458. var config = {
  39459. url: url,
  39460. data: params
  39461. };
  39462. return RequestJSONPPromise.GET(config);
  39463. }
  39464. if (!this.urlIsLong(url)) {
  39465. return this._fetch(url, params, options, type);
  39466. } else {
  39467. return this._postSimulatie(type, url.substring(0, url.indexOf('?')), params, options);
  39468. }
  39469. },
  39470. /**
  39471. * @function FetchRequest.delete
  39472. * @description delete 请求。
  39473. * @param {string} url - 请求地址。
  39474. * @param {string} params - 请求参数。
  39475. * @param {Object} options -请求的配置属性。
  39476. * @returns {Promise} Promise 对象。
  39477. */
  39478. delete: function (url, params, options) {
  39479. options = options || {};
  39480. var type = 'DELETE';
  39481. url = Util_Util.urlAppend(url, this._getParameterString(params || {}));
  39482. url = this._processUrl(url, options);
  39483. if (!this.supportDirectRequest(url, options)) {
  39484. url = url.replace('.json', '.jsonp');
  39485. var config = {
  39486. url: url += "&_method=DELETE",
  39487. data: params
  39488. };
  39489. return RequestJSONPPromise.DELETE(config);
  39490. }
  39491. if (this.urlIsLong(url)) {
  39492. return this._postSimulatie(type, url.substring(0, url.indexOf('?')), params, options);
  39493. }
  39494. return this._fetch(url, params, options, type);
  39495. },
  39496. /**
  39497. * @function FetchRequest.post
  39498. * @description post 请求。
  39499. * @param {string} url - 请求地址。
  39500. * @param {string} params - 请求参数。
  39501. * @param {Object} options - 请求的配置属性。
  39502. * @returns {Promise} Promise 对象。
  39503. */
  39504. post: function (url, params, options) {
  39505. options = options || {};
  39506. url = this._processUrl(url, options);
  39507. if (!this.supportDirectRequest(url, options)) {
  39508. url = url.replace('.json', '.jsonp');
  39509. var config = {
  39510. url: Util_Util.urlAppend(url, "_method=POST"),
  39511. data: params
  39512. };
  39513. return RequestJSONPPromise.POST(config);
  39514. }
  39515. return this._fetch(url, params, options, 'POST');
  39516. },
  39517. /**
  39518. * @function FetchRequest.put
  39519. * @description put 请求。
  39520. * @param {string} url - 请求地址。
  39521. * @param {string} params - 请求参数。
  39522. * @param {Object} options - 请求的配置属性。
  39523. * @returns {Promise} Promise 对象。
  39524. */
  39525. put: function (url, params, options) {
  39526. options = options || {};
  39527. url = this._processUrl(url, options);
  39528. if (!this.supportDirectRequest(url, options)) {
  39529. url = url.replace('.json', '.jsonp');
  39530. var config = {
  39531. url: url += "&_method=PUT",
  39532. data: params
  39533. };
  39534. return RequestJSONPPromise.PUT(config);
  39535. }
  39536. return this._fetch(url, params, options, 'PUT');
  39537. },
  39538. /**
  39539. * @function FetchRequest.urlIsLong
  39540. * @description URL 的字节长度是否太长。
  39541. * @param {string} url - 请求地址。
  39542. * @returns {boolean} URL 的字节长度是否太长。
  39543. */
  39544. urlIsLong: function (url) {
  39545. //当前url的字节长度。
  39546. var totalLength = 0,
  39547. charCode = null;
  39548. for (var i = 0, len = url.length; i < len; i++) {
  39549. //转化为Unicode编码
  39550. charCode = url.charCodeAt(i);
  39551. if (charCode < 0x007f) {
  39552. totalLength++;
  39553. } else if ((0x0080 <= charCode) && (charCode <= 0x07ff)) {
  39554. totalLength += 2;
  39555. } else if ((0x0800 <= charCode) && (charCode <= 0xffff)) {
  39556. totalLength += 3;
  39557. }
  39558. }
  39559. return totalLength < 2000 ? false : true;
  39560. },
  39561. _postSimulatie: function (type, url, params, options) {
  39562. var separator = url.indexOf('?') > -1 ? '&' : '?';
  39563. url += separator + '_method=' + type;
  39564. if (typeof params !== 'string') {
  39565. params = JSON.stringify(params);
  39566. }
  39567. return this.post(url, params, options);
  39568. },
  39569. _processUrl: function (url, options) {
  39570. if (this._isMVTRequest(url)) {
  39571. return url;
  39572. }
  39573. if (url.indexOf('.json') === -1 && !options.withoutFormatSuffix) {
  39574. if (url.indexOf('?') < 0) {
  39575. url += '.json';
  39576. } else {
  39577. var urlArrays = url.split('?');
  39578. if (urlArrays.length === 2) {
  39579. url = urlArrays[0] + '.json?' + urlArrays[1];
  39580. }
  39581. }
  39582. }
  39583. if (options && options.proxy) {
  39584. if (typeof options.proxy === 'function') {
  39585. url = options.proxy(url);
  39586. } else {
  39587. url = decodeURIComponent(url);
  39588. url = options.proxy + encodeURIComponent(url);
  39589. }
  39590. }
  39591. return url;
  39592. },
  39593. _fetch: function (url, params, options, type) {
  39594. options = options || {};
  39595. options.headers = options.headers || {};
  39596. if (!options.headers['Content-Type'] && !FormData.prototype.isPrototypeOf(params)) {
  39597. options.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
  39598. }
  39599. if (options.timeout) {
  39600. return this._timeout(
  39601. options.timeout,
  39602. FetchRequest_fetch(url, {
  39603. method: type,
  39604. headers: options.headers,
  39605. body: type === 'PUT' || type === 'POST' ? params : undefined,
  39606. credentials: this._getWithCredentials(options),
  39607. mode: 'cors',
  39608. timeout: getRequestTimeout()
  39609. }).then(function (response) {
  39610. return response;
  39611. })
  39612. );
  39613. }
  39614. return FetchRequest_fetch(url, {
  39615. method: type,
  39616. body: type === 'PUT' || type === 'POST' ? params : undefined,
  39617. headers: options.headers,
  39618. credentials: this._getWithCredentials(options),
  39619. mode: 'cors',
  39620. timeout: getRequestTimeout()
  39621. }).then(function (response) {
  39622. return response;
  39623. });
  39624. },
  39625. _getWithCredentials: function (options) {
  39626. if (options.withCredentials === true) {
  39627. return 'include';
  39628. }
  39629. if (options.withCredentials === false) {
  39630. return 'omit';
  39631. }
  39632. return 'same-origin';
  39633. },
  39634. _fetchJsonp: function (url, options) {
  39635. options = options || {};
  39636. return fetch_jsonp_default()(url, {
  39637. method: 'GET',
  39638. timeout: options.timeout
  39639. }).then(function (response) {
  39640. return response;
  39641. });
  39642. },
  39643. _timeout: function (seconds, promise) {
  39644. return new Promise(function (resolve, reject) {
  39645. setTimeout(function () {
  39646. reject(new Error('timeout'));
  39647. }, seconds);
  39648. promise.then(resolve, reject);
  39649. });
  39650. },
  39651. _getParameterString: function (params) {
  39652. var paramsArray = [];
  39653. for (var key in params) {
  39654. var value = params[key];
  39655. if (value != null && typeof value !== 'function') {
  39656. var encodedValue;
  39657. if (Array.isArray(value) || value.toString() === '[object Object]') {
  39658. encodedValue = encodeURIComponent(JSON.stringify(value));
  39659. } else {
  39660. encodedValue = encodeURIComponent(value);
  39661. }
  39662. paramsArray.push(encodeURIComponent(key) + '=' + encodedValue);
  39663. }
  39664. }
  39665. return paramsArray.join('&');
  39666. },
  39667. _isMVTRequest: function (url) {
  39668. return url.indexOf('.mvt') > -1 || url.indexOf('.pbf') > -1;
  39669. }
  39670. }
  39671. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/geometry-type.js
  39672. var geometry_type_GeometryType;
  39673. (function (GeometryType) {
  39674. GeometryType[GeometryType["Unknown"] = 0] = "Unknown";
  39675. GeometryType[GeometryType["Point"] = 1] = "Point";
  39676. GeometryType[GeometryType["LineString"] = 2] = "LineString";
  39677. GeometryType[GeometryType["Polygon"] = 3] = "Polygon";
  39678. GeometryType[GeometryType["MultiPoint"] = 4] = "MultiPoint";
  39679. GeometryType[GeometryType["MultiLineString"] = 5] = "MultiLineString";
  39680. GeometryType[GeometryType["MultiPolygon"] = 6] = "MultiPolygon";
  39681. GeometryType[GeometryType["GeometryCollection"] = 7] = "GeometryCollection";
  39682. GeometryType[GeometryType["CircularString"] = 8] = "CircularString";
  39683. GeometryType[GeometryType["CompoundCurve"] = 9] = "CompoundCurve";
  39684. GeometryType[GeometryType["CurvePolygon"] = 10] = "CurvePolygon";
  39685. GeometryType[GeometryType["MultiCurve"] = 11] = "MultiCurve";
  39686. GeometryType[GeometryType["MultiSurface"] = 12] = "MultiSurface";
  39687. GeometryType[GeometryType["Curve"] = 13] = "Curve";
  39688. GeometryType[GeometryType["Surface"] = 14] = "Surface";
  39689. GeometryType[GeometryType["PolyhedralSurface"] = 15] = "PolyhedralSurface";
  39690. GeometryType[GeometryType["TIN"] = 16] = "TIN";
  39691. GeometryType[GeometryType["Triangle"] = 17] = "Triangle";
  39692. })(geometry_type_GeometryType || (geometry_type_GeometryType = {}));
  39693. // EXTERNAL MODULE: ./node_modules/flatbuffers/js/flatbuffers.js
  39694. var js_flatbuffers = __webpack_require__(903);
  39695. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/geometry.js
  39696. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  39697. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  39698. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  39699. var geometry_Geometry = /*#__PURE__*/function () {
  39700. function Geometry() {
  39701. _classCallCheck(this, Geometry);
  39702. this.bb = null;
  39703. this.bb_pos = 0;
  39704. }
  39705. _createClass(Geometry, [{
  39706. key: "__init",
  39707. value: function __init(i, bb) {
  39708. this.bb_pos = i;
  39709. this.bb = bb;
  39710. return this;
  39711. }
  39712. }, {
  39713. key: "ends",
  39714. value: function ends(index) {
  39715. var offset = this.bb.__offset(this.bb_pos, 4);
  39716. return offset ? this.bb.readUint32(this.bb.__vector(this.bb_pos + offset) + index * 4) : 0;
  39717. }
  39718. }, {
  39719. key: "endsLength",
  39720. value: function endsLength() {
  39721. var offset = this.bb.__offset(this.bb_pos, 4);
  39722. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  39723. }
  39724. }, {
  39725. key: "endsArray",
  39726. value: function endsArray() {
  39727. var offset = this.bb.__offset(this.bb_pos, 4);
  39728. return offset ? new Uint32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  39729. }
  39730. }, {
  39731. key: "xy",
  39732. value: function xy(index) {
  39733. var offset = this.bb.__offset(this.bb_pos, 6);
  39734. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  39735. }
  39736. }, {
  39737. key: "xyLength",
  39738. value: function xyLength() {
  39739. var offset = this.bb.__offset(this.bb_pos, 6);
  39740. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  39741. }
  39742. }, {
  39743. key: "xyArray",
  39744. value: function xyArray() {
  39745. var offset = this.bb.__offset(this.bb_pos, 6);
  39746. return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  39747. }
  39748. }, {
  39749. key: "z",
  39750. value: function z(index) {
  39751. var offset = this.bb.__offset(this.bb_pos, 8);
  39752. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  39753. }
  39754. }, {
  39755. key: "zLength",
  39756. value: function zLength() {
  39757. var offset = this.bb.__offset(this.bb_pos, 8);
  39758. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  39759. }
  39760. }, {
  39761. key: "zArray",
  39762. value: function zArray() {
  39763. var offset = this.bb.__offset(this.bb_pos, 8);
  39764. return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  39765. }
  39766. }, {
  39767. key: "m",
  39768. value: function m(index) {
  39769. var offset = this.bb.__offset(this.bb_pos, 10);
  39770. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  39771. }
  39772. }, {
  39773. key: "mLength",
  39774. value: function mLength() {
  39775. var offset = this.bb.__offset(this.bb_pos, 10);
  39776. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  39777. }
  39778. }, {
  39779. key: "mArray",
  39780. value: function mArray() {
  39781. var offset = this.bb.__offset(this.bb_pos, 10);
  39782. return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  39783. }
  39784. }, {
  39785. key: "t",
  39786. value: function t(index) {
  39787. var offset = this.bb.__offset(this.bb_pos, 12);
  39788. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  39789. }
  39790. }, {
  39791. key: "tLength",
  39792. value: function tLength() {
  39793. var offset = this.bb.__offset(this.bb_pos, 12);
  39794. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  39795. }
  39796. }, {
  39797. key: "tArray",
  39798. value: function tArray() {
  39799. var offset = this.bb.__offset(this.bb_pos, 12);
  39800. return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  39801. }
  39802. }, {
  39803. key: "tm",
  39804. value: function tm(index) {
  39805. var offset = this.bb.__offset(this.bb_pos, 14);
  39806. return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
  39807. }
  39808. }, {
  39809. key: "tmLength",
  39810. value: function tmLength() {
  39811. var offset = this.bb.__offset(this.bb_pos, 14);
  39812. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  39813. }
  39814. }, {
  39815. key: "type",
  39816. value: function type() {
  39817. var offset = this.bb.__offset(this.bb_pos, 16);
  39818. return offset ? this.bb.readUint8(this.bb_pos + offset) : geometry_type_GeometryType.Unknown;
  39819. }
  39820. }, {
  39821. key: "parts",
  39822. value: function parts(index, obj) {
  39823. var offset = this.bb.__offset(this.bb_pos, 18);
  39824. return offset ? (obj || new Geometry()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
  39825. }
  39826. }, {
  39827. key: "partsLength",
  39828. value: function partsLength() {
  39829. var offset = this.bb.__offset(this.bb_pos, 18);
  39830. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  39831. }
  39832. }], [{
  39833. key: "getRootAsGeometry",
  39834. value: function getRootAsGeometry(bb, obj) {
  39835. return (obj || new Geometry()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  39836. }
  39837. }, {
  39838. key: "getSizePrefixedRootAsGeometry",
  39839. value: function getSizePrefixedRootAsGeometry(bb, obj) {
  39840. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  39841. return (obj || new Geometry()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  39842. }
  39843. }, {
  39844. key: "startGeometry",
  39845. value: function startGeometry(builder) {
  39846. builder.startObject(8);
  39847. }
  39848. }, {
  39849. key: "addEnds",
  39850. value: function addEnds(builder, endsOffset) {
  39851. builder.addFieldOffset(0, endsOffset, 0);
  39852. }
  39853. }, {
  39854. key: "createEndsVector",
  39855. value: function createEndsVector(builder, data) {
  39856. builder.startVector(4, data.length, 4);
  39857. for (var i = data.length - 1; i >= 0; i--) {
  39858. builder.addInt32(data[i]);
  39859. }
  39860. return builder.endVector();
  39861. }
  39862. }, {
  39863. key: "startEndsVector",
  39864. value: function startEndsVector(builder, numElems) {
  39865. builder.startVector(4, numElems, 4);
  39866. }
  39867. }, {
  39868. key: "addXy",
  39869. value: function addXy(builder, xyOffset) {
  39870. builder.addFieldOffset(1, xyOffset, 0);
  39871. }
  39872. }, {
  39873. key: "createXyVector",
  39874. value: function createXyVector(builder, data) {
  39875. builder.startVector(8, data.length, 8);
  39876. for (var i = data.length - 1; i >= 0; i--) {
  39877. builder.addFloat64(data[i]);
  39878. }
  39879. return builder.endVector();
  39880. }
  39881. }, {
  39882. key: "startXyVector",
  39883. value: function startXyVector(builder, numElems) {
  39884. builder.startVector(8, numElems, 8);
  39885. }
  39886. }, {
  39887. key: "addZ",
  39888. value: function addZ(builder, zOffset) {
  39889. builder.addFieldOffset(2, zOffset, 0);
  39890. }
  39891. }, {
  39892. key: "createZVector",
  39893. value: function createZVector(builder, data) {
  39894. builder.startVector(8, data.length, 8);
  39895. for (var i = data.length - 1; i >= 0; i--) {
  39896. builder.addFloat64(data[i]);
  39897. }
  39898. return builder.endVector();
  39899. }
  39900. }, {
  39901. key: "startZVector",
  39902. value: function startZVector(builder, numElems) {
  39903. builder.startVector(8, numElems, 8);
  39904. }
  39905. }, {
  39906. key: "addM",
  39907. value: function addM(builder, mOffset) {
  39908. builder.addFieldOffset(3, mOffset, 0);
  39909. }
  39910. }, {
  39911. key: "createMVector",
  39912. value: function createMVector(builder, data) {
  39913. builder.startVector(8, data.length, 8);
  39914. for (var i = data.length - 1; i >= 0; i--) {
  39915. builder.addFloat64(data[i]);
  39916. }
  39917. return builder.endVector();
  39918. }
  39919. }, {
  39920. key: "startMVector",
  39921. value: function startMVector(builder, numElems) {
  39922. builder.startVector(8, numElems, 8);
  39923. }
  39924. }, {
  39925. key: "addT",
  39926. value: function addT(builder, tOffset) {
  39927. builder.addFieldOffset(4, tOffset, 0);
  39928. }
  39929. }, {
  39930. key: "createTVector",
  39931. value: function createTVector(builder, data) {
  39932. builder.startVector(8, data.length, 8);
  39933. for (var i = data.length - 1; i >= 0; i--) {
  39934. builder.addFloat64(data[i]);
  39935. }
  39936. return builder.endVector();
  39937. }
  39938. }, {
  39939. key: "startTVector",
  39940. value: function startTVector(builder, numElems) {
  39941. builder.startVector(8, numElems, 8);
  39942. }
  39943. }, {
  39944. key: "addTm",
  39945. value: function addTm(builder, tmOffset) {
  39946. builder.addFieldOffset(5, tmOffset, 0);
  39947. }
  39948. }, {
  39949. key: "createTmVector",
  39950. value: function createTmVector(builder, data) {
  39951. builder.startVector(8, data.length, 8);
  39952. for (var i = data.length - 1; i >= 0; i--) {
  39953. builder.addInt64(data[i]);
  39954. }
  39955. return builder.endVector();
  39956. }
  39957. }, {
  39958. key: "startTmVector",
  39959. value: function startTmVector(builder, numElems) {
  39960. builder.startVector(8, numElems, 8);
  39961. }
  39962. }, {
  39963. key: "addType",
  39964. value: function addType(builder, type) {
  39965. builder.addFieldInt8(6, type, geometry_type_GeometryType.Unknown);
  39966. }
  39967. }, {
  39968. key: "addParts",
  39969. value: function addParts(builder, partsOffset) {
  39970. builder.addFieldOffset(7, partsOffset, 0);
  39971. }
  39972. }, {
  39973. key: "createPartsVector",
  39974. value: function createPartsVector(builder, data) {
  39975. builder.startVector(4, data.length, 4);
  39976. for (var i = data.length - 1; i >= 0; i--) {
  39977. builder.addOffset(data[i]);
  39978. }
  39979. return builder.endVector();
  39980. }
  39981. }, {
  39982. key: "startPartsVector",
  39983. value: function startPartsVector(builder, numElems) {
  39984. builder.startVector(4, numElems, 4);
  39985. }
  39986. }, {
  39987. key: "endGeometry",
  39988. value: function endGeometry(builder) {
  39989. var offset = builder.endObject();
  39990. return offset;
  39991. }
  39992. }, {
  39993. key: "createGeometry",
  39994. value: function createGeometry(builder, endsOffset, xyOffset, zOffset, mOffset, tOffset, tmOffset, type, partsOffset) {
  39995. Geometry.startGeometry(builder);
  39996. Geometry.addEnds(builder, endsOffset);
  39997. Geometry.addXy(builder, xyOffset);
  39998. Geometry.addZ(builder, zOffset);
  39999. Geometry.addM(builder, mOffset);
  40000. Geometry.addT(builder, tOffset);
  40001. Geometry.addTm(builder, tmOffset);
  40002. Geometry.addType(builder, type);
  40003. Geometry.addParts(builder, partsOffset);
  40004. return Geometry.endGeometry(builder);
  40005. }
  40006. }]);
  40007. return Geometry;
  40008. }();
  40009. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/generic/geometry.js
  40010. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  40011. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  40012. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  40013. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  40014. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  40015. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  40016. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  40017. function geometry_buildGeometry(builder, parsedGeometry) {
  40018. var xy = parsedGeometry.xy,
  40019. z = parsedGeometry.z,
  40020. ends = parsedGeometry.ends,
  40021. parts = parsedGeometry.parts,
  40022. type = parsedGeometry.type;
  40023. if (parts) {
  40024. var partOffsets = parts.map(function (part) {
  40025. return geometry_buildGeometry(builder, part);
  40026. });
  40027. var partsOffset = Geometry.createPartsVector(builder, partOffsets);
  40028. Geometry.startGeometry(builder);
  40029. Geometry.addParts(builder, partsOffset);
  40030. Geometry.addType(builder, type);
  40031. return Geometry.endGeometry(builder);
  40032. }
  40033. var xyOffset = Geometry.createXyVector(builder, xy);
  40034. var zOffset;
  40035. if (z) zOffset = Geometry.createZVector(builder, z);
  40036. var endsOffset;
  40037. if (ends) endsOffset = Geometry.createEndsVector(builder, ends);
  40038. Geometry.startGeometry(builder);
  40039. if (endsOffset) Geometry.addEnds(builder, endsOffset);
  40040. Geometry.addXy(builder, xyOffset);
  40041. if (zOffset) Geometry.addZ(builder, zOffset);
  40042. Geometry.addType(builder, type);
  40043. return Geometry.endGeometry(builder);
  40044. }
  40045. function geometry_flat(a, xy, z) {
  40046. if (a.length === 0) return;
  40047. if (Array.isArray(a[0])) {
  40048. var _iterator = _createForOfIteratorHelper(a),
  40049. _step;
  40050. try {
  40051. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  40052. var sa = _step.value;
  40053. geometry_flat(sa, xy, z);
  40054. }
  40055. } catch (err) {
  40056. _iterator.e(err);
  40057. } finally {
  40058. _iterator.f();
  40059. }
  40060. } else {
  40061. if (a.length === 2) xy.push.apply(xy, _toConsumableArray(a));else {
  40062. xy.push(a[0], a[1]);
  40063. z.push(a[2]);
  40064. }
  40065. }
  40066. }
  40067. function geometry_parseGeometry(geometry, headerGeomType) {
  40068. var xy;
  40069. var ends;
  40070. var parts;
  40071. var type = headerGeomType;
  40072. if (type === GeometryType.Unknown) {
  40073. type = geometry_toGeometryType(geometry.getType());
  40074. }
  40075. if (type === GeometryType.MultiLineString) {
  40076. if (geometry.getFlatCoordinates) xy = geometry.getFlatCoordinates();
  40077. var mlsEnds = geometry.getEnds();
  40078. if (mlsEnds.length > 1) ends = mlsEnds.map(function (e) {
  40079. return e >> 1;
  40080. });
  40081. } else if (type === GeometryType.Polygon) {
  40082. if (geometry.getFlatCoordinates) xy = geometry.getFlatCoordinates();
  40083. var pEnds = geometry.getEnds();
  40084. if (pEnds.length > 1) ends = pEnds.map(function (e) {
  40085. return e >> 1;
  40086. });
  40087. } else if (type === GeometryType.MultiPolygon) {
  40088. var mp = geometry;
  40089. parts = mp.getPolygons().map(function (p) {
  40090. return geometry_parseGeometry(p, GeometryType.Polygon);
  40091. });
  40092. } else {
  40093. if (geometry.getFlatCoordinates) xy = geometry.getFlatCoordinates();
  40094. }
  40095. return {
  40096. xy: xy,
  40097. ends: ends,
  40098. type: type,
  40099. parts: parts
  40100. };
  40101. }
  40102. function pairFlatCoordinates(xy, z) {
  40103. var newArray = [];
  40104. for (var i = 0; i < xy.length; i += 2) {
  40105. var a = [xy[i], xy[i + 1]];
  40106. if (z) a.push(z[i >> 1]);
  40107. newArray.push(a);
  40108. }
  40109. return newArray;
  40110. }
  40111. function geometry_toGeometryType(name) {
  40112. if (!name) return GeometryType.Unknown;
  40113. var type = GeometryType[name];
  40114. return type;
  40115. }
  40116. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/geojson/geometry.js
  40117. function geojson_geometry_parseGeometry(geometry) {
  40118. var cs = geometry.coordinates;
  40119. var xy = [];
  40120. var z = [];
  40121. var ends;
  40122. var parts;
  40123. var type = toGeometryType(geometry.type);
  40124. var end = 0;
  40125. switch (geometry.type) {
  40126. case 'Point':
  40127. flat(cs, xy, z);
  40128. break;
  40129. case 'MultiPoint':
  40130. case 'LineString':
  40131. flat(cs, xy, z);
  40132. break;
  40133. case 'MultiLineString':
  40134. case 'Polygon':
  40135. {
  40136. var css = cs;
  40137. flat(css, xy, z);
  40138. if (css.length > 1) ends = css.map(function (c) {
  40139. return end += c.length;
  40140. });
  40141. break;
  40142. }
  40143. case 'MultiPolygon':
  40144. {
  40145. var csss = cs;
  40146. var geometries = csss.map(function (coordinates) {
  40147. return {
  40148. type: 'Polygon',
  40149. coordinates: coordinates
  40150. };
  40151. });
  40152. parts = geometries.map(geojson_geometry_parseGeometry);
  40153. break;
  40154. }
  40155. }
  40156. return {
  40157. xy: xy,
  40158. z: z.length > 0 ? z : undefined,
  40159. ends: ends,
  40160. type: type,
  40161. parts: parts
  40162. };
  40163. }
  40164. function geometry_parseGC(geometry) {
  40165. var type = toGeometryType(geometry.type);
  40166. var parts = [];
  40167. for (var i = 0; i < geometry.geometries.length; i++) {
  40168. var g = geometry.geometries[i];
  40169. if (g.type === 'GeometryCollection') parts.push(geometry_parseGC(g));else parts.push(geojson_geometry_parseGeometry(g));
  40170. }
  40171. return {
  40172. type: type,
  40173. parts: parts
  40174. };
  40175. }
  40176. function extractParts(xy, z, ends) {
  40177. if (!ends || ends.length === 0) return [pairFlatCoordinates(xy, z)];
  40178. var s = 0;
  40179. var xySlices = Array.from(ends).map(function (e) {
  40180. return xy.slice(s, s = e << 1);
  40181. });
  40182. var zSlices;
  40183. if (z) {
  40184. s = 0;
  40185. zSlices = Array.from(ends).map(function (e) {
  40186. return z.slice(s, s = e);
  40187. });
  40188. }
  40189. return xySlices.map(function (xy, i) {
  40190. return pairFlatCoordinates(xy, zSlices ? zSlices[i] : undefined);
  40191. });
  40192. }
  40193. function toGeoJsonCoordinates(geometry, type) {
  40194. var xy = geometry.xyArray();
  40195. var z = geometry.zArray();
  40196. switch (type) {
  40197. case geometry_type_GeometryType.Point:
  40198. {
  40199. var a = Array.from(xy);
  40200. if (z) a.push(z[0]);
  40201. return a;
  40202. }
  40203. case geometry_type_GeometryType.MultiPoint:
  40204. case geometry_type_GeometryType.LineString:
  40205. return pairFlatCoordinates(xy, z);
  40206. case geometry_type_GeometryType.MultiLineString:
  40207. return extractParts(xy, z, geometry.endsArray());
  40208. case geometry_type_GeometryType.Polygon:
  40209. return extractParts(xy, z, geometry.endsArray());
  40210. }
  40211. }
  40212. function fromGeometry(geometry, headerType) {
  40213. var type = headerType;
  40214. if (type === geometry_type_GeometryType.Unknown) {
  40215. type = geometry.type();
  40216. }
  40217. if (type === geometry_type_GeometryType.GeometryCollection) {
  40218. var geometries = [];
  40219. for (var i = 0; i < geometry.partsLength(); i++) {
  40220. var part = geometry.parts(i);
  40221. var partType = part.type();
  40222. geometries.push(fromGeometry(part, partType));
  40223. }
  40224. return {
  40225. type: geometry_type_GeometryType[type],
  40226. geometries: geometries
  40227. };
  40228. } else if (type === geometry_type_GeometryType.MultiPolygon) {
  40229. var _geometries = [];
  40230. for (var _i2 = 0; _i2 < geometry.partsLength(); _i2++) _geometries.push(fromGeometry(geometry.parts(_i2), geometry_type_GeometryType.Polygon));
  40231. return {
  40232. type: geometry_type_GeometryType[type],
  40233. coordinates: _geometries.map(function (g) {
  40234. return g.coordinates;
  40235. })
  40236. };
  40237. }
  40238. var coordinates = toGeoJsonCoordinates(geometry, type);
  40239. return {
  40240. type: geometry_type_GeometryType[type],
  40241. coordinates: coordinates
  40242. };
  40243. }
  40244. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/column-type.js
  40245. var column_type_ColumnType;
  40246. (function (ColumnType) {
  40247. ColumnType[ColumnType["Byte"] = 0] = "Byte";
  40248. ColumnType[ColumnType["UByte"] = 1] = "UByte";
  40249. ColumnType[ColumnType["Bool"] = 2] = "Bool";
  40250. ColumnType[ColumnType["Short"] = 3] = "Short";
  40251. ColumnType[ColumnType["UShort"] = 4] = "UShort";
  40252. ColumnType[ColumnType["Int"] = 5] = "Int";
  40253. ColumnType[ColumnType["UInt"] = 6] = "UInt";
  40254. ColumnType[ColumnType["Long"] = 7] = "Long";
  40255. ColumnType[ColumnType["ULong"] = 8] = "ULong";
  40256. ColumnType[ColumnType["Float"] = 9] = "Float";
  40257. ColumnType[ColumnType["Double"] = 10] = "Double";
  40258. ColumnType[ColumnType["String"] = 11] = "String";
  40259. ColumnType[ColumnType["Json"] = 12] = "Json";
  40260. ColumnType[ColumnType["DateTime"] = 13] = "DateTime";
  40261. ColumnType[ColumnType["Binary"] = 14] = "Binary";
  40262. })(column_type_ColumnType || (column_type_ColumnType = {}));
  40263. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/column.js
  40264. function column_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  40265. function column_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  40266. function column_createClass(Constructor, protoProps, staticProps) { if (protoProps) column_defineProperties(Constructor.prototype, protoProps); if (staticProps) column_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  40267. var column_Column = /*#__PURE__*/function () {
  40268. function Column() {
  40269. column_classCallCheck(this, Column);
  40270. this.bb = null;
  40271. this.bb_pos = 0;
  40272. }
  40273. column_createClass(Column, [{
  40274. key: "__init",
  40275. value: function __init(i, bb) {
  40276. this.bb_pos = i;
  40277. this.bb = bb;
  40278. return this;
  40279. }
  40280. }, {
  40281. key: "name",
  40282. value: function name(optionalEncoding) {
  40283. var offset = this.bb.__offset(this.bb_pos, 4);
  40284. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  40285. }
  40286. }, {
  40287. key: "type",
  40288. value: function type() {
  40289. var offset = this.bb.__offset(this.bb_pos, 6);
  40290. return offset ? this.bb.readUint8(this.bb_pos + offset) : column_type_ColumnType.Byte;
  40291. }
  40292. }, {
  40293. key: "title",
  40294. value: function title(optionalEncoding) {
  40295. var offset = this.bb.__offset(this.bb_pos, 8);
  40296. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  40297. }
  40298. }, {
  40299. key: "description",
  40300. value: function description(optionalEncoding) {
  40301. var offset = this.bb.__offset(this.bb_pos, 10);
  40302. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  40303. }
  40304. }, {
  40305. key: "width",
  40306. value: function width() {
  40307. var offset = this.bb.__offset(this.bb_pos, 12);
  40308. return offset ? this.bb.readInt32(this.bb_pos + offset) : -1;
  40309. }
  40310. }, {
  40311. key: "precision",
  40312. value: function precision() {
  40313. var offset = this.bb.__offset(this.bb_pos, 14);
  40314. return offset ? this.bb.readInt32(this.bb_pos + offset) : -1;
  40315. }
  40316. }, {
  40317. key: "scale",
  40318. value: function scale() {
  40319. var offset = this.bb.__offset(this.bb_pos, 16);
  40320. return offset ? this.bb.readInt32(this.bb_pos + offset) : -1;
  40321. }
  40322. }, {
  40323. key: "nullable",
  40324. value: function nullable() {
  40325. var offset = this.bb.__offset(this.bb_pos, 18);
  40326. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : true;
  40327. }
  40328. }, {
  40329. key: "unique",
  40330. value: function unique() {
  40331. var offset = this.bb.__offset(this.bb_pos, 20);
  40332. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  40333. }
  40334. }, {
  40335. key: "primaryKey",
  40336. value: function primaryKey() {
  40337. var offset = this.bb.__offset(this.bb_pos, 22);
  40338. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  40339. }
  40340. }, {
  40341. key: "metadata",
  40342. value: function metadata(optionalEncoding) {
  40343. var offset = this.bb.__offset(this.bb_pos, 24);
  40344. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  40345. }
  40346. }], [{
  40347. key: "getRootAsColumn",
  40348. value: function getRootAsColumn(bb, obj) {
  40349. return (obj || new Column()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  40350. }
  40351. }, {
  40352. key: "getSizePrefixedRootAsColumn",
  40353. value: function getSizePrefixedRootAsColumn(bb, obj) {
  40354. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  40355. return (obj || new Column()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  40356. }
  40357. }, {
  40358. key: "startColumn",
  40359. value: function startColumn(builder) {
  40360. builder.startObject(11);
  40361. }
  40362. }, {
  40363. key: "addName",
  40364. value: function addName(builder, nameOffset) {
  40365. builder.addFieldOffset(0, nameOffset, 0);
  40366. }
  40367. }, {
  40368. key: "addType",
  40369. value: function addType(builder, type) {
  40370. builder.addFieldInt8(1, type, column_type_ColumnType.Byte);
  40371. }
  40372. }, {
  40373. key: "addTitle",
  40374. value: function addTitle(builder, titleOffset) {
  40375. builder.addFieldOffset(2, titleOffset, 0);
  40376. }
  40377. }, {
  40378. key: "addDescription",
  40379. value: function addDescription(builder, descriptionOffset) {
  40380. builder.addFieldOffset(3, descriptionOffset, 0);
  40381. }
  40382. }, {
  40383. key: "addWidth",
  40384. value: function addWidth(builder, width) {
  40385. builder.addFieldInt32(4, width, -1);
  40386. }
  40387. }, {
  40388. key: "addPrecision",
  40389. value: function addPrecision(builder, precision) {
  40390. builder.addFieldInt32(5, precision, -1);
  40391. }
  40392. }, {
  40393. key: "addScale",
  40394. value: function addScale(builder, scale) {
  40395. builder.addFieldInt32(6, scale, -1);
  40396. }
  40397. }, {
  40398. key: "addNullable",
  40399. value: function addNullable(builder, nullable) {
  40400. builder.addFieldInt8(7, +nullable, +true);
  40401. }
  40402. }, {
  40403. key: "addUnique",
  40404. value: function addUnique(builder, unique) {
  40405. builder.addFieldInt8(8, +unique, +false);
  40406. }
  40407. }, {
  40408. key: "addPrimaryKey",
  40409. value: function addPrimaryKey(builder, primaryKey) {
  40410. builder.addFieldInt8(9, +primaryKey, +false);
  40411. }
  40412. }, {
  40413. key: "addMetadata",
  40414. value: function addMetadata(builder, metadataOffset) {
  40415. builder.addFieldOffset(10, metadataOffset, 0);
  40416. }
  40417. }, {
  40418. key: "endColumn",
  40419. value: function endColumn(builder) {
  40420. var offset = builder.endObject();
  40421. builder.requiredField(offset, 4);
  40422. return offset;
  40423. }
  40424. }, {
  40425. key: "createColumn",
  40426. value: function createColumn(builder, nameOffset, type, titleOffset, descriptionOffset, width, precision, scale, nullable, unique, primaryKey, metadataOffset) {
  40427. Column.startColumn(builder);
  40428. Column.addName(builder, nameOffset);
  40429. Column.addType(builder, type);
  40430. Column.addTitle(builder, titleOffset);
  40431. Column.addDescription(builder, descriptionOffset);
  40432. Column.addWidth(builder, width);
  40433. Column.addPrecision(builder, precision);
  40434. Column.addScale(builder, scale);
  40435. Column.addNullable(builder, nullable);
  40436. Column.addUnique(builder, unique);
  40437. Column.addPrimaryKey(builder, primaryKey);
  40438. Column.addMetadata(builder, metadataOffset);
  40439. return Column.endColumn(builder);
  40440. }
  40441. }]);
  40442. return Column;
  40443. }();
  40444. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/feature.js
  40445. function feature_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  40446. function feature_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  40447. function feature_createClass(Constructor, protoProps, staticProps) { if (protoProps) feature_defineProperties(Constructor.prototype, protoProps); if (staticProps) feature_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  40448. var feature_Feature = /*#__PURE__*/function () {
  40449. function Feature() {
  40450. feature_classCallCheck(this, Feature);
  40451. this.bb = null;
  40452. this.bb_pos = 0;
  40453. }
  40454. feature_createClass(Feature, [{
  40455. key: "__init",
  40456. value: function __init(i, bb) {
  40457. this.bb_pos = i;
  40458. this.bb = bb;
  40459. return this;
  40460. }
  40461. }, {
  40462. key: "geometry",
  40463. value: function geometry(obj) {
  40464. var offset = this.bb.__offset(this.bb_pos, 4);
  40465. return offset ? (obj || new geometry_Geometry()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
  40466. }
  40467. }, {
  40468. key: "properties",
  40469. value: function properties(index) {
  40470. var offset = this.bb.__offset(this.bb_pos, 6);
  40471. return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
  40472. }
  40473. }, {
  40474. key: "propertiesLength",
  40475. value: function propertiesLength() {
  40476. var offset = this.bb.__offset(this.bb_pos, 6);
  40477. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  40478. }
  40479. }, {
  40480. key: "propertiesArray",
  40481. value: function propertiesArray() {
  40482. var offset = this.bb.__offset(this.bb_pos, 6);
  40483. return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  40484. }
  40485. }, {
  40486. key: "columns",
  40487. value: function columns(index, obj) {
  40488. var offset = this.bb.__offset(this.bb_pos, 8);
  40489. return offset ? (obj || new column_Column()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
  40490. }
  40491. }, {
  40492. key: "columnsLength",
  40493. value: function columnsLength() {
  40494. var offset = this.bb.__offset(this.bb_pos, 8);
  40495. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  40496. }
  40497. }], [{
  40498. key: "getRootAsFeature",
  40499. value: function getRootAsFeature(bb, obj) {
  40500. return (obj || new Feature()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  40501. }
  40502. }, {
  40503. key: "getSizePrefixedRootAsFeature",
  40504. value: function getSizePrefixedRootAsFeature(bb, obj) {
  40505. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  40506. return (obj || new Feature()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  40507. }
  40508. }, {
  40509. key: "startFeature",
  40510. value: function startFeature(builder) {
  40511. builder.startObject(3);
  40512. }
  40513. }, {
  40514. key: "addGeometry",
  40515. value: function addGeometry(builder, geometryOffset) {
  40516. builder.addFieldOffset(0, geometryOffset, 0);
  40517. }
  40518. }, {
  40519. key: "addProperties",
  40520. value: function addProperties(builder, propertiesOffset) {
  40521. builder.addFieldOffset(1, propertiesOffset, 0);
  40522. }
  40523. }, {
  40524. key: "createPropertiesVector",
  40525. value: function createPropertiesVector(builder, data) {
  40526. builder.startVector(1, data.length, 1);
  40527. for (var i = data.length - 1; i >= 0; i--) {
  40528. builder.addInt8(data[i]);
  40529. }
  40530. return builder.endVector();
  40531. }
  40532. }, {
  40533. key: "startPropertiesVector",
  40534. value: function startPropertiesVector(builder, numElems) {
  40535. builder.startVector(1, numElems, 1);
  40536. }
  40537. }, {
  40538. key: "addColumns",
  40539. value: function addColumns(builder, columnsOffset) {
  40540. builder.addFieldOffset(2, columnsOffset, 0);
  40541. }
  40542. }, {
  40543. key: "createColumnsVector",
  40544. value: function createColumnsVector(builder, data) {
  40545. builder.startVector(4, data.length, 4);
  40546. for (var i = data.length - 1; i >= 0; i--) {
  40547. builder.addOffset(data[i]);
  40548. }
  40549. return builder.endVector();
  40550. }
  40551. }, {
  40552. key: "startColumnsVector",
  40553. value: function startColumnsVector(builder, numElems) {
  40554. builder.startVector(4, numElems, 4);
  40555. }
  40556. }, {
  40557. key: "endFeature",
  40558. value: function endFeature(builder) {
  40559. var offset = builder.endObject();
  40560. return offset;
  40561. }
  40562. }, {
  40563. key: "finishFeatureBuffer",
  40564. value: function finishFeatureBuffer(builder, offset) {
  40565. builder.finish(offset);
  40566. }
  40567. }, {
  40568. key: "finishSizePrefixedFeatureBuffer",
  40569. value: function finishSizePrefixedFeatureBuffer(builder, offset) {
  40570. builder.finish(offset, undefined, true);
  40571. }
  40572. }, {
  40573. key: "createFeature",
  40574. value: function createFeature(builder, geometryOffset, propertiesOffset, columnsOffset) {
  40575. Feature.startFeature(builder);
  40576. Feature.addGeometry(builder, geometryOffset);
  40577. Feature.addProperties(builder, propertiesOffset);
  40578. Feature.addColumns(builder, columnsOffset);
  40579. return Feature.endFeature(builder);
  40580. }
  40581. }]);
  40582. return Feature;
  40583. }();
  40584. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/generic/feature.js
  40585. var textEncoder = new TextEncoder();
  40586. var textDecoder = new TextDecoder();
  40587. function fromFeature(feature, header, createGeometry, createFeature) {
  40588. var columns = header.columns;
  40589. var geometry = feature.geometry();
  40590. var simpleGeometry = createGeometry(geometry, header.geometryType);
  40591. var properties = parseProperties(feature, columns);
  40592. return createFeature(simpleGeometry, properties);
  40593. }
  40594. function feature_buildFeature(geometry, properties, header) {
  40595. var columns = header.columns;
  40596. var builder = new flatbuffers.Builder();
  40597. var offset = 0;
  40598. var capacity = 1024;
  40599. var bytes = new Uint8Array(capacity);
  40600. var view = new DataView(bytes.buffer);
  40601. var prep = function prep(size) {
  40602. if (offset + size < capacity) return;
  40603. capacity = Math.max(capacity + size, capacity * 2);
  40604. var newBytes = new Uint8Array(capacity);
  40605. newBytes.set(bytes);
  40606. bytes = newBytes;
  40607. view = new DataView(bytes.buffer);
  40608. };
  40609. if (columns) {
  40610. for (var i = 0; i < columns.length; i++) {
  40611. var column = columns[i];
  40612. var value = properties[column.name];
  40613. if (value === null) continue;
  40614. prep(2);
  40615. view.setUint16(offset, i, true);
  40616. offset += 2;
  40617. switch (column.type) {
  40618. case ColumnType.Bool:
  40619. prep(1);
  40620. view.setUint8(offset, value);
  40621. offset += 1;
  40622. break;
  40623. case ColumnType.Short:
  40624. prep(2);
  40625. view.setInt16(offset, value, true);
  40626. offset += 2;
  40627. break;
  40628. case ColumnType.UShort:
  40629. prep(2);
  40630. view.setUint16(offset, value, true);
  40631. offset += 2;
  40632. break;
  40633. case ColumnType.Int:
  40634. prep(4);
  40635. view.setInt32(offset, value, true);
  40636. offset += 4;
  40637. break;
  40638. case ColumnType.UInt:
  40639. prep(4);
  40640. view.setUint32(offset, value, true);
  40641. offset += 4;
  40642. break;
  40643. case ColumnType.Long:
  40644. prep(8);
  40645. view.setBigInt64(offset, BigInt(value), true);
  40646. offset += 8;
  40647. break;
  40648. case ColumnType.Float:
  40649. prep(4);
  40650. view.setFloat32(offset, value, true);
  40651. offset += 4;
  40652. break;
  40653. case ColumnType.Double:
  40654. prep(8);
  40655. view.setFloat64(offset, value, true);
  40656. offset += 8;
  40657. break;
  40658. case ColumnType.DateTime:
  40659. case ColumnType.String:
  40660. {
  40661. var str = textEncoder.encode(value);
  40662. prep(4);
  40663. view.setUint32(offset, str.length, true);
  40664. offset += 4;
  40665. prep(str.length);
  40666. bytes.set(str, offset);
  40667. offset += str.length;
  40668. break;
  40669. }
  40670. case ColumnType.Json:
  40671. {
  40672. var _str = textEncoder.encode(JSON.stringify(value));
  40673. prep(4);
  40674. view.setUint32(offset, _str.length, true);
  40675. offset += 4;
  40676. prep(_str.length);
  40677. bytes.set(_str, offset);
  40678. offset += _str.length;
  40679. break;
  40680. }
  40681. default:
  40682. throw new Error('Unknown type ' + column.type);
  40683. }
  40684. }
  40685. }
  40686. var propertiesOffset = null;
  40687. if (offset > 0) propertiesOffset = Feature.createPropertiesVector(builder, bytes.slice(0, offset));
  40688. var geometryOffset = buildGeometry(builder, geometry);
  40689. Feature.startFeature(builder);
  40690. Feature.addGeometry(builder, geometryOffset);
  40691. if (propertiesOffset) Feature.addProperties(builder, propertiesOffset);
  40692. var featureOffset = Feature.endFeature(builder);
  40693. builder.finishSizePrefixed(featureOffset);
  40694. return builder.asUint8Array();
  40695. }
  40696. function parseProperties(feature, columns) {
  40697. var properties = {};
  40698. if (!columns || columns.length === 0) return properties;
  40699. var array = feature.propertiesArray();
  40700. if (!array) return properties;
  40701. var view = new DataView(array.buffer, array.byteOffset);
  40702. var length = feature.propertiesLength();
  40703. var offset = 0;
  40704. while (offset < length) {
  40705. var i = view.getUint16(offset, true);
  40706. offset += 2;
  40707. var column = columns[i];
  40708. var name = column.name;
  40709. switch (column.type) {
  40710. case column_type_ColumnType.Bool:
  40711. {
  40712. properties[name] = !!view.getUint8(offset);
  40713. offset += 1;
  40714. break;
  40715. }
  40716. case column_type_ColumnType.Byte:
  40717. {
  40718. properties[name] = view.getInt8(offset);
  40719. offset += 1;
  40720. break;
  40721. }
  40722. case column_type_ColumnType.UByte:
  40723. {
  40724. properties[name] = view.getUint8(offset);
  40725. offset += 1;
  40726. break;
  40727. }
  40728. case column_type_ColumnType.Short:
  40729. {
  40730. properties[name] = view.getInt16(offset, true);
  40731. offset += 2;
  40732. break;
  40733. }
  40734. case column_type_ColumnType.UShort:
  40735. {
  40736. properties[name] = view.getUint16(offset, true);
  40737. offset += 2;
  40738. break;
  40739. }
  40740. case column_type_ColumnType.Int:
  40741. {
  40742. properties[name] = view.getInt32(offset, true);
  40743. offset += 4;
  40744. break;
  40745. }
  40746. case column_type_ColumnType.UInt:
  40747. {
  40748. properties[name] = view.getUint32(offset, true);
  40749. offset += 4;
  40750. break;
  40751. }
  40752. case column_type_ColumnType.Long:
  40753. {
  40754. properties[name] = Number(view.getBigInt64(offset, true));
  40755. offset += 8;
  40756. break;
  40757. }
  40758. case column_type_ColumnType.ULong:
  40759. {
  40760. properties[name] = Number(view.getBigUint64(offset, true));
  40761. offset += 8;
  40762. break;
  40763. }
  40764. case column_type_ColumnType.Float:
  40765. {
  40766. properties[name] = view.getFloat32(offset, true);
  40767. offset += 4;
  40768. break;
  40769. }
  40770. case column_type_ColumnType.Double:
  40771. {
  40772. properties[name] = view.getFloat64(offset, true);
  40773. offset += 8;
  40774. break;
  40775. }
  40776. case column_type_ColumnType.DateTime:
  40777. case column_type_ColumnType.String:
  40778. {
  40779. var _length = view.getUint32(offset, true);
  40780. offset += 4;
  40781. properties[name] = textDecoder.decode(array.subarray(offset, offset + _length));
  40782. offset += _length;
  40783. break;
  40784. }
  40785. case column_type_ColumnType.Json:
  40786. {
  40787. var _length2 = view.getUint32(offset, true);
  40788. offset += 4;
  40789. var str = textDecoder.decode(array.subarray(offset, offset + _length2));
  40790. properties[name] = JSON.parse(str);
  40791. offset += _length2;
  40792. break;
  40793. }
  40794. default:
  40795. throw new Error('Unknown type ' + column.type);
  40796. }
  40797. }
  40798. return properties;
  40799. }
  40800. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/geojson/feature.js
  40801. function feature_fromFeature(feature, header) {
  40802. var columns = header.columns;
  40803. var geometry = fromGeometry(feature.geometry(), header.geometryType);
  40804. var geoJsonfeature = {
  40805. type: 'Feature',
  40806. geometry: geometry,
  40807. properties: parseProperties(feature, columns)
  40808. };
  40809. return geoJsonfeature;
  40810. }
  40811. // EXTERNAL MODULE: ./node_modules/slice-source/dist/slice-source.js
  40812. var slice_source = __webpack_require__(901);
  40813. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/crs.js
  40814. function crs_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  40815. function crs_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  40816. function crs_createClass(Constructor, protoProps, staticProps) { if (protoProps) crs_defineProperties(Constructor.prototype, protoProps); if (staticProps) crs_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  40817. var Crs = /*#__PURE__*/function () {
  40818. function Crs() {
  40819. crs_classCallCheck(this, Crs);
  40820. this.bb = null;
  40821. this.bb_pos = 0;
  40822. }
  40823. crs_createClass(Crs, [{
  40824. key: "__init",
  40825. value: function __init(i, bb) {
  40826. this.bb_pos = i;
  40827. this.bb = bb;
  40828. return this;
  40829. }
  40830. }, {
  40831. key: "org",
  40832. value: function org(optionalEncoding) {
  40833. var offset = this.bb.__offset(this.bb_pos, 4);
  40834. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  40835. }
  40836. }, {
  40837. key: "code",
  40838. value: function code() {
  40839. var offset = this.bb.__offset(this.bb_pos, 6);
  40840. return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
  40841. }
  40842. }, {
  40843. key: "name",
  40844. value: function name(optionalEncoding) {
  40845. var offset = this.bb.__offset(this.bb_pos, 8);
  40846. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  40847. }
  40848. }, {
  40849. key: "description",
  40850. value: function description(optionalEncoding) {
  40851. var offset = this.bb.__offset(this.bb_pos, 10);
  40852. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  40853. }
  40854. }, {
  40855. key: "wkt",
  40856. value: function wkt(optionalEncoding) {
  40857. var offset = this.bb.__offset(this.bb_pos, 12);
  40858. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  40859. }
  40860. }, {
  40861. key: "codeString",
  40862. value: function codeString(optionalEncoding) {
  40863. var offset = this.bb.__offset(this.bb_pos, 14);
  40864. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  40865. }
  40866. }], [{
  40867. key: "getRootAsCrs",
  40868. value: function getRootAsCrs(bb, obj) {
  40869. return (obj || new Crs()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  40870. }
  40871. }, {
  40872. key: "getSizePrefixedRootAsCrs",
  40873. value: function getSizePrefixedRootAsCrs(bb, obj) {
  40874. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  40875. return (obj || new Crs()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  40876. }
  40877. }, {
  40878. key: "startCrs",
  40879. value: function startCrs(builder) {
  40880. builder.startObject(6);
  40881. }
  40882. }, {
  40883. key: "addOrg",
  40884. value: function addOrg(builder, orgOffset) {
  40885. builder.addFieldOffset(0, orgOffset, 0);
  40886. }
  40887. }, {
  40888. key: "addCode",
  40889. value: function addCode(builder, code) {
  40890. builder.addFieldInt32(1, code, 0);
  40891. }
  40892. }, {
  40893. key: "addName",
  40894. value: function addName(builder, nameOffset) {
  40895. builder.addFieldOffset(2, nameOffset, 0);
  40896. }
  40897. }, {
  40898. key: "addDescription",
  40899. value: function addDescription(builder, descriptionOffset) {
  40900. builder.addFieldOffset(3, descriptionOffset, 0);
  40901. }
  40902. }, {
  40903. key: "addWkt",
  40904. value: function addWkt(builder, wktOffset) {
  40905. builder.addFieldOffset(4, wktOffset, 0);
  40906. }
  40907. }, {
  40908. key: "addCodeString",
  40909. value: function addCodeString(builder, codeStringOffset) {
  40910. builder.addFieldOffset(5, codeStringOffset, 0);
  40911. }
  40912. }, {
  40913. key: "endCrs",
  40914. value: function endCrs(builder) {
  40915. var offset = builder.endObject();
  40916. return offset;
  40917. }
  40918. }, {
  40919. key: "createCrs",
  40920. value: function createCrs(builder, orgOffset, code, nameOffset, descriptionOffset, wktOffset, codeStringOffset) {
  40921. Crs.startCrs(builder);
  40922. Crs.addOrg(builder, orgOffset);
  40923. Crs.addCode(builder, code);
  40924. Crs.addName(builder, nameOffset);
  40925. Crs.addDescription(builder, descriptionOffset);
  40926. Crs.addWkt(builder, wktOffset);
  40927. Crs.addCodeString(builder, codeStringOffset);
  40928. return Crs.endCrs(builder);
  40929. }
  40930. }]);
  40931. return Crs;
  40932. }();
  40933. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/header.js
  40934. function header_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  40935. function header_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  40936. function header_createClass(Constructor, protoProps, staticProps) { if (protoProps) header_defineProperties(Constructor.prototype, protoProps); if (staticProps) header_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  40937. var header_Header = /*#__PURE__*/function () {
  40938. function Header() {
  40939. header_classCallCheck(this, Header);
  40940. this.bb = null;
  40941. this.bb_pos = 0;
  40942. }
  40943. header_createClass(Header, [{
  40944. key: "__init",
  40945. value: function __init(i, bb) {
  40946. this.bb_pos = i;
  40947. this.bb = bb;
  40948. return this;
  40949. }
  40950. }, {
  40951. key: "name",
  40952. value: function name(optionalEncoding) {
  40953. var offset = this.bb.__offset(this.bb_pos, 4);
  40954. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  40955. }
  40956. }, {
  40957. key: "envelope",
  40958. value: function envelope(index) {
  40959. var offset = this.bb.__offset(this.bb_pos, 6);
  40960. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  40961. }
  40962. }, {
  40963. key: "envelopeLength",
  40964. value: function envelopeLength() {
  40965. var offset = this.bb.__offset(this.bb_pos, 6);
  40966. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  40967. }
  40968. }, {
  40969. key: "envelopeArray",
  40970. value: function envelopeArray() {
  40971. var offset = this.bb.__offset(this.bb_pos, 6);
  40972. return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  40973. }
  40974. }, {
  40975. key: "geometryType",
  40976. value: function geometryType() {
  40977. var offset = this.bb.__offset(this.bb_pos, 8);
  40978. return offset ? this.bb.readUint8(this.bb_pos + offset) : geometry_type_GeometryType.Unknown;
  40979. }
  40980. }, {
  40981. key: "hasZ",
  40982. value: function hasZ() {
  40983. var offset = this.bb.__offset(this.bb_pos, 10);
  40984. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  40985. }
  40986. }, {
  40987. key: "hasM",
  40988. value: function hasM() {
  40989. var offset = this.bb.__offset(this.bb_pos, 12);
  40990. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  40991. }
  40992. }, {
  40993. key: "hasT",
  40994. value: function hasT() {
  40995. var offset = this.bb.__offset(this.bb_pos, 14);
  40996. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  40997. }
  40998. }, {
  40999. key: "hasTm",
  41000. value: function hasTm() {
  41001. var offset = this.bb.__offset(this.bb_pos, 16);
  41002. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  41003. }
  41004. }, {
  41005. key: "columns",
  41006. value: function columns(index, obj) {
  41007. var offset = this.bb.__offset(this.bb_pos, 18);
  41008. return offset ? (obj || new column_Column()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
  41009. }
  41010. }, {
  41011. key: "columnsLength",
  41012. value: function columnsLength() {
  41013. var offset = this.bb.__offset(this.bb_pos, 18);
  41014. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  41015. }
  41016. }, {
  41017. key: "featuresCount",
  41018. value: function featuresCount() {
  41019. var offset = this.bb.__offset(this.bb_pos, 20);
  41020. return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
  41021. }
  41022. }, {
  41023. key: "indexNodeSize",
  41024. value: function indexNodeSize() {
  41025. var offset = this.bb.__offset(this.bb_pos, 22);
  41026. return offset ? this.bb.readUint16(this.bb_pos + offset) : 16;
  41027. }
  41028. }, {
  41029. key: "crs",
  41030. value: function crs(obj) {
  41031. var offset = this.bb.__offset(this.bb_pos, 24);
  41032. return offset ? (obj || new Crs()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
  41033. }
  41034. }, {
  41035. key: "title",
  41036. value: function title(optionalEncoding) {
  41037. var offset = this.bb.__offset(this.bb_pos, 26);
  41038. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  41039. }
  41040. }, {
  41041. key: "description",
  41042. value: function description(optionalEncoding) {
  41043. var offset = this.bb.__offset(this.bb_pos, 28);
  41044. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  41045. }
  41046. }, {
  41047. key: "metadata",
  41048. value: function metadata(optionalEncoding) {
  41049. var offset = this.bb.__offset(this.bb_pos, 30);
  41050. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  41051. }
  41052. }], [{
  41053. key: "getRootAsHeader",
  41054. value: function getRootAsHeader(bb, obj) {
  41055. return (obj || new Header()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  41056. }
  41057. }, {
  41058. key: "getSizePrefixedRootAsHeader",
  41059. value: function getSizePrefixedRootAsHeader(bb, obj) {
  41060. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  41061. return (obj || new Header()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  41062. }
  41063. }, {
  41064. key: "startHeader",
  41065. value: function startHeader(builder) {
  41066. builder.startObject(14);
  41067. }
  41068. }, {
  41069. key: "addName",
  41070. value: function addName(builder, nameOffset) {
  41071. builder.addFieldOffset(0, nameOffset, 0);
  41072. }
  41073. }, {
  41074. key: "addEnvelope",
  41075. value: function addEnvelope(builder, envelopeOffset) {
  41076. builder.addFieldOffset(1, envelopeOffset, 0);
  41077. }
  41078. }, {
  41079. key: "createEnvelopeVector",
  41080. value: function createEnvelopeVector(builder, data) {
  41081. builder.startVector(8, data.length, 8);
  41082. for (var i = data.length - 1; i >= 0; i--) {
  41083. builder.addFloat64(data[i]);
  41084. }
  41085. return builder.endVector();
  41086. }
  41087. }, {
  41088. key: "startEnvelopeVector",
  41089. value: function startEnvelopeVector(builder, numElems) {
  41090. builder.startVector(8, numElems, 8);
  41091. }
  41092. }, {
  41093. key: "addGeometryType",
  41094. value: function addGeometryType(builder, geometryType) {
  41095. builder.addFieldInt8(2, geometryType, geometry_type_GeometryType.Unknown);
  41096. }
  41097. }, {
  41098. key: "addHasZ",
  41099. value: function addHasZ(builder, hasZ) {
  41100. builder.addFieldInt8(3, +hasZ, +false);
  41101. }
  41102. }, {
  41103. key: "addHasM",
  41104. value: function addHasM(builder, hasM) {
  41105. builder.addFieldInt8(4, +hasM, +false);
  41106. }
  41107. }, {
  41108. key: "addHasT",
  41109. value: function addHasT(builder, hasT) {
  41110. builder.addFieldInt8(5, +hasT, +false);
  41111. }
  41112. }, {
  41113. key: "addHasTm",
  41114. value: function addHasTm(builder, hasTm) {
  41115. builder.addFieldInt8(6, +hasTm, +false);
  41116. }
  41117. }, {
  41118. key: "addColumns",
  41119. value: function addColumns(builder, columnsOffset) {
  41120. builder.addFieldOffset(7, columnsOffset, 0);
  41121. }
  41122. }, {
  41123. key: "createColumnsVector",
  41124. value: function createColumnsVector(builder, data) {
  41125. builder.startVector(4, data.length, 4);
  41126. for (var i = data.length - 1; i >= 0; i--) {
  41127. builder.addOffset(data[i]);
  41128. }
  41129. return builder.endVector();
  41130. }
  41131. }, {
  41132. key: "startColumnsVector",
  41133. value: function startColumnsVector(builder, numElems) {
  41134. builder.startVector(4, numElems, 4);
  41135. }
  41136. }, {
  41137. key: "addFeaturesCount",
  41138. value: function addFeaturesCount(builder, featuresCount) {
  41139. builder.addFieldInt64(8, featuresCount, BigInt('0'));
  41140. }
  41141. }, {
  41142. key: "addIndexNodeSize",
  41143. value: function addIndexNodeSize(builder, indexNodeSize) {
  41144. builder.addFieldInt16(9, indexNodeSize, 16);
  41145. }
  41146. }, {
  41147. key: "addCrs",
  41148. value: function addCrs(builder, crsOffset) {
  41149. builder.addFieldOffset(10, crsOffset, 0);
  41150. }
  41151. }, {
  41152. key: "addTitle",
  41153. value: function addTitle(builder, titleOffset) {
  41154. builder.addFieldOffset(11, titleOffset, 0);
  41155. }
  41156. }, {
  41157. key: "addDescription",
  41158. value: function addDescription(builder, descriptionOffset) {
  41159. builder.addFieldOffset(12, descriptionOffset, 0);
  41160. }
  41161. }, {
  41162. key: "addMetadata",
  41163. value: function addMetadata(builder, metadataOffset) {
  41164. builder.addFieldOffset(13, metadataOffset, 0);
  41165. }
  41166. }, {
  41167. key: "endHeader",
  41168. value: function endHeader(builder) {
  41169. var offset = builder.endObject();
  41170. return offset;
  41171. }
  41172. }, {
  41173. key: "finishHeaderBuffer",
  41174. value: function finishHeaderBuffer(builder, offset) {
  41175. builder.finish(offset);
  41176. }
  41177. }, {
  41178. key: "finishSizePrefixedHeaderBuffer",
  41179. value: function finishSizePrefixedHeaderBuffer(builder, offset) {
  41180. builder.finish(offset, undefined, true);
  41181. }
  41182. }]);
  41183. return Header;
  41184. }();
  41185. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/header-meta.js
  41186. function fromByteBuffer(bb) {
  41187. var header = header_Header.getRootAsHeader(bb);
  41188. var featuresCount = header.featuresCount();
  41189. var indexNodeSize = header.indexNodeSize();
  41190. var columns = [];
  41191. for (var j = 0; j < header.columnsLength(); j++) {
  41192. var column = header.columns(j);
  41193. if (!column) throw new Error('Column unexpectedly missing');
  41194. if (!column.name()) throw new Error('Column name unexpectedly missing');
  41195. columns.push({
  41196. name: column.name(),
  41197. type: column.type(),
  41198. title: column.title(),
  41199. description: column.description(),
  41200. width: column.width(),
  41201. precision: column.precision(),
  41202. scale: column.scale(),
  41203. nullable: column.nullable(),
  41204. unique: column.unique(),
  41205. primary_key: column.primaryKey()
  41206. });
  41207. }
  41208. var crs = header.crs();
  41209. var crsMeta = crs ? {
  41210. org: crs.org(),
  41211. code: crs.code(),
  41212. name: crs.name(),
  41213. description: crs.description(),
  41214. wkt: crs.wkt(),
  41215. code_string: crs.codeString()
  41216. } : null;
  41217. var headerMeta = {
  41218. geometryType: header.geometryType(),
  41219. columns: columns,
  41220. envelope: null,
  41221. featuresCount: Number(featuresCount),
  41222. indexNodeSize: indexNodeSize,
  41223. crs: crsMeta,
  41224. title: header.title(),
  41225. description: header.description(),
  41226. metadata: header.metadata()
  41227. };
  41228. return headerMeta;
  41229. }
  41230. // EXTERNAL MODULE: ./node_modules/@repeaterjs/repeater/cjs/repeater.js
  41231. var repeater = __webpack_require__(982);
  41232. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/config.js
  41233. function config_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  41234. function config_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  41235. function config_createClass(Constructor, protoProps, staticProps) { if (protoProps) config_defineProperties(Constructor.prototype, protoProps); if (staticProps) config_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  41236. var config_Config = /*#__PURE__*/function () {
  41237. function Config() {
  41238. config_classCallCheck(this, Config);
  41239. this._extraRequestThreshold = 256 * 1024;
  41240. }
  41241. config_createClass(Config, [{
  41242. key: "extraRequestThreshold",
  41243. value: function extraRequestThreshold() {
  41244. return this._extraRequestThreshold;
  41245. }
  41246. }, {
  41247. key: "setExtraRequestThreshold",
  41248. value: function setExtraRequestThreshold(bytes) {
  41249. if (bytes < 0) {
  41250. throw new Error('extraRequestThreshold cannot be negative');
  41251. }
  41252. this._extraRequestThreshold = bytes;
  41253. }
  41254. }]);
  41255. return Config;
  41256. }();
  41257. config_Config.global = new config_Config();
  41258. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/logger.js
  41259. function logger_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  41260. function logger_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  41261. function logger_createClass(Constructor, protoProps, staticProps) { if (protoProps) logger_defineProperties(Constructor.prototype, protoProps); if (staticProps) logger_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  41262. var LogLevel;
  41263. (function (LogLevel) {
  41264. LogLevel[LogLevel["Debug"] = 0] = "Debug";
  41265. LogLevel[LogLevel["Info"] = 1] = "Info";
  41266. LogLevel[LogLevel["Warn"] = 2] = "Warn";
  41267. LogLevel[LogLevel["Error"] = 3] = "Error";
  41268. })(LogLevel || (LogLevel = {}));
  41269. var Logger = /*#__PURE__*/function () {
  41270. function Logger() {
  41271. logger_classCallCheck(this, Logger);
  41272. }
  41273. logger_createClass(Logger, null, [{
  41274. key: "debug",
  41275. value: function debug() {
  41276. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  41277. args[_key] = arguments[_key];
  41278. }
  41279. this.log.apply(this, [LogLevel.Debug].concat(args));
  41280. }
  41281. }, {
  41282. key: "info",
  41283. value: function info() {
  41284. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  41285. args[_key2] = arguments[_key2];
  41286. }
  41287. this.log.apply(this, [LogLevel.Info].concat(args));
  41288. }
  41289. }, {
  41290. key: "warn",
  41291. value: function warn() {
  41292. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  41293. args[_key3] = arguments[_key3];
  41294. }
  41295. this.log.apply(this, [LogLevel.Warn].concat(args));
  41296. }
  41297. }, {
  41298. key: "error",
  41299. value: function error() {
  41300. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  41301. args[_key4] = arguments[_key4];
  41302. }
  41303. this.log.apply(this, [LogLevel.Error].concat(args));
  41304. }
  41305. }, {
  41306. key: "log",
  41307. value: function log(level) {
  41308. if (this.logLevel > level) {
  41309. return;
  41310. }
  41311. for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
  41312. args[_key5 - 1] = arguments[_key5];
  41313. }
  41314. switch (level) {
  41315. case LogLevel.Debug:
  41316. {
  41317. var _console;
  41318. (_console = console).debug.apply(_console, args);
  41319. break;
  41320. }
  41321. case LogLevel.Info:
  41322. {
  41323. var _console2;
  41324. (_console2 = console).info.apply(_console2, args);
  41325. break;
  41326. }
  41327. case LogLevel.Warn:
  41328. {
  41329. var _console3;
  41330. (_console3 = console).warn.apply(_console3, args);
  41331. break;
  41332. }
  41333. case LogLevel.Error:
  41334. {
  41335. var _console4;
  41336. (_console4 = console).error.apply(_console4, args);
  41337. break;
  41338. }
  41339. }
  41340. }
  41341. }]);
  41342. return Logger;
  41343. }();
  41344. Logger.logLevel = LogLevel.Info;
  41345. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/packedrtree.js
  41346. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  41347. function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
  41348. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || packedrtree_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  41349. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  41350. function packedrtree_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return packedrtree_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return packedrtree_arrayLikeToArray(o, minLen); }
  41351. function packedrtree_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  41352. function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  41353. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  41354. function packedrtree_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  41355. function packedrtree_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  41356. function packedrtree_createClass(Constructor, protoProps, staticProps) { if (protoProps) packedrtree_defineProperties(Constructor.prototype, protoProps); if (staticProps) packedrtree_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  41357. function _awaitAsyncGenerator(value) { return new _OverloadYield(value, 0); }
  41358. function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; }
  41359. function _AsyncGenerator(gen) { var front, back; function resume(key, arg) { try { var result = gen[key](arg), value = result.value, overloaded = value instanceof _OverloadYield; Promise.resolve(overloaded ? value.v : value).then(function (arg) { if (overloaded) { var nextKey = "return" === key ? "return" : "next"; if (!value.k || arg.done) return resume(nextKey, arg); arg = gen[nextKey](arg).value; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: !0 }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: !1 }); } (front = front.next) ? resume(front.key, front.arg) : back = null; } this._invoke = function (key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; back ? back = back.next = request : (front = back = request, resume(key, arg)); }); }, "function" != typeof gen["return"] && (this["return"] = void 0); }
  41360. _AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () { return this; }, _AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); }, _AsyncGenerator.prototype["throw"] = function (arg) { return this._invoke("throw", arg); }, _AsyncGenerator.prototype["return"] = function (arg) { return this._invoke("return", arg); };
  41361. function _OverloadYield(value, kind) { this.v = value, this.k = kind; }
  41362. var NODE_ITEM_LEN = 8 * 4 + 8;
  41363. var DEFAULT_NODE_SIZE = 16;
  41364. function calcTreeSize(numItems, nodeSize) {
  41365. nodeSize = Math.min(Math.max(+nodeSize, 2), 65535);
  41366. var n = numItems;
  41367. var numNodes = n;
  41368. do {
  41369. n = Math.ceil(n / nodeSize);
  41370. numNodes += n;
  41371. } while (n !== 1);
  41372. return numNodes * NODE_ITEM_LEN;
  41373. }
  41374. function generateLevelBounds(numItems, nodeSize) {
  41375. if (nodeSize < 2) throw new Error('Node size must be at least 2');
  41376. if (numItems === 0) throw new Error('Number of items must be greater than 0');
  41377. var n = numItems;
  41378. var numNodes = n;
  41379. var levelNumNodes = [n];
  41380. do {
  41381. n = Math.ceil(n / nodeSize);
  41382. numNodes += n;
  41383. levelNumNodes.push(n);
  41384. } while (n !== 1);
  41385. var levelOffsets = [];
  41386. n = numNodes;
  41387. for (var _i = 0, _levelNumNodes = levelNumNodes; _i < _levelNumNodes.length; _i++) {
  41388. var size = _levelNumNodes[_i];
  41389. levelOffsets.push(n - size);
  41390. n -= size;
  41391. }
  41392. levelOffsets.reverse();
  41393. levelNumNodes.reverse();
  41394. var levelBounds = [];
  41395. for (var i = 0; i < levelNumNodes.length; i++) levelBounds.push([levelOffsets[i], levelOffsets[i] + levelNumNodes[i]]);
  41396. levelBounds.reverse();
  41397. return levelBounds;
  41398. }
  41399. function streamSearch(_x, _x2, _x3, _x4) {
  41400. return _streamSearch.apply(this, arguments);
  41401. }
  41402. function _streamSearch() {
  41403. _streamSearch = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(numItems, nodeSize, rect, readNode) {
  41404. var NodeRange, minX, minY, maxX, maxY, levelBounds, leafNodesOffset, rootNodeRange, queue, _loop;
  41405. return _regeneratorRuntime().wrap(function _callee$(_context3) {
  41406. while (1) switch (_context3.prev = _context3.next) {
  41407. case 0:
  41408. NodeRange = /*#__PURE__*/function () {
  41409. function NodeRange(nodes, level) {
  41410. packedrtree_classCallCheck(this, NodeRange);
  41411. this._level = level;
  41412. this.nodes = nodes;
  41413. }
  41414. packedrtree_createClass(NodeRange, [{
  41415. key: "level",
  41416. value: function level() {
  41417. return this._level;
  41418. }
  41419. }, {
  41420. key: "startNode",
  41421. value: function startNode() {
  41422. return this.nodes[0];
  41423. }
  41424. }, {
  41425. key: "endNode",
  41426. value: function endNode() {
  41427. return this.nodes[1];
  41428. }
  41429. }, {
  41430. key: "extendEndNodeToNewOffset",
  41431. value: function extendEndNodeToNewOffset(newOffset) {
  41432. console.assert(newOffset > this.nodes[1]);
  41433. this.nodes[1] = newOffset;
  41434. }
  41435. }, {
  41436. key: "toString",
  41437. value: function toString() {
  41438. return "[NodeRange level: ".concat(this._level, ", nodes: ").concat(this.nodes[0], "-").concat(this.nodes[1], "]");
  41439. }
  41440. }]);
  41441. return NodeRange;
  41442. }();
  41443. minX = rect.minX, minY = rect.minY, maxX = rect.maxX, maxY = rect.maxY;
  41444. Logger.info("tree items: ".concat(numItems, ", nodeSize: ").concat(nodeSize));
  41445. levelBounds = generateLevelBounds(numItems, nodeSize);
  41446. leafNodesOffset = levelBounds[0][0];
  41447. rootNodeRange = function () {
  41448. var range = [0, 1];
  41449. var level = levelBounds.length - 1;
  41450. return new NodeRange(range, level);
  41451. }();
  41452. queue = [rootNodeRange];
  41453. Logger.debug("starting stream search with queue: ".concat(queue, ", numItems: ").concat(numItems, ", nodeSize: ").concat(nodeSize, ", levelBounds: ").concat(levelBounds));
  41454. _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
  41455. var nodeRange, nodeIndex, isLeafNode, _levelBounds$nodeRang, levelBound, end, length, buffer, float64Array, uint32Array, _loop2, _ret, pos;
  41456. return _regeneratorRuntime().wrap(function _loop$(_context2) {
  41457. while (1) switch (_context2.prev = _context2.next) {
  41458. case 0:
  41459. nodeRange = queue.shift();
  41460. Logger.debug("popped node: ".concat(nodeRange, ", queueLength: ").concat(queue.length));
  41461. nodeIndex = nodeRange.startNode();
  41462. isLeafNode = nodeIndex >= leafNodesOffset;
  41463. _levelBounds$nodeRang = _slicedToArray(levelBounds[nodeRange.level()], 2), levelBound = _levelBounds$nodeRang[1];
  41464. end = Math.min(nodeRange.endNode() + nodeSize, levelBound);
  41465. length = end - nodeIndex;
  41466. _context2.next = 9;
  41467. return _awaitAsyncGenerator(readNode(nodeIndex * NODE_ITEM_LEN, length * NODE_ITEM_LEN));
  41468. case 9:
  41469. buffer = _context2.sent;
  41470. float64Array = new Float64Array(buffer);
  41471. uint32Array = new Uint32Array(buffer);
  41472. _loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2(pos) {
  41473. var nodePos, low32Offset, high32Offset, offset, featureLength, extraRequestThresholdNodes, nearestNodeRange, newNodeRange;
  41474. return _regeneratorRuntime().wrap(function _loop2$(_context) {
  41475. while (1) switch (_context.prev = _context.next) {
  41476. case 0:
  41477. nodePos = (pos - nodeIndex) * 5;
  41478. if (!(maxX < float64Array[nodePos + 0])) {
  41479. _context.next = 3;
  41480. break;
  41481. }
  41482. return _context.abrupt("return", 0);
  41483. case 3:
  41484. if (!(maxY < float64Array[nodePos + 1])) {
  41485. _context.next = 5;
  41486. break;
  41487. }
  41488. return _context.abrupt("return", 0);
  41489. case 5:
  41490. if (!(minX > float64Array[nodePos + 2])) {
  41491. _context.next = 7;
  41492. break;
  41493. }
  41494. return _context.abrupt("return", 0);
  41495. case 7:
  41496. if (!(minY > float64Array[nodePos + 3])) {
  41497. _context.next = 9;
  41498. break;
  41499. }
  41500. return _context.abrupt("return", 0);
  41501. case 9:
  41502. low32Offset = uint32Array[(nodePos << 1) + 8];
  41503. high32Offset = uint32Array[(nodePos << 1) + 9];
  41504. offset = readUint52(high32Offset, low32Offset);
  41505. if (!isLeafNode) {
  41506. _context.next = 17;
  41507. break;
  41508. }
  41509. featureLength = function () {
  41510. if (pos < numItems - 1) {
  41511. var nextPos = (pos - nodeIndex + 1) * 5;
  41512. var _low32Offset = uint32Array[(nextPos << 1) + 8];
  41513. var _high32Offset = uint32Array[(nextPos << 1) + 9];
  41514. var nextOffset = readUint52(_high32Offset, _low32Offset);
  41515. return nextOffset - offset;
  41516. } else {
  41517. return null;
  41518. }
  41519. }();
  41520. _context.next = 16;
  41521. return [offset, pos - leafNodesOffset, featureLength];
  41522. case 16:
  41523. return _context.abrupt("return", 0);
  41524. case 17:
  41525. extraRequestThresholdNodes = config_Config.global.extraRequestThreshold() / NODE_ITEM_LEN;
  41526. nearestNodeRange = queue[queue.length - 1];
  41527. if (!(nearestNodeRange !== undefined && nearestNodeRange.level() == nodeRange.level() - 1 && offset < nearestNodeRange.endNode() + extraRequestThresholdNodes)) {
  41528. _context.next = 23;
  41529. break;
  41530. }
  41531. Logger.debug("Merging \"nodeRange\" request into existing range: ".concat(nearestNodeRange, ", newOffset: ").concat(nearestNodeRange.endNode(), " -> ").concat(offset));
  41532. nearestNodeRange.extendEndNodeToNewOffset(offset);
  41533. return _context.abrupt("return", 0);
  41534. case 23:
  41535. newNodeRange = function () {
  41536. var level = nodeRange.level() - 1;
  41537. var range = [offset, offset + 1];
  41538. return new NodeRange(range, level);
  41539. }();
  41540. if (nearestNodeRange !== undefined && nearestNodeRange.level() == newNodeRange.level()) {
  41541. Logger.info("Same level, but too far away. Pushing new request at offset: ".concat(offset, " rather than merging with distant ").concat(nearestNodeRange));
  41542. } else {
  41543. Logger.info("Pushing new level for ".concat(newNodeRange, " onto queue with nearestNodeRange: ").concat(nearestNodeRange, " since there's not already a range for this level."));
  41544. }
  41545. queue.push(newNodeRange);
  41546. case 26:
  41547. case "end":
  41548. return _context.stop();
  41549. }
  41550. }, _loop2);
  41551. });
  41552. pos = nodeIndex;
  41553. case 14:
  41554. if (!(pos < end)) {
  41555. _context2.next = 22;
  41556. break;
  41557. }
  41558. return _context2.delegateYield(_loop2(pos), "t0", 16);
  41559. case 16:
  41560. _ret = _context2.t0;
  41561. if (!(_ret === 0)) {
  41562. _context2.next = 19;
  41563. break;
  41564. }
  41565. return _context2.abrupt("continue", 19);
  41566. case 19:
  41567. pos++;
  41568. _context2.next = 14;
  41569. break;
  41570. case 22:
  41571. case "end":
  41572. return _context2.stop();
  41573. }
  41574. }, _loop);
  41575. });
  41576. case 9:
  41577. if (!(queue.length != 0)) {
  41578. _context3.next = 13;
  41579. break;
  41580. }
  41581. return _context3.delegateYield(_loop(), "t0", 11);
  41582. case 11:
  41583. _context3.next = 9;
  41584. break;
  41585. case 13:
  41586. case "end":
  41587. return _context3.stop();
  41588. }
  41589. }, _callee);
  41590. }));
  41591. return _streamSearch.apply(this, arguments);
  41592. }
  41593. function readUint52(high32Bits, low32Bits) {
  41594. if ((high32Bits & 0xfff00000) != 0) {
  41595. throw Error('integer is too large to be safely represented');
  41596. }
  41597. var result = low32Bits + high32Bits * Math.pow(2, 32);
  41598. return result;
  41599. }
  41600. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/constants.js
  41601. var constants_magicbytes = new Uint8Array([0x66, 0x67, 0x62, 0x03, 0x66, 0x67, 0x62, 0x00]);
  41602. var SIZE_PREFIX_LEN = 4;
  41603. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/http-reader.js
  41604. function http_reader_typeof(obj) { "@babel/helpers - typeof"; return http_reader_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, http_reader_typeof(obj); }
  41605. function http_reader_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = http_reader_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  41606. function http_reader_slicedToArray(arr, i) { return http_reader_arrayWithHoles(arr) || http_reader_iterableToArrayLimit(arr, i) || http_reader_unsupportedIterableToArray(arr, i) || http_reader_nonIterableRest(); }
  41607. function http_reader_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  41608. function http_reader_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return http_reader_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return http_reader_arrayLikeToArray(o, minLen); }
  41609. function http_reader_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  41610. function http_reader_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  41611. function http_reader_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  41612. function http_reader_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ http_reader_regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == http_reader_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
  41613. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  41614. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  41615. function http_reader_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  41616. function http_reader_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  41617. function http_reader_createClass(Constructor, protoProps, staticProps) { if (protoProps) http_reader_defineProperties(Constructor.prototype, protoProps); if (staticProps) http_reader_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  41618. function http_reader_wrapAsyncGenerator(fn) { return function () { return new http_reader_AsyncGenerator(fn.apply(this, arguments)); }; }
  41619. function http_reader_AsyncGenerator(gen) { var front, back; function resume(key, arg) { try { var result = gen[key](arg), value = result.value, overloaded = value instanceof http_reader_OverloadYield; Promise.resolve(overloaded ? value.v : value).then(function (arg) { if (overloaded) { var nextKey = "return" === key ? "return" : "next"; if (!value.k || arg.done) return resume(nextKey, arg); arg = gen[nextKey](arg).value; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: !0 }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: !1 }); } (front = front.next) ? resume(front.key, front.arg) : back = null; } this._invoke = function (key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; back ? back = back.next = request : (front = back = request, resume(key, arg)); }); }, "function" != typeof gen["return"] && (this["return"] = void 0); }
  41620. http_reader_AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () { return this; }, http_reader_AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); }, http_reader_AsyncGenerator.prototype["throw"] = function (arg) { return this._invoke("throw", arg); }, http_reader_AsyncGenerator.prototype["return"] = function (arg) { return this._invoke("return", arg); };
  41621. function http_reader_awaitAsyncGenerator(value) { return new http_reader_OverloadYield(value, 0); }
  41622. function _asyncGeneratorDelegate(inner) { var iter = {}, waiting = !1; function pump(key, value) { return waiting = !0, value = new Promise(function (resolve) { resolve(inner[key](value)); }), { done: !1, value: new http_reader_OverloadYield(value, 1) }; } return iter["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () { return this; }, iter.next = function (value) { return waiting ? (waiting = !1, value) : pump("next", value); }, "function" == typeof inner["throw"] && (iter["throw"] = function (value) { if (waiting) throw waiting = !1, value; return pump("throw", value); }), "function" == typeof inner["return"] && (iter["return"] = function (value) { return waiting ? (waiting = !1, value) : pump("return", value); }), iter; }
  41623. function http_reader_OverloadYield(value, kind) { this.v = value, this.k = kind; }
  41624. function _asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
  41625. function AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(value) { var ret = this.s["return"]; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, "throw": function _throw(value) { var thr = this.s["return"]; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(s); }
  41626. var HttpReader = /*#__PURE__*/function () {
  41627. function HttpReader(headerClient, header, headerLength, indexLength) {
  41628. http_reader_classCallCheck(this, HttpReader);
  41629. this.headerClient = headerClient;
  41630. this.header = header;
  41631. this.headerLength = headerLength;
  41632. this.indexLength = indexLength;
  41633. }
  41634. http_reader_createClass(HttpReader, [{
  41635. key: "selectBbox",
  41636. value: function selectBbox(rect) {
  41637. var _this = this;
  41638. return http_reader_wrapAsyncGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee2() {
  41639. var lengthBeforeTree, bufferedClient, readNode, batches, currentBatch, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, searchResult, _searchResult2, featureOffset, _searchResult4, featureLength, guessLength, prevFeature, gap, promises;
  41640. return http_reader_regeneratorRuntime().wrap(function _callee2$(_context2) {
  41641. while (1) switch (_context2.prev = _context2.next) {
  41642. case 0:
  41643. lengthBeforeTree = _this.lengthBeforeTree();
  41644. bufferedClient = _this.headerClient;
  41645. readNode = /*#__PURE__*/function () {
  41646. var _ref = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee(offsetIntoTree, size) {
  41647. var minReqLength;
  41648. return http_reader_regeneratorRuntime().wrap(function _callee$(_context) {
  41649. while (1) switch (_context.prev = _context.next) {
  41650. case 0:
  41651. minReqLength = 0;
  41652. return _context.abrupt("return", bufferedClient.getRange(lengthBeforeTree + offsetIntoTree, size, minReqLength, 'index'));
  41653. case 2:
  41654. case "end":
  41655. return _context.stop();
  41656. }
  41657. }, _callee);
  41658. }));
  41659. return function readNode(_x, _x2) {
  41660. return _ref.apply(this, arguments);
  41661. };
  41662. }();
  41663. batches = [];
  41664. currentBatch = [];
  41665. _iteratorAbruptCompletion = false;
  41666. _didIteratorError = false;
  41667. _context2.prev = 7;
  41668. _iterator = _asyncIterator(streamSearch(_this.header.featuresCount, _this.header.indexNodeSize, rect, readNode));
  41669. case 9:
  41670. _context2.next = 11;
  41671. return http_reader_awaitAsyncGenerator(_iterator.next());
  41672. case 11:
  41673. if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
  41674. _context2.next = 26;
  41675. break;
  41676. }
  41677. searchResult = _step.value;
  41678. _searchResult2 = http_reader_slicedToArray(searchResult, 2), featureOffset = _searchResult2[0];
  41679. _searchResult4 = http_reader_slicedToArray(searchResult, 3), featureLength = _searchResult4[2];
  41680. if (!featureLength) {
  41681. Logger.info('final feature');
  41682. guessLength = config_Config.global.extraRequestThreshold();
  41683. featureLength = guessLength;
  41684. }
  41685. if (!(currentBatch.length == 0)) {
  41686. _context2.next = 19;
  41687. break;
  41688. }
  41689. currentBatch.push([featureOffset, featureLength]);
  41690. return _context2.abrupt("continue", 23);
  41691. case 19:
  41692. prevFeature = currentBatch[currentBatch.length - 1];
  41693. gap = featureOffset - (prevFeature[0] + prevFeature[1]);
  41694. if (gap > config_Config.global.extraRequestThreshold()) {
  41695. Logger.info("Pushing new feature batch, since gap ".concat(gap, " was too large"));
  41696. batches.push(currentBatch);
  41697. currentBatch = [];
  41698. }
  41699. currentBatch.push([featureOffset, featureLength]);
  41700. case 23:
  41701. _iteratorAbruptCompletion = false;
  41702. _context2.next = 9;
  41703. break;
  41704. case 26:
  41705. _context2.next = 32;
  41706. break;
  41707. case 28:
  41708. _context2.prev = 28;
  41709. _context2.t0 = _context2["catch"](7);
  41710. _didIteratorError = true;
  41711. _iteratorError = _context2.t0;
  41712. case 32:
  41713. _context2.prev = 32;
  41714. _context2.prev = 33;
  41715. if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
  41716. _context2.next = 37;
  41717. break;
  41718. }
  41719. _context2.next = 37;
  41720. return http_reader_awaitAsyncGenerator(_iterator["return"]());
  41721. case 37:
  41722. _context2.prev = 37;
  41723. if (!_didIteratorError) {
  41724. _context2.next = 40;
  41725. break;
  41726. }
  41727. throw _iteratorError;
  41728. case 40:
  41729. return _context2.finish(37);
  41730. case 41:
  41731. return _context2.finish(32);
  41732. case 42:
  41733. _this.headerClient.logUsage('header+index');
  41734. if (currentBatch.length > 0) {
  41735. batches.push(currentBatch);
  41736. }
  41737. promises = batches.flatMap(function (batch) {
  41738. return _this.readFeatureBatch(batch);
  41739. });
  41740. return _context2.delegateYield(_asyncGeneratorDelegate(_asyncIterator(repeater/* Repeater */.ZN.merge(promises)), http_reader_awaitAsyncGenerator), "t1", 46);
  41741. case 46:
  41742. case "end":
  41743. return _context2.stop();
  41744. }
  41745. }, _callee2, null, [[7, 28, 32, 42], [33,, 37, 41]]);
  41746. }))();
  41747. }
  41748. }, {
  41749. key: "lengthBeforeTree",
  41750. value: function lengthBeforeTree() {
  41751. return constants_magicbytes.length + SIZE_PREFIX_LEN + this.headerLength;
  41752. }
  41753. }, {
  41754. key: "lengthBeforeFeatures",
  41755. value: function lengthBeforeFeatures() {
  41756. return this.lengthBeforeTree() + this.indexLength;
  41757. }
  41758. }, {
  41759. key: "buildFeatureClient",
  41760. value: function buildFeatureClient() {
  41761. return new BufferedHttpRangeClient(this.headerClient.httpClient);
  41762. }
  41763. }, {
  41764. key: "readFeatureBatch",
  41765. value: function readFeatureBatch(batch) {
  41766. var _this2 = this;
  41767. return http_reader_wrapAsyncGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee3() {
  41768. var _batch$, firstFeatureOffset, _batch, lastFeatureOffset, lastFeatureLength, batchStart, batchEnd, batchSize, featureClient, _iterator2, _step2, _step2$value2, featureOffset;
  41769. return http_reader_regeneratorRuntime().wrap(function _callee3$(_context3) {
  41770. while (1) switch (_context3.prev = _context3.next) {
  41771. case 0:
  41772. _batch$ = http_reader_slicedToArray(batch[0], 1), firstFeatureOffset = _batch$[0];
  41773. _batch = http_reader_slicedToArray(batch[batch.length - 1], 2), lastFeatureOffset = _batch[0], lastFeatureLength = _batch[1];
  41774. batchStart = firstFeatureOffset;
  41775. batchEnd = lastFeatureOffset + lastFeatureLength;
  41776. batchSize = batchEnd - batchStart;
  41777. featureClient = _this2.buildFeatureClient();
  41778. _iterator2 = http_reader_createForOfIteratorHelper(batch);
  41779. _context3.prev = 7;
  41780. _iterator2.s();
  41781. case 9:
  41782. if ((_step2 = _iterator2.n()).done) {
  41783. _context3.next = 17;
  41784. break;
  41785. }
  41786. _step2$value2 = http_reader_slicedToArray(_step2.value, 1), featureOffset = _step2$value2[0];
  41787. _context3.next = 13;
  41788. return http_reader_awaitAsyncGenerator(_this2.readFeature(featureClient, featureOffset, batchSize));
  41789. case 13:
  41790. _context3.next = 15;
  41791. return _context3.sent;
  41792. case 15:
  41793. _context3.next = 9;
  41794. break;
  41795. case 17:
  41796. _context3.next = 22;
  41797. break;
  41798. case 19:
  41799. _context3.prev = 19;
  41800. _context3.t0 = _context3["catch"](7);
  41801. _iterator2.e(_context3.t0);
  41802. case 22:
  41803. _context3.prev = 22;
  41804. _iterator2.f();
  41805. return _context3.finish(22);
  41806. case 25:
  41807. featureClient.logUsage('feature');
  41808. case 26:
  41809. case "end":
  41810. return _context3.stop();
  41811. }
  41812. }, _callee3, null, [[7, 19, 22, 25]]);
  41813. }))();
  41814. }
  41815. }, {
  41816. key: "readFeature",
  41817. value: function () {
  41818. var _readFeature = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee4(featureClient, featureOffset, minFeatureReqLength) {
  41819. var offset, featureLength, _bytes, byteBuffer, bytes, bytesAligned, bb;
  41820. return http_reader_regeneratorRuntime().wrap(function _callee4$(_context4) {
  41821. while (1) switch (_context4.prev = _context4.next) {
  41822. case 0:
  41823. offset = featureOffset + this.lengthBeforeFeatures();
  41824. _context4.next = 3;
  41825. return featureClient.getRange(offset, 4, minFeatureReqLength, 'feature length');
  41826. case 3:
  41827. _bytes = _context4.sent;
  41828. featureLength = new DataView(_bytes).getUint32(0, true);
  41829. _context4.next = 7;
  41830. return featureClient.getRange(offset + 4, featureLength, minFeatureReqLength, 'feature data');
  41831. case 7:
  41832. byteBuffer = _context4.sent;
  41833. bytes = new Uint8Array(byteBuffer);
  41834. bytesAligned = new Uint8Array(featureLength + SIZE_PREFIX_LEN);
  41835. bytesAligned.set(bytes, SIZE_PREFIX_LEN);
  41836. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytesAligned);
  41837. bb.setPosition(SIZE_PREFIX_LEN);
  41838. return _context4.abrupt("return", feature_Feature.getRootAsFeature(bb));
  41839. case 14:
  41840. case "end":
  41841. return _context4.stop();
  41842. }
  41843. }, _callee4, this);
  41844. }));
  41845. function readFeature(_x3, _x4, _x5) {
  41846. return _readFeature.apply(this, arguments);
  41847. }
  41848. return readFeature;
  41849. }()
  41850. }], [{
  41851. key: "open",
  41852. value: function () {
  41853. var _open = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee5(url) {
  41854. var assumedHeaderLength, headerClient, assumedIndexLength, minReqLength, _bytes2, headerLength, _bytes3, HEADER_MAX_BUFFER_SIZE, bytes, bb, header, indexLength;
  41855. return http_reader_regeneratorRuntime().wrap(function _callee5$(_context5) {
  41856. while (1) switch (_context5.prev = _context5.next) {
  41857. case 0:
  41858. assumedHeaderLength = 2024;
  41859. headerClient = new BufferedHttpRangeClient(url);
  41860. assumedIndexLength = function () {
  41861. var assumedBranchingFactor = DEFAULT_NODE_SIZE;
  41862. var prefetchedLayers = 3;
  41863. var result = 0;
  41864. var i;
  41865. for (i = 0; i < prefetchedLayers; i++) {
  41866. var layer_width = Math.pow(assumedBranchingFactor, i) * NODE_ITEM_LEN;
  41867. result += layer_width;
  41868. }
  41869. return result;
  41870. }();
  41871. minReqLength = assumedHeaderLength + assumedIndexLength;
  41872. Logger.debug("fetching header. minReqLength: ".concat(minReqLength, " (assumedHeaderLength: ").concat(assumedHeaderLength, ", assumedIndexLength: ").concat(assumedIndexLength, ")"));
  41873. _context5.t0 = Uint8Array;
  41874. _context5.next = 8;
  41875. return headerClient.getRange(0, 8, minReqLength, 'header');
  41876. case 8:
  41877. _context5.t1 = _context5.sent;
  41878. _bytes2 = new _context5.t0(_context5.t1);
  41879. if (_bytes2.subarray(0, 3).every(function (v, i) {
  41880. return constants_magicbytes[i] === v;
  41881. })) {
  41882. _context5.next = 13;
  41883. break;
  41884. }
  41885. Logger.error("bytes: ".concat(_bytes2, " != ").concat(constants_magicbytes));
  41886. throw new Error('Not a FlatGeobuf file');
  41887. case 13:
  41888. Logger.debug('magic bytes look good');
  41889. _context5.next = 16;
  41890. return headerClient.getRange(8, 4, minReqLength, 'header');
  41891. case 16:
  41892. _bytes3 = _context5.sent;
  41893. headerLength = new DataView(_bytes3).getUint32(0, true);
  41894. HEADER_MAX_BUFFER_SIZE = 1048576 * 10;
  41895. if (!(headerLength > HEADER_MAX_BUFFER_SIZE || headerLength < 8)) {
  41896. _context5.next = 21;
  41897. break;
  41898. }
  41899. throw new Error('Invalid header size');
  41900. case 21:
  41901. Logger.debug("headerLength: ".concat(headerLength));
  41902. _context5.next = 24;
  41903. return headerClient.getRange(12, headerLength, minReqLength, 'header');
  41904. case 24:
  41905. bytes = _context5.sent;
  41906. bb = new js_flatbuffers/* ByteBuffer */.cZ(new Uint8Array(bytes));
  41907. header = fromByteBuffer(bb);
  41908. indexLength = calcTreeSize(header.featuresCount, header.indexNodeSize);
  41909. Logger.debug('completed: opening http reader');
  41910. return _context5.abrupt("return", new HttpReader(headerClient, header, headerLength, indexLength));
  41911. case 30:
  41912. case "end":
  41913. return _context5.stop();
  41914. }
  41915. }, _callee5);
  41916. }));
  41917. function open(_x6) {
  41918. return _open.apply(this, arguments);
  41919. }
  41920. return open;
  41921. }()
  41922. }]);
  41923. return HttpReader;
  41924. }();
  41925. var BufferedHttpRangeClient = /*#__PURE__*/function () {
  41926. function BufferedHttpRangeClient(source) {
  41927. http_reader_classCallCheck(this, BufferedHttpRangeClient);
  41928. this.bytesEverUsed = 0;
  41929. this.bytesEverFetched = 0;
  41930. this.buffer = new ArrayBuffer(0);
  41931. this.head = 0;
  41932. if (typeof source === 'string') {
  41933. this.httpClient = new HttpRangeClient(source);
  41934. } else {
  41935. this.httpClient = source;
  41936. }
  41937. }
  41938. http_reader_createClass(BufferedHttpRangeClient, [{
  41939. key: "getRange",
  41940. value: function () {
  41941. var _getRange = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee6(start, length, minReqLength, purpose) {
  41942. var start_i, end_i, lengthToFetch;
  41943. return http_reader_regeneratorRuntime().wrap(function _callee6$(_context6) {
  41944. while (1) switch (_context6.prev = _context6.next) {
  41945. case 0:
  41946. this.bytesEverUsed += length;
  41947. start_i = start - this.head;
  41948. end_i = start_i + length;
  41949. if (!(start_i >= 0 && end_i <= this.buffer.byteLength)) {
  41950. _context6.next = 5;
  41951. break;
  41952. }
  41953. return _context6.abrupt("return", this.buffer.slice(start_i, end_i));
  41954. case 5:
  41955. lengthToFetch = Math.max(length, minReqLength);
  41956. this.bytesEverFetched += lengthToFetch;
  41957. Logger.debug("requesting for new Range: ".concat(start, "-").concat(start + length - 1));
  41958. _context6.next = 10;
  41959. return this.httpClient.getRange(start, lengthToFetch, purpose);
  41960. case 10:
  41961. this.buffer = _context6.sent;
  41962. this.head = start;
  41963. return _context6.abrupt("return", this.buffer.slice(0, length));
  41964. case 13:
  41965. case "end":
  41966. return _context6.stop();
  41967. }
  41968. }, _callee6, this);
  41969. }));
  41970. function getRange(_x7, _x8, _x9, _x10) {
  41971. return _getRange.apply(this, arguments);
  41972. }
  41973. return getRange;
  41974. }()
  41975. }, {
  41976. key: "logUsage",
  41977. value: function logUsage(purpose) {
  41978. var category = purpose.split(' ')[0];
  41979. var used = this.bytesEverUsed;
  41980. var requested = this.bytesEverFetched;
  41981. var efficiency = (100.0 * used / requested).toFixed(2);
  41982. Logger.info("".concat(category, " bytes used/requested: ").concat(used, " / ").concat(requested, " = ").concat(efficiency, "%"));
  41983. }
  41984. }]);
  41985. return BufferedHttpRangeClient;
  41986. }();
  41987. var HttpRangeClient = /*#__PURE__*/function () {
  41988. function HttpRangeClient(url) {
  41989. http_reader_classCallCheck(this, HttpRangeClient);
  41990. this.requestsEverMade = 0;
  41991. this.bytesEverRequested = 0;
  41992. this.url = url;
  41993. }
  41994. http_reader_createClass(HttpRangeClient, [{
  41995. key: "getRange",
  41996. value: function () {
  41997. var _getRange2 = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee7(begin, length, purpose) {
  41998. var range, response;
  41999. return http_reader_regeneratorRuntime().wrap(function _callee7$(_context7) {
  42000. while (1) switch (_context7.prev = _context7.next) {
  42001. case 0:
  42002. this.requestsEverMade += 1;
  42003. this.bytesEverRequested += length;
  42004. range = "bytes=".concat(begin, "-").concat(begin + length - 1);
  42005. Logger.info("request: #".concat(this.requestsEverMade, ", purpose: ").concat(purpose, "), bytes: (this_request: ").concat(length, ", ever: ").concat(this.bytesEverRequested, "), Range: ").concat(range));
  42006. _context7.next = 6;
  42007. return fetch(this.url, {
  42008. headers: {
  42009. Range: range
  42010. }
  42011. });
  42012. case 6:
  42013. response = _context7.sent;
  42014. return _context7.abrupt("return", response.arrayBuffer());
  42015. case 8:
  42016. case "end":
  42017. return _context7.stop();
  42018. }
  42019. }, _callee7, this);
  42020. }));
  42021. function getRange(_x11, _x12, _x13) {
  42022. return _getRange2.apply(this, arguments);
  42023. }
  42024. return getRange;
  42025. }()
  42026. }]);
  42027. return HttpRangeClient;
  42028. }();
  42029. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/generic/header.js
  42030. function header_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = header_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  42031. function header_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return header_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return header_arrayLikeToArray(o, minLen); }
  42032. function header_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  42033. function featureGeomType(feature) {
  42034. if (feature.getGeometry) {
  42035. return toGeometryType(feature.getGeometry().getType());
  42036. } else {
  42037. return toGeometryType(feature.geometry.type);
  42038. }
  42039. }
  42040. function header_inferGeometryType(features) {
  42041. var geometryType = undefined;
  42042. var _iterator = header_createForOfIteratorHelper(features),
  42043. _step;
  42044. try {
  42045. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  42046. var f = _step.value;
  42047. if (geometryType === GeometryType.Unknown) {
  42048. break;
  42049. }
  42050. var gtype = featureGeomType(f);
  42051. if (geometryType === undefined) {
  42052. geometryType = gtype;
  42053. } else if (geometryType !== gtype) {
  42054. geometryType = GeometryType.Unknown;
  42055. }
  42056. }
  42057. } catch (err) {
  42058. _iterator.e(err);
  42059. } finally {
  42060. _iterator.f();
  42061. }
  42062. if (geometryType === undefined) {
  42063. throw new Error('Could not infer geometry type for collection of features.');
  42064. }
  42065. return geometryType;
  42066. }
  42067. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/generic/featurecollection.js
  42068. function featurecollection_typeof(obj) { "@babel/helpers - typeof"; return featurecollection_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, featurecollection_typeof(obj); }
  42069. function featurecollection_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ featurecollection_regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == featurecollection_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
  42070. function featurecollection_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  42071. function featurecollection_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { featurecollection_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { featurecollection_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  42072. function featurecollection_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = featurecollection_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  42073. function featurecollection_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return featurecollection_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return featurecollection_arrayLikeToArray(o, minLen); }
  42074. function featurecollection_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  42075. function featurecollection_asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new featurecollection_AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
  42076. function featurecollection_AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return featurecollection_AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, featurecollection_AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(value) { var ret = this.s["return"]; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, "throw": function _throw(value) { var thr = this.s["return"]; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new featurecollection_AsyncFromSyncIterator(s); }
  42077. function featurecollection_awaitAsyncGenerator(value) { return new featurecollection_OverloadYield(value, 0); }
  42078. function featurecollection_wrapAsyncGenerator(fn) { return function () { return new featurecollection_AsyncGenerator(fn.apply(this, arguments)); }; }
  42079. function featurecollection_AsyncGenerator(gen) { var front, back; function resume(key, arg) { try { var result = gen[key](arg), value = result.value, overloaded = value instanceof featurecollection_OverloadYield; Promise.resolve(overloaded ? value.v : value).then(function (arg) { if (overloaded) { var nextKey = "return" === key ? "return" : "next"; if (!value.k || arg.done) return resume(nextKey, arg); arg = gen[nextKey](arg).value; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: !0 }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: !1 }); } (front = front.next) ? resume(front.key, front.arg) : back = null; } this._invoke = function (key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; back ? back = back.next = request : (front = back = request, resume(key, arg)); }); }, "function" != typeof gen["return"] && (this["return"] = void 0); }
  42080. featurecollection_AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () { return this; }, featurecollection_AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); }, featurecollection_AsyncGenerator.prototype["throw"] = function (arg) { return this._invoke("throw", arg); }, featurecollection_AsyncGenerator.prototype["return"] = function (arg) { return this._invoke("return", arg); };
  42081. function featurecollection_OverloadYield(value, kind) { this.v = value, this.k = kind; }
  42082. function serialize(features) {
  42083. var headerMeta = introspectHeaderMeta(features);
  42084. var header = featurecollection_buildHeader(headerMeta);
  42085. var featureBuffers = features.map(function (f) {
  42086. if (!f.getGeometry) throw new Error('Missing getGeometry implementation');
  42087. if (!f.getProperties) throw new Error('Missing getProperties implementation');
  42088. return buildFeature(parseGeometry(f.getGeometry(), headerMeta.geometryType), f.getProperties(), headerMeta);
  42089. });
  42090. var featuresLength = featureBuffers.map(function (f) {
  42091. return f.length;
  42092. }).reduce(function (a, b) {
  42093. return a + b;
  42094. });
  42095. var uint8 = new Uint8Array(magicbytes.length + header.length + featuresLength);
  42096. uint8.set(header, magicbytes.length);
  42097. var offset = magicbytes.length + header.length;
  42098. var _iterator2 = featurecollection_createForOfIteratorHelper(featureBuffers),
  42099. _step2;
  42100. try {
  42101. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  42102. var feature = _step2.value;
  42103. uint8.set(feature, offset);
  42104. offset += feature.length;
  42105. }
  42106. } catch (err) {
  42107. _iterator2.e(err);
  42108. } finally {
  42109. _iterator2.f();
  42110. }
  42111. uint8.set(magicbytes);
  42112. return uint8;
  42113. }
  42114. function deserialize(bytes, fromFeature, headerMetaFn) {
  42115. if (!bytes.subarray(0, 3).every(function (v, i) {
  42116. return constants_magicbytes[i] === v;
  42117. })) throw new Error('Not a FlatGeobuf file');
  42118. var bb = new js_flatbuffers/* ByteBuffer */.cZ(bytes);
  42119. var headerLength = bb.readUint32(constants_magicbytes.length);
  42120. bb.setPosition(constants_magicbytes.length + SIZE_PREFIX_LEN);
  42121. var headerMeta = fromByteBuffer(bb);
  42122. if (headerMetaFn) headerMetaFn(headerMeta);
  42123. var offset = constants_magicbytes.length + SIZE_PREFIX_LEN + headerLength;
  42124. var indexNodeSize = headerMeta.indexNodeSize,
  42125. featuresCount = headerMeta.featuresCount;
  42126. if (indexNodeSize > 0) offset += calcTreeSize(featuresCount, indexNodeSize);
  42127. var features = [];
  42128. while (offset < bb.capacity()) {
  42129. var featureLength = bb.readUint32(offset);
  42130. bb.setPosition(offset + SIZE_PREFIX_LEN);
  42131. var feature = feature_Feature.getRootAsFeature(bb);
  42132. features.push(fromFeature(feature, headerMeta));
  42133. offset += SIZE_PREFIX_LEN + featureLength;
  42134. }
  42135. return features;
  42136. }
  42137. function deserializeStream(_x, _x2, _x3) {
  42138. return _deserializeStream.apply(this, arguments);
  42139. }
  42140. function _deserializeStream() {
  42141. _deserializeStream = featurecollection_wrapAsyncGenerator( /*#__PURE__*/featurecollection_regeneratorRuntime().mark(function _callee2(stream, fromFeature, headerMetaFn) {
  42142. var reader, read, bytes, bb, headerLength, headerMeta, indexNodeSize, featuresCount, treeSize, feature;
  42143. return featurecollection_regeneratorRuntime().wrap(function _callee2$(_context2) {
  42144. while (1) switch (_context2.prev = _context2.next) {
  42145. case 0:
  42146. reader = slice_source(stream);
  42147. read = /*#__PURE__*/function () {
  42148. var _ref = featurecollection_asyncToGenerator( /*#__PURE__*/featurecollection_regeneratorRuntime().mark(function _callee(size) {
  42149. return featurecollection_regeneratorRuntime().wrap(function _callee$(_context) {
  42150. while (1) switch (_context.prev = _context.next) {
  42151. case 0:
  42152. _context.next = 2;
  42153. return reader.slice(size);
  42154. case 2:
  42155. return _context.abrupt("return", _context.sent);
  42156. case 3:
  42157. case "end":
  42158. return _context.stop();
  42159. }
  42160. }, _callee);
  42161. }));
  42162. return function read(_x8) {
  42163. return _ref.apply(this, arguments);
  42164. };
  42165. }();
  42166. _context2.t0 = Uint8Array;
  42167. _context2.next = 5;
  42168. return featurecollection_awaitAsyncGenerator(read(8, 'magic bytes'));
  42169. case 5:
  42170. _context2.t1 = _context2.sent;
  42171. bytes = new _context2.t0(_context2.t1);
  42172. if (bytes.subarray(0, 3).every(function (v, i) {
  42173. return constants_magicbytes[i] === v;
  42174. })) {
  42175. _context2.next = 9;
  42176. break;
  42177. }
  42178. throw new Error('Not a FlatGeobuf file');
  42179. case 9:
  42180. _context2.t2 = Uint8Array;
  42181. _context2.next = 12;
  42182. return featurecollection_awaitAsyncGenerator(read(4, 'header length'));
  42183. case 12:
  42184. _context2.t3 = _context2.sent;
  42185. bytes = new _context2.t2(_context2.t3);
  42186. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytes);
  42187. headerLength = bb.readUint32(0);
  42188. _context2.t4 = Uint8Array;
  42189. _context2.next = 19;
  42190. return featurecollection_awaitAsyncGenerator(read(headerLength, 'header data'));
  42191. case 19:
  42192. _context2.t5 = _context2.sent;
  42193. bytes = new _context2.t4(_context2.t5);
  42194. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytes);
  42195. headerMeta = fromByteBuffer(bb);
  42196. if (headerMetaFn) headerMetaFn(headerMeta);
  42197. indexNodeSize = headerMeta.indexNodeSize, featuresCount = headerMeta.featuresCount;
  42198. if (!(indexNodeSize > 0)) {
  42199. _context2.next = 29;
  42200. break;
  42201. }
  42202. treeSize = calcTreeSize(featuresCount, indexNodeSize);
  42203. _context2.next = 29;
  42204. return featurecollection_awaitAsyncGenerator(read(treeSize, 'entire index, w/o rect'));
  42205. case 29:
  42206. _context2.next = 31;
  42207. return featurecollection_awaitAsyncGenerator(readFeature(read, headerMeta, fromFeature));
  42208. case 31:
  42209. if (!(feature = _context2.sent)) {
  42210. _context2.next = 36;
  42211. break;
  42212. }
  42213. _context2.next = 34;
  42214. return feature;
  42215. case 34:
  42216. _context2.next = 29;
  42217. break;
  42218. case 36:
  42219. case "end":
  42220. return _context2.stop();
  42221. }
  42222. }, _callee2);
  42223. }));
  42224. return _deserializeStream.apply(this, arguments);
  42225. }
  42226. function deserializeFiltered(_x4, _x5, _x6, _x7) {
  42227. return _deserializeFiltered.apply(this, arguments);
  42228. }
  42229. function _deserializeFiltered() {
  42230. _deserializeFiltered = featurecollection_wrapAsyncGenerator( /*#__PURE__*/featurecollection_regeneratorRuntime().mark(function _callee3(url, rect, fromFeature, headerMetaFn) {
  42231. var reader, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, feature;
  42232. return featurecollection_regeneratorRuntime().wrap(function _callee3$(_context3) {
  42233. while (1) switch (_context3.prev = _context3.next) {
  42234. case 0:
  42235. _context3.next = 2;
  42236. return featurecollection_awaitAsyncGenerator(HttpReader.open(url));
  42237. case 2:
  42238. reader = _context3.sent;
  42239. Logger.debug('opened reader');
  42240. if (headerMetaFn) headerMetaFn(reader.header);
  42241. _iteratorAbruptCompletion = false;
  42242. _didIteratorError = false;
  42243. _context3.prev = 7;
  42244. _iterator = featurecollection_asyncIterator(reader.selectBbox(rect));
  42245. case 9:
  42246. _context3.next = 11;
  42247. return featurecollection_awaitAsyncGenerator(_iterator.next());
  42248. case 11:
  42249. if (!(_iteratorAbruptCompletion = !(_step = _context3.sent).done)) {
  42250. _context3.next = 18;
  42251. break;
  42252. }
  42253. feature = _step.value;
  42254. _context3.next = 15;
  42255. return fromFeature(feature, reader.header);
  42256. case 15:
  42257. _iteratorAbruptCompletion = false;
  42258. _context3.next = 9;
  42259. break;
  42260. case 18:
  42261. _context3.next = 24;
  42262. break;
  42263. case 20:
  42264. _context3.prev = 20;
  42265. _context3.t0 = _context3["catch"](7);
  42266. _didIteratorError = true;
  42267. _iteratorError = _context3.t0;
  42268. case 24:
  42269. _context3.prev = 24;
  42270. _context3.prev = 25;
  42271. if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
  42272. _context3.next = 29;
  42273. break;
  42274. }
  42275. _context3.next = 29;
  42276. return featurecollection_awaitAsyncGenerator(_iterator["return"]());
  42277. case 29:
  42278. _context3.prev = 29;
  42279. if (!_didIteratorError) {
  42280. _context3.next = 32;
  42281. break;
  42282. }
  42283. throw _iteratorError;
  42284. case 32:
  42285. return _context3.finish(29);
  42286. case 33:
  42287. return _context3.finish(24);
  42288. case 34:
  42289. case "end":
  42290. return _context3.stop();
  42291. }
  42292. }, _callee3, null, [[7, 20, 24, 34], [25,, 29, 33]]);
  42293. }));
  42294. return _deserializeFiltered.apply(this, arguments);
  42295. }
  42296. function readFeature(_x9, _x10, _x11) {
  42297. return _readFeature.apply(this, arguments);
  42298. }
  42299. function _readFeature() {
  42300. _readFeature = featurecollection_asyncToGenerator( /*#__PURE__*/featurecollection_regeneratorRuntime().mark(function _callee4(read, headerMeta, fromFeature) {
  42301. var bytes, bb, featureLength, bytesAligned, feature;
  42302. return featurecollection_regeneratorRuntime().wrap(function _callee4$(_context4) {
  42303. while (1) switch (_context4.prev = _context4.next) {
  42304. case 0:
  42305. _context4.t0 = Uint8Array;
  42306. _context4.next = 3;
  42307. return read(4, 'feature length');
  42308. case 3:
  42309. _context4.t1 = _context4.sent;
  42310. bytes = new _context4.t0(_context4.t1);
  42311. if (!(bytes.byteLength === 0)) {
  42312. _context4.next = 7;
  42313. break;
  42314. }
  42315. return _context4.abrupt("return");
  42316. case 7:
  42317. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytes);
  42318. featureLength = bb.readUint32(0);
  42319. _context4.t2 = Uint8Array;
  42320. _context4.next = 12;
  42321. return read(featureLength, 'feature data');
  42322. case 12:
  42323. _context4.t3 = _context4.sent;
  42324. bytes = new _context4.t2(_context4.t3);
  42325. bytesAligned = new Uint8Array(featureLength + 4);
  42326. bytesAligned.set(bytes, 4);
  42327. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytesAligned);
  42328. bb.setPosition(SIZE_PREFIX_LEN);
  42329. feature = feature_Feature.getRootAsFeature(bb);
  42330. return _context4.abrupt("return", fromFeature(feature, headerMeta));
  42331. case 20:
  42332. case "end":
  42333. return _context4.stop();
  42334. }
  42335. }, _callee4);
  42336. }));
  42337. return _readFeature.apply(this, arguments);
  42338. }
  42339. function buildColumn(builder, column) {
  42340. var nameOffset = builder.createString(column.name);
  42341. Column.startColumn(builder);
  42342. Column.addName(builder, nameOffset);
  42343. Column.addType(builder, column.type);
  42344. return Column.endColumn(builder);
  42345. }
  42346. function featurecollection_buildHeader(header) {
  42347. var builder = new flatbuffers.Builder();
  42348. var columnOffsets = null;
  42349. if (header.columns) columnOffsets = Header.createColumnsVector(builder, header.columns.map(function (c) {
  42350. return buildColumn(builder, c);
  42351. }));
  42352. var nameOffset = builder.createString('L1');
  42353. Header.startHeader(builder);
  42354. Header.addFeaturesCount(builder, BigInt(header.featuresCount));
  42355. Header.addGeometryType(builder, header.geometryType);
  42356. Header.addIndexNodeSize(builder, 0);
  42357. if (columnOffsets) Header.addColumns(builder, columnOffsets);
  42358. Header.addName(builder, nameOffset);
  42359. var offset = Header.endHeader(builder);
  42360. builder.finishSizePrefixed(offset);
  42361. return builder.asUint8Array();
  42362. }
  42363. function valueToType(value) {
  42364. if (typeof value === 'boolean') return ColumnType.Bool;else if (typeof value === 'number') {
  42365. if (value % 1 === 0) return ColumnType.Int;else return ColumnType.Double;
  42366. } else if (typeof value === 'string') return ColumnType.String;else if (value === null) return ColumnType.String;else if (featurecollection_typeof(value) === 'object') return ColumnType.Json;else throw new Error("Unknown type (value '".concat(value, "')"));
  42367. }
  42368. function featurecollection_mapColumn(properties, k) {
  42369. return {
  42370. name: k,
  42371. type: valueToType(properties[k]),
  42372. title: null,
  42373. description: null,
  42374. width: -1,
  42375. precision: -1,
  42376. scale: -1,
  42377. nullable: true,
  42378. unique: false,
  42379. primary_key: false
  42380. };
  42381. }
  42382. function introspectHeaderMeta(features) {
  42383. var sampleFeature = features[0];
  42384. var properties = sampleFeature.getProperties ? sampleFeature.getProperties() : {};
  42385. var columns = null;
  42386. if (properties) columns = Object.keys(properties).filter(function (key) {
  42387. return key !== 'geometry';
  42388. }).map(function (k) {
  42389. return featurecollection_mapColumn(properties, k);
  42390. });
  42391. var geometryType = inferGeometryType(features);
  42392. var headerMeta = {
  42393. geometryType: geometryType,
  42394. columns: columns,
  42395. envelope: null,
  42396. featuresCount: features.length,
  42397. indexNodeSize: 0,
  42398. crs: null,
  42399. title: null,
  42400. description: null,
  42401. metadata: null
  42402. };
  42403. return headerMeta;
  42404. }
  42405. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/geojson/featurecollection.js
  42406. function geojson_featurecollection_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = geojson_featurecollection_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  42407. function geojson_featurecollection_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return geojson_featurecollection_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return geojson_featurecollection_arrayLikeToArray(o, minLen); }
  42408. function geojson_featurecollection_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  42409. function featurecollection_serialize(featurecollection) {
  42410. var headerMeta = featurecollection_introspectHeaderMeta(featurecollection);
  42411. var header = buildHeader(headerMeta);
  42412. var features = featurecollection.features.map(function (f) {
  42413. return buildFeature(f.geometry.type === 'GeometryCollection' ? parseGC(f.geometry) : parseGeometry(f.geometry), f.properties, headerMeta);
  42414. });
  42415. var featuresLength = features.map(function (f) {
  42416. return f.length;
  42417. }).reduce(function (a, b) {
  42418. return a + b;
  42419. });
  42420. var uint8 = new Uint8Array(magicbytes.length + header.length + featuresLength);
  42421. uint8.set(header, magicbytes.length);
  42422. var offset = magicbytes.length + header.length;
  42423. var _iterator = geojson_featurecollection_createForOfIteratorHelper(features),
  42424. _step;
  42425. try {
  42426. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  42427. var feature = _step.value;
  42428. uint8.set(feature, offset);
  42429. offset += feature.length;
  42430. }
  42431. } catch (err) {
  42432. _iterator.e(err);
  42433. } finally {
  42434. _iterator.f();
  42435. }
  42436. uint8.set(magicbytes);
  42437. return uint8;
  42438. }
  42439. function featurecollection_deserialize(bytes, headerMetaFn) {
  42440. var features = deserialize(bytes, feature_fromFeature, headerMetaFn);
  42441. return {
  42442. type: 'FeatureCollection',
  42443. features: features
  42444. };
  42445. }
  42446. function featurecollection_deserializeStream(stream, headerMetaFn) {
  42447. return deserializeStream(stream, feature_fromFeature, headerMetaFn);
  42448. }
  42449. function featurecollection_deserializeFiltered(url, rect, headerMetaFn) {
  42450. return deserializeFiltered(url, rect, feature_fromFeature, headerMetaFn);
  42451. }
  42452. function featurecollection_introspectHeaderMeta(featurecollection) {
  42453. var feature = featurecollection.features[0];
  42454. var properties = feature.properties;
  42455. var columns = null;
  42456. if (properties) columns = Object.keys(properties).map(function (k) {
  42457. return mapColumn(properties, k);
  42458. });
  42459. var geometryType = inferGeometryType(featurecollection.features);
  42460. var headerMeta = {
  42461. geometryType: geometryType,
  42462. columns: columns,
  42463. envelope: null,
  42464. featuresCount: featurecollection.features.length,
  42465. indexNodeSize: 0,
  42466. crs: null,
  42467. title: null,
  42468. description: null,
  42469. metadata: null
  42470. };
  42471. return headerMeta;
  42472. }
  42473. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/geojson.js
  42474. function geojson_serialize(geojson) {
  42475. var bytes = fcSerialize(geojson);
  42476. return bytes;
  42477. }
  42478. function geojson_deserialize(input, rect, headerMetaFn) {
  42479. if (input instanceof Uint8Array) return featurecollection_deserialize(input, headerMetaFn);else if (input instanceof ReadableStream) return featurecollection_deserializeStream(input, headerMetaFn);else return featurecollection_deserializeFiltered(input, rect, headerMetaFn);
  42480. }
  42481. // EXTERNAL MODULE: ./node_modules/rbush/index.js
  42482. var rbush = __webpack_require__(510);
  42483. var rbush_default = /*#__PURE__*/__webpack_require__.n(rbush);
  42484. ;// CONCATENATED MODULE: ./src/common/overlay/fgb/FGBLayerRenderer.js
  42485. function FGBLayerRenderer_typeof(obj) { "@babel/helpers - typeof"; return FGBLayerRenderer_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, FGBLayerRenderer_typeof(obj); }
  42486. function FGBLayerRenderer_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ FGBLayerRenderer_regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == FGBLayerRenderer_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
  42487. function FGBLayerRenderer_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  42488. function FGBLayerRenderer_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { FGBLayerRenderer_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { FGBLayerRenderer_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  42489. function FGBLayerRenderer_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  42490. function FGBLayerRenderer_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  42491. function FGBLayerRenderer_createClass(Constructor, protoProps, staticProps) { if (protoProps) FGBLayerRenderer_defineProperties(Constructor.prototype, protoProps); if (staticProps) FGBLayerRenderer_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  42492. function FGBLayerRenderer_asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new FGBLayerRenderer_AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
  42493. function FGBLayerRenderer_AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return FGBLayerRenderer_AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, FGBLayerRenderer_AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(value) { var ret = this.s["return"]; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, "throw": function _throw(value) { var thr = this.s["return"]; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new FGBLayerRenderer_AsyncFromSyncIterator(s); }
  42494. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42495. * This program are made available under the terms of the Apache License, Version 2.0
  42496. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42497. /**
  42498. * @private
  42499. * @class FGBLayerRenderer
  42500. * @classdesc FGB。
  42501. * @version 11.1.0
  42502. * @param {Object} options - 参数。
  42503. * @param {string} [options.layerID] - 图层 ID。默认使用 CommonUtil.createUniqueID("FGBlayer_") 创建图层 ID。
  42504. * @param {boolean} [options.strategy='bbox'] - 指定加载策略,可选值为 all,bbox。 all为全量加载, bbox为当前可见范围加载。
  42505. * @param {Array} [options.extent] - 加载范围, 参数规范为: [minX, minY, maxX, maxY], 传递此参数后, 图层将使用局部加载。
  42506. * @param {function} [options.featureLoader] - 要素自定义方法,接收要素作为参数,需返回要素。
  42507. * @usage
  42508. */
  42509. var GEOMETRY_TYPE_MAP = {
  42510. 1: 'circle',
  42511. 2: 'line',
  42512. 3: 'fill',
  42513. 5: 'line',
  42514. 4: 'circle',
  42515. 6: 'fill',
  42516. 'MultiPolygon': 'fill',
  42517. 'Point': 'circle',
  42518. 'MultiLineString': 'line',
  42519. 'MultiPoint': 'circle',
  42520. 'LineString': 'line',
  42521. 'Polygon': 'fill'
  42522. };
  42523. var FGBLayerRenderer = /*#__PURE__*/function () {
  42524. function FGBLayerRenderer() {
  42525. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  42526. FGBLayerRenderer_classCallCheck(this, FGBLayerRenderer);
  42527. this.id = options.layerID ? options.layerID : Util_Util.createUniqueID('FGBLayer_');
  42528. this.layerId = this.id + 'outer';
  42529. this.sourceId = this.layerId;
  42530. this.options = options;
  42531. this.strategy = options.strategy || 'bbox';
  42532. this.url = options.url;
  42533. this.layerType = '';
  42534. this.extent = options.extent;
  42535. this.init();
  42536. }
  42537. FGBLayerRenderer_createClass(FGBLayerRenderer, [{
  42538. key: "init",
  42539. value: function init() {
  42540. if (this.strategy === 'bbox') {
  42541. this.loadedExtentsRtree_ = new (rbush_default())();
  42542. }
  42543. }
  42544. }, {
  42545. key: "iterateFeatures",
  42546. value: function () {
  42547. var _iterateFeatures = FGBLayerRenderer_asyncToGenerator( /*#__PURE__*/FGBLayerRenderer_regeneratorRuntime().mark(function _callee(iterator) {
  42548. var features, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, feature;
  42549. return FGBLayerRenderer_regeneratorRuntime().wrap(function _callee$(_context) {
  42550. while (1) switch (_context.prev = _context.next) {
  42551. case 0:
  42552. features = {
  42553. type: 'FeatureCollection',
  42554. features: []
  42555. };
  42556. _iteratorAbruptCompletion = false;
  42557. _didIteratorError = false;
  42558. _context.prev = 3;
  42559. _iterator = FGBLayerRenderer_asyncIterator(iterator);
  42560. case 5:
  42561. _context.next = 7;
  42562. return _iterator.next();
  42563. case 7:
  42564. if (!(_iteratorAbruptCompletion = !(_step = _context.sent).done)) {
  42565. _context.next = 15;
  42566. break;
  42567. }
  42568. feature = _step.value;
  42569. if (this.options.featureLoader && typeof this.options.featureLoader === 'function') {
  42570. feature = this.options.featureLoader(feature);
  42571. }
  42572. if (!this.layerType) {
  42573. this.layerType = GEOMETRY_TYPE_MAP[feature.geometry.type];
  42574. }
  42575. features.features.push(feature);
  42576. case 12:
  42577. _iteratorAbruptCompletion = false;
  42578. _context.next = 5;
  42579. break;
  42580. case 15:
  42581. _context.next = 21;
  42582. break;
  42583. case 17:
  42584. _context.prev = 17;
  42585. _context.t0 = _context["catch"](3);
  42586. _didIteratorError = true;
  42587. _iteratorError = _context.t0;
  42588. case 21:
  42589. _context.prev = 21;
  42590. _context.prev = 22;
  42591. if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
  42592. _context.next = 26;
  42593. break;
  42594. }
  42595. _context.next = 26;
  42596. return _iterator["return"]();
  42597. case 26:
  42598. _context.prev = 26;
  42599. if (!_didIteratorError) {
  42600. _context.next = 29;
  42601. break;
  42602. }
  42603. throw _iteratorError;
  42604. case 29:
  42605. return _context.finish(26);
  42606. case 30:
  42607. return _context.finish(21);
  42608. case 31:
  42609. return _context.abrupt("return", features);
  42610. case 32:
  42611. case "end":
  42612. return _context.stop();
  42613. }
  42614. }, _callee, this, [[3, 17, 21, 31], [22,, 26, 30]]);
  42615. }));
  42616. function iterateFeatures(_x) {
  42617. return _iterateFeatures.apply(this, arguments);
  42618. }
  42619. return iterateFeatures;
  42620. }()
  42621. }, {
  42622. key: "_loadData",
  42623. value: function () {
  42624. var _loadData2 = FGBLayerRenderer_asyncToGenerator( /*#__PURE__*/FGBLayerRenderer_regeneratorRuntime().mark(function _callee2(bounds) {
  42625. var _this = this;
  42626. var fgbStream, rect;
  42627. return FGBLayerRenderer_regeneratorRuntime().wrap(function _callee2$(_context2) {
  42628. while (1) switch (_context2.prev = _context2.next) {
  42629. case 0:
  42630. rect = {
  42631. minX: bounds[0],
  42632. minY: bounds[1],
  42633. maxX: bounds[2],
  42634. maxY: bounds[3]
  42635. };
  42636. if (bounds.length) {
  42637. _context2.next = 7;
  42638. break;
  42639. }
  42640. _context2.next = 4;
  42641. return this._getStream(this.url);
  42642. case 4:
  42643. fgbStream = _context2.sent;
  42644. _context2.next = 9;
  42645. break;
  42646. case 7:
  42647. rect.value = {
  42648. extent: bounds.slice()
  42649. };
  42650. this.loadedExtentsRtree_.insert(rect);
  42651. case 9:
  42652. _context2.next = 11;
  42653. return geojson_deserialize(fgbStream && fgbStream.body || this.url, rect, function (headerMeta) {
  42654. _this.layerType = GEOMETRY_TYPE_MAP[headerMeta.geometryType];
  42655. });
  42656. case 11:
  42657. return _context2.abrupt("return", _context2.sent);
  42658. case 12:
  42659. case "end":
  42660. return _context2.stop();
  42661. }
  42662. }, _callee2, this);
  42663. }));
  42664. function _loadData(_x2) {
  42665. return _loadData2.apply(this, arguments);
  42666. }
  42667. return _loadData;
  42668. }()
  42669. }, {
  42670. key: "_getStream",
  42671. value: function () {
  42672. var _getStream2 = FGBLayerRenderer_asyncToGenerator( /*#__PURE__*/FGBLayerRenderer_regeneratorRuntime().mark(function _callee3(url) {
  42673. return FGBLayerRenderer_regeneratorRuntime().wrap(function _callee3$(_context3) {
  42674. while (1) switch (_context3.prev = _context3.next) {
  42675. case 0:
  42676. _context3.next = 2;
  42677. return FetchRequest.get(url, {}, {
  42678. withoutFormatSuffix: true
  42679. }).then(function (response) {
  42680. return response;
  42681. });
  42682. case 2:
  42683. return _context3.abrupt("return", _context3.sent);
  42684. case 3:
  42685. case "end":
  42686. return _context3.stop();
  42687. }
  42688. }, _callee3);
  42689. }));
  42690. function _getStream(_x3) {
  42691. return _getStream2.apply(this, arguments);
  42692. }
  42693. return _getStream;
  42694. }()
  42695. }, {
  42696. key: "_containsExtent",
  42697. value: function _containsExtent(extent1, extent2) {
  42698. return extent1[0] <= extent2[0] && extent2[2] <= extent1[2] && extent1[1] <= extent2[1] && extent2[3] <= extent1[3];
  42699. }
  42700. }, {
  42701. key: "_getInExtent",
  42702. value: function _getInExtent(extent) {
  42703. var bbox = {
  42704. minX: extent[0],
  42705. minY: extent[1],
  42706. maxX: extent[2],
  42707. maxY: extent[3]
  42708. };
  42709. var items = this.loadedExtentsRtree_.search(bbox);
  42710. return items.map(function (item) {
  42711. return item.value;
  42712. });
  42713. }
  42714. }, {
  42715. key: "_forEachInExtent",
  42716. value: function _forEachInExtent(extent, callback) {
  42717. return this._forEach(this._getInExtent(extent), callback);
  42718. }
  42719. }, {
  42720. key: "_forEach",
  42721. value: function _forEach(values, callback) {
  42722. var result;
  42723. for (var i = 0, l = values.length; i < l; i++) {
  42724. result = callback(values[i]);
  42725. if (result) {
  42726. return result;
  42727. }
  42728. }
  42729. return result;
  42730. }
  42731. }]);
  42732. return FGBLayerRenderer;
  42733. }();
  42734. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/FGBLayer.js
  42735. function FGBLayer_typeof(obj) { "@babel/helpers - typeof"; return FGBLayer_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, FGBLayer_typeof(obj); }
  42736. function FGBLayer_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ FGBLayer_regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == FGBLayer_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
  42737. function FGBLayer_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  42738. function FGBLayer_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { FGBLayer_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { FGBLayer_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  42739. function FGBLayer_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  42740. function FGBLayer_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  42741. function FGBLayer_createClass(Constructor, protoProps, staticProps) { if (protoProps) FGBLayer_defineProperties(Constructor.prototype, protoProps); if (staticProps) FGBLayer_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  42742. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42743. * This program are made available under the terms of the Apache License, Version 2.0
  42744. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42745. /**
  42746. * reference and modification
  42747. * dereklieu/cool-grid, cloudybay/leaflet.latlng-graticule
  42748. * (https://github.com/dereklieu/cool-grid, https://github.com/cloudybay/leaflet.latlng-graticule)
  42749. * Apache Licene 2.0
  42750. * thanks dereklieu, cloudybay
  42751. */
  42752. /**
  42753. * @class FGBLayer
  42754. * @category Visualization FGB
  42755. * @classdesc FGB 图层类。该图层把 {@link FlatGeobuf} 格式解析为点线面要素。
  42756. * @modulecategory Overlay
  42757. * @version 11.1.0
  42758. * @param {Object} options - 参数。
  42759. * @param {string} [options.layerID] - 图层 ID。默认使用 CommonUtil.createUniqueID("FGBlayer_") 创建图层 ID。
  42760. * @param {string} [options.strategy='bbox'] - 指定加载策略,可选值为 all,bbox。 all为全量加载, bbox为当前可见范围加载。
  42761. * @param {Array} [options.extent] - 加载范围, 参数规范为: [minX, minY, maxX, maxY], 传递此参数后, 图层将使用局部加载。
  42762. * @param {function} [options.featureLoader] - 要素自定义方法,接收要素作为参数,需返回要素。
  42763. * @param {Object} [options.paint] - 参数内容详见: {@link https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#paint-property}
  42764. * @param {Object} [options.layout] - 参数内容详见: {@link https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#layout-property}
  42765. * @param {Object} [options.sourceOptions] - 参数内容详见: {@link mapboxgl.source}
  42766. * @usage
  42767. */
  42768. var PAINT_MAP = {
  42769. circle: {
  42770. 'circle-radius': 6,
  42771. 'circle-color': '#3fb1e3',
  42772. 'circle-opacity': 1,
  42773. 'circle-blur': 0,
  42774. 'circle-translate': [0, 0],
  42775. 'circle-stroke-width': 0,
  42776. 'circle-stroke-color': '#000',
  42777. 'circle-stroke-opacity': 1
  42778. },
  42779. line: {
  42780. 'line-opacity': 1,
  42781. 'line-color': '#3fb1e3',
  42782. 'line-width': 3,
  42783. 'line-blur': 1
  42784. },
  42785. fill: {
  42786. 'fill-opacity': 0.8,
  42787. 'fill-color': '#3fb1e3',
  42788. 'fill-translate': [0, 0],
  42789. 'fill-antialias': true,
  42790. 'fill-outline-color': '#3fb1e3'
  42791. }
  42792. };
  42793. var FGBLayer = /*#__PURE__*/function () {
  42794. function FGBLayer() {
  42795. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  42796. FGBLayer_classCallCheck(this, FGBLayer);
  42797. this.id = options.layerID ? options.layerID : Util_Util.createUniqueID('FGBLayer_');
  42798. this.layerId = this.id + 'outer';
  42799. this.sourceId = this.layerId;
  42800. this.options = options;
  42801. this.strategy = options.strategy || 'bbox';
  42802. this.url = options.url;
  42803. this.layerType = '';
  42804. this.extent = options.extent;
  42805. this.overlay = true;
  42806. this.type = 'custom';
  42807. this.renderingMode = '3d';
  42808. this._updateFeaturesFn = this._updateFeatures.bind(this);
  42809. }
  42810. /**
  42811. * @function DeckglLayer.prototype.onAdd
  42812. * @param {mapboxgl.Map} map - MapBoxGL Map 对象。
  42813. */
  42814. FGBLayer_createClass(FGBLayer, [{
  42815. key: "onAdd",
  42816. value: function onAdd(map) {
  42817. this.map = map;
  42818. var extent = [];
  42819. if (this.strategy === 'bbox') {
  42820. var bounds = this.map.getBounds().toArray();
  42821. extent = [bounds[0][0], bounds[0][1], bounds[1][0], bounds[1][1]];
  42822. this.map.on('moveend', this._updateFeaturesFn);
  42823. }
  42824. if (this.extent) {
  42825. var intersectExtent = getIntersection(this.extent, extent);
  42826. if (intersectExtent && intersectExtent.length) {
  42827. extent = intersectExtent;
  42828. } else {
  42829. extent = this.extent;
  42830. }
  42831. }
  42832. this.renderer = new FGBLayerRenderer(this.options);
  42833. this._handleFeatures(extent);
  42834. }
  42835. /**
  42836. * @function DeckglLayer.prototype.onRemove
  42837. */
  42838. }, {
  42839. key: "onRemove",
  42840. value: function onRemove() {
  42841. this.map.off('moveend', this._updateFeaturesFn);
  42842. }
  42843. /**
  42844. * @function DeckglLayer.prototype.moveLayer
  42845. */
  42846. }, {
  42847. key: "moveLayer",
  42848. value: function moveLayer(beforeId) {
  42849. this.map.moveLayer(this.layerId, beforeId);
  42850. }
  42851. /**
  42852. * @function FGBLayer.prototype.render
  42853. */
  42854. }, {
  42855. key: "render",
  42856. value: function render() {}
  42857. /**
  42858. * @function FGBLayer.prototype.setVisibility
  42859. * @description 设置图层的显隐
  42860. */
  42861. }, {
  42862. key: "setVisibility",
  42863. value: function setVisibility(visibility) {
  42864. var visible = visibility ? 'visible' : 'none';
  42865. this.map.setLayoutProperty(this.layerId, 'visibility', visible);
  42866. }
  42867. }, {
  42868. key: "_handleFeatures",
  42869. value: function () {
  42870. var _handleFeatures2 = FGBLayer_asyncToGenerator( /*#__PURE__*/FGBLayer_regeneratorRuntime().mark(function _callee(bounds) {
  42871. var iter, features, layer;
  42872. return FGBLayer_regeneratorRuntime().wrap(function _callee$(_context) {
  42873. while (1) switch (_context.prev = _context.next) {
  42874. case 0:
  42875. _context.next = 2;
  42876. return this.renderer._loadData(bounds);
  42877. case 2:
  42878. iter = _context.sent;
  42879. _context.next = 5;
  42880. return this.renderer.iterateFeatures(iter);
  42881. case 5:
  42882. features = _context.sent;
  42883. if (!this.map.getSource(this.sourceId)) {
  42884. this.map.addSource(this.sourceId, {
  42885. type: 'geojson',
  42886. data: features
  42887. });
  42888. } else {
  42889. this.map.getSource(this.sourceId).setData(features);
  42890. }
  42891. if (!this.map.getLayer(this.layerId)) {
  42892. this.layerType = this.renderer.layerType;
  42893. layer = Object.assign({
  42894. id: this.layerId,
  42895. type: this.layerType,
  42896. source: this.sourceId,
  42897. paint: Object.assign(PAINT_MAP[this.layerType], this.options.paint) || {},
  42898. layout: this.options.layout || {}
  42899. });
  42900. this.map.addLayer(layer);
  42901. }
  42902. case 8:
  42903. case "end":
  42904. return _context.stop();
  42905. }
  42906. }, _callee, this);
  42907. }));
  42908. function _handleFeatures(_x) {
  42909. return _handleFeatures2.apply(this, arguments);
  42910. }
  42911. return _handleFeatures;
  42912. }()
  42913. }, {
  42914. key: "_updateFeatures",
  42915. value: function () {
  42916. var _updateFeatures2 = FGBLayer_asyncToGenerator( /*#__PURE__*/FGBLayer_regeneratorRuntime().mark(function _callee2() {
  42917. var _this = this;
  42918. var bounds, extentToLoad, alreadyLoaded, iter, features;
  42919. return FGBLayer_regeneratorRuntime().wrap(function _callee2$(_context2) {
  42920. while (1) switch (_context2.prev = _context2.next) {
  42921. case 0:
  42922. bounds = this.map.getBounds().toArray();
  42923. extentToLoad = [bounds[0][0], bounds[0][1], bounds[1][0], bounds[1][1]];
  42924. alreadyLoaded = this.renderer._forEachInExtent(extentToLoad, function (object) {
  42925. return _this.renderer._containsExtent(object.extent, extentToLoad);
  42926. });
  42927. if (alreadyLoaded) {
  42928. _context2.next = 11;
  42929. break;
  42930. }
  42931. _context2.next = 6;
  42932. return this.renderer._loadData(extentToLoad);
  42933. case 6:
  42934. iter = _context2.sent;
  42935. _context2.next = 9;
  42936. return this.renderer.iterateFeatures(iter);
  42937. case 9:
  42938. features = _context2.sent;
  42939. this.map.getSource(this.sourceId).setData(features);
  42940. case 11:
  42941. case "end":
  42942. return _context2.stop();
  42943. }
  42944. }, _callee2, this);
  42945. }));
  42946. function _updateFeatures() {
  42947. return _updateFeatures2.apply(this, arguments);
  42948. }
  42949. return _updateFeatures;
  42950. }()
  42951. }]);
  42952. return FGBLayer;
  42953. }();
  42954. ;// CONCATENATED MODULE: ./src/mapboxgl/services/ServiceBase.js
  42955. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42956. * This program are made available under the terms of the Apache License, Version 2.0
  42957. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42958. /**
  42959. * @class ServiceBase
  42960. * @category iServer Core
  42961. * @classdesc mapboxgl.supermap 服务基类。
  42962. * @param {string} url - 服务地址。
  42963. * @param {Object} options - 参数。
  42964. * @param {string} [options.proxy] - 服务代理地址。
  42965. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  42966. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  42967. * @param {Object} [options.headers] - 请求头。
  42968. * @fires ServiceBase#initialized
  42969. * @usage
  42970. */
  42971. class ServiceBase extends (external_mapboxgl_default()).Evented {
  42972. constructor(url, options) {
  42973. super();
  42974. this.options = options || {};
  42975. this.url = url;
  42976. /**
  42977. * @event ServiceBase#initialized
  42978. * @description 构造函数构造成功之后触发。
  42979. * @property {Object} this - this 对象。
  42980. */
  42981. this.fire('initialized', this);
  42982. }
  42983. }
  42984. ;// CONCATENATED MODULE: ./src/common/security/SecurityManager.js
  42985. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42986. * This program are made available under the terms of the Apache License, Version 2.0
  42987. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42988. /**
  42989. * @class SecurityManager
  42990. * @deprecatedclass SuperMap.SecurityManager
  42991. * @category Security
  42992. * @classdesc 安全管理中心,提供 iServer,iPortal,Online 统一权限认证管理。
  42993. * > 使用说明:
  42994. * > 创建任何一个服务之前调用 {@link SecurityManager.registerToken}或
  42995. * > {@link SecurityManager.registerKey}注册凭据。
  42996. * > 发送请求时根据 URL 或者服务 ID 获取相应的 key 或者 token 并自动添加到服务地址中。
  42997. * @usage
  42998. */
  42999. class SecurityManager {
  43000. /**
  43001. * @description 从服务器获取一个token,在此之前要注册服务器信息。
  43002. * @function SecurityManager.generateToken
  43003. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  43004. * @param {TokenServiceParameter} tokenParam - token 申请参数。
  43005. * @returns {Promise} 包含 token 信息的 Promise 对象。
  43006. */
  43007. static generateToken(url, tokenParam) {
  43008. var serverInfo = this.servers[url];
  43009. if (!serverInfo) {
  43010. return;
  43011. }
  43012. return FetchRequest.post(serverInfo.tokenServiceUrl, JSON.stringify(tokenParam.toJSON())).then(function(
  43013. response
  43014. ) {
  43015. return response.text();
  43016. });
  43017. }
  43018. /**
  43019. * @description 注册安全服务器相关信息。
  43020. * @function SecurityManager.registerServers
  43021. * @param {ServerInfo} serverInfos - 服务器信息。
  43022. */
  43023. static registerServers(serverInfos) {
  43024. this.servers = this.servers || {};
  43025. if (!Util_Util.isArray(serverInfos)) {
  43026. serverInfos = [serverInfos];
  43027. }
  43028. for (var i = 0; i < serverInfos.length; i++) {
  43029. var serverInfo = serverInfos[i];
  43030. this.servers[serverInfo.server] = serverInfo;
  43031. }
  43032. }
  43033. /**
  43034. * @description 服务请求都会自动带上这个 token。
  43035. * @function SecurityManager.registerToken
  43036. * @param {string} url -服务器域名+端口:如http://localhost:8090。
  43037. * @param {string} token - token。
  43038. */
  43039. static registerToken(url, token) {
  43040. this.tokens = this.tokens || {};
  43041. if (!url || !token) {
  43042. return;
  43043. }
  43044. var domain = this._getTokenStorageKey(url);
  43045. this.tokens[domain] = token;
  43046. }
  43047. /**
  43048. * @description 注册 key,ids 为数组(存在一个 key 对应多个服务)。
  43049. * @function SecurityManager.registerKey
  43050. * @param {Array} ids - 可以是服务 ID 数组或者 URL 地址数组或者 webAPI 类型数组。
  43051. * @param {string} key - key。
  43052. */
  43053. static registerKey(ids, key) {
  43054. this.keys = this.keys || {};
  43055. if (!ids || ids.length < 1 || !key) {
  43056. return;
  43057. }
  43058. ids = Util_Util.isArray(ids) ? ids : [ids];
  43059. for (var i = 0; i < ids.length; i++) {
  43060. var id = this._getUrlRestString(ids[0]) || ids[0];
  43061. this.keys[id] = key;
  43062. }
  43063. }
  43064. /**
  43065. * @description 获取服务器信息。
  43066. * @function SecurityManager.getServerInfo
  43067. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  43068. * @returns {ServerInfo} 服务器信息。
  43069. */
  43070. static getServerInfo(url) {
  43071. this.servers = this.servers || {};
  43072. return this.servers[url];
  43073. }
  43074. /**
  43075. * @description 根据 URL 获取token。
  43076. * @function SecurityManager.getToken
  43077. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  43078. * @returns {string} token。
  43079. */
  43080. static getToken(url) {
  43081. if (!url) {
  43082. return;
  43083. }
  43084. this.tokens = this.tokens || {};
  43085. var domain = this._getTokenStorageKey(url);
  43086. return this.tokens[domain];
  43087. }
  43088. /**
  43089. * @description 根据 URL 获取 key。
  43090. * @function SecurityManager.getKey
  43091. * @param {string} id - ID。
  43092. * @returns {string} key。
  43093. */
  43094. static getKey(id) {
  43095. this.keys = this.keys || {};
  43096. var key = this._getUrlRestString(id) || id;
  43097. return this.keys[key];
  43098. }
  43099. /**
  43100. * @description iServer 登录验证。
  43101. * @function SecurityManager.loginiServer
  43102. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  43103. * @param {string} username - 用户名。
  43104. * @param {string} password - 密码。
  43105. * @param {boolean} [rememberme=false] - 是否记住。
  43106. * @returns {Promise} 包含 iServer 登录请求结果的 Promise 对象。
  43107. */
  43108. static loginiServer(url, username, password, rememberme) {
  43109. url = Util_Util.urlPathAppend(url, 'services/security/login');
  43110. var loginInfo = {
  43111. username: username && username.toString(),
  43112. password: password && password.toString(),
  43113. rememberme: rememberme
  43114. };
  43115. loginInfo = JSON.stringify(loginInfo);
  43116. var requestOptions = {
  43117. headers: {
  43118. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  43119. }
  43120. };
  43121. return FetchRequest.post(url, loginInfo, requestOptions).then(function(response) {
  43122. return response.json();
  43123. });
  43124. }
  43125. /**
  43126. * @description iServer登出。
  43127. * @function SecurityManager.logoutiServer
  43128. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  43129. * @returns {Promise} 是否登出成功。
  43130. */
  43131. static logoutiServer(url) {
  43132. url = Util_Util.urlPathAppend(url, 'services/security/logout');
  43133. var requestOptions = {
  43134. headers: {
  43135. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  43136. },
  43137. withoutFormatSuffix: true
  43138. };
  43139. return FetchRequest.get(url, '', requestOptions)
  43140. .then(function() {
  43141. return true;
  43142. })
  43143. .catch(function() {
  43144. return false;
  43145. });
  43146. }
  43147. /**
  43148. * @description Online 登录验证。
  43149. * @function SecurityManager.loginOnline
  43150. * @param {string} callbackLocation - 跳转位置。
  43151. * @param {boolean} [newTab=true] - 是否新窗口打开。
  43152. */
  43153. static loginOnline(callbackLocation, newTab) {
  43154. var loginUrl = SecurityManager.SSO + '/login?service=' + callbackLocation;
  43155. this._open(loginUrl, newTab);
  43156. }
  43157. /**
  43158. * @description iPortal登录验证。
  43159. * @function SecurityManager.loginiPortal
  43160. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal。
  43161. * @param {string} username - 用户名。
  43162. * @param {string} password - 密码。
  43163. * @returns {Promise} 包含 iPortal 登录请求结果的 Promise 对象。
  43164. */
  43165. static loginiPortal(url, username, password) {
  43166. url = Util_Util.urlPathAppend(url, 'web/login');
  43167. var loginInfo = {
  43168. username: username && username.toString(),
  43169. password: password && password.toString()
  43170. };
  43171. loginInfo = JSON.stringify(loginInfo);
  43172. var requestOptions = {
  43173. headers: {
  43174. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  43175. },
  43176. withCredentials: true
  43177. };
  43178. return FetchRequest.post(url, loginInfo, requestOptions).then(function(response) {
  43179. return response.json();
  43180. });
  43181. }
  43182. /**
  43183. * @description iPortal 登出。
  43184. * @function SecurityManager.logoutiPortal
  43185. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal。
  43186. * @returns {Promise} 如果登出成功,返回 true;否则返回 false。
  43187. */
  43188. static logoutiPortal(url) {
  43189. url = Util_Util.urlPathAppend(url, 'services/security/logout');
  43190. var requestOptions = {
  43191. headers: {
  43192. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  43193. },
  43194. withCredentials: true,
  43195. withoutFormatSuffix: true
  43196. };
  43197. return FetchRequest.get(url, '', requestOptions)
  43198. .then(function() {
  43199. return true;
  43200. })
  43201. .catch(function() {
  43202. return false;
  43203. });
  43204. }
  43205. /**
  43206. * @description iManager 登录验证。
  43207. * @function SecurityManager.loginManager
  43208. * @param {string} url - iManager 地址。地址参数为 iManager 首页地址,如: http://localhost:8390/imanager。
  43209. * @param {Object} [loginInfoParams] - iManager 登录参数。
  43210. * @param {string} loginInfoParams.userName - 用户名。
  43211. * @param {string} loginInfoParams.password - 密码。
  43212. * @param {Object} options
  43213. * @param {boolean} [options.isNewTab=true] - 不同域时是否在新窗口打开登录页面。
  43214. * @returns {Promise} 包含 iManager 登录请求结果的 Promise 对象。
  43215. */
  43216. static loginManager(url, loginInfoParams, options) {
  43217. if (!Util_Util.isInTheSameDomain(url)) {
  43218. var isNewTab = options ? options.isNewTab : true;
  43219. this._open(url, isNewTab);
  43220. return;
  43221. }
  43222. var requestUrl = Util_Util.urlPathAppend(url, 'icloud/security/tokens');
  43223. var params = loginInfoParams || {};
  43224. var loginInfo = {
  43225. username: params.userName && params.userName.toString(),
  43226. password: params.password && params.password.toString()
  43227. };
  43228. loginInfo = JSON.stringify(loginInfo);
  43229. var requestOptions = {
  43230. headers: {
  43231. Accept: '*/*',
  43232. 'Content-Type': 'application/json'
  43233. }
  43234. };
  43235. var me = this;
  43236. return FetchRequest.post(requestUrl, loginInfo, requestOptions).then(function(response) {
  43237. response.text().then(function(result) {
  43238. me.imanagerToken = result;
  43239. return result;
  43240. });
  43241. });
  43242. }
  43243. /**
  43244. * @description 清空全部验证信息。
  43245. * @function SecurityManager.destroyAllCredentials
  43246. */
  43247. static destroyAllCredentials() {
  43248. this.keys = null;
  43249. this.tokens = null;
  43250. this.servers = null;
  43251. }
  43252. /**
  43253. * @description 清空令牌信息。
  43254. * @function SecurityManager.destroyToken
  43255. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal。
  43256. */
  43257. static destroyToken(url) {
  43258. if (!url) {
  43259. return;
  43260. }
  43261. var domain = this._getTokenStorageKey(url);
  43262. this.tokens = this.tokens || {};
  43263. if (this.tokens[domain]) {
  43264. delete this.tokens[domain];
  43265. }
  43266. }
  43267. /**
  43268. * @description 清空服务授权码。
  43269. * @function SecurityManager.destroyKey
  43270. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  43271. */
  43272. static destroyKey(url) {
  43273. if (!url) {
  43274. return;
  43275. }
  43276. this.keys = this.keys || {};
  43277. var key = this._getUrlRestString(url) || url;
  43278. if (this.keys[key]) {
  43279. delete this.keys[key];
  43280. }
  43281. }
  43282. /**
  43283. * @description 服务URL追加授权信息,授权信息需先通过SecurityManager.registerKey或SecurityManager.registerToken注册。
  43284. * @version 10.1.2
  43285. * @function SecurityManager.appendCredential
  43286. * @param {string} url - 服务URL。
  43287. * @returns {string} 绑定了token或者key的服务URL。
  43288. */
  43289. static appendCredential(url) {
  43290. var newUrl = url;
  43291. var value = this.getToken(url);
  43292. var credential = value ? new Credential(value, 'token') : null;
  43293. if (!credential) {
  43294. value = this.getKey(url);
  43295. credential = value ? new Credential(value, 'key') : null;
  43296. }
  43297. if (credential) {
  43298. newUrl = Util_Util.urlAppend(newUrl, credential.getUrlParameters());
  43299. }
  43300. return newUrl;
  43301. }
  43302. static _open(url, newTab) {
  43303. newTab = newTab != null ? newTab : true;
  43304. var offsetX = window.screen.availWidth / 2 - this.INNER_WINDOW_WIDTH / 2;
  43305. var offsetY = window.screen.availHeight / 2 - this.INNER_WINDOW_HEIGHT / 2;
  43306. var options =
  43307. 'height=' +
  43308. this.INNER_WINDOW_HEIGHT +
  43309. ', width=' +
  43310. this.INNER_WINDOW_WIDTH +
  43311. ',top=' +
  43312. offsetY +
  43313. ', left=' +
  43314. offsetX +
  43315. ',toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no';
  43316. if (newTab) {
  43317. window.open(url, 'login');
  43318. } else {
  43319. window.open(url, 'login', options);
  43320. }
  43321. }
  43322. static _getTokenStorageKey(url) {
  43323. var patten = /(.*?):\/\/([^\/]+)/i;
  43324. var result = url.match(patten);
  43325. if (!result) {
  43326. return url;
  43327. }
  43328. return result[0];
  43329. }
  43330. static _getUrlRestString(url) {
  43331. if (!url) {
  43332. return url;
  43333. }
  43334. // var patten = /http:\/\/(.*\/rest)/i;
  43335. var patten = /(http|https):\/\/(.*\/rest)/i;
  43336. var result = url.match(patten);
  43337. if (!result) {
  43338. return url;
  43339. }
  43340. return result[0];
  43341. }
  43342. }
  43343. SecurityManager.INNER_WINDOW_WIDTH = 600;
  43344. SecurityManager.INNER_WINDOW_HEIGHT = 600;
  43345. SecurityManager.SSO = 'https://sso.supermap.com';
  43346. SecurityManager.ONLINE = 'https://www.supermapol.com';
  43347. ;// CONCATENATED MODULE: ./src/common/iServer/CommonServiceBase.js
  43348. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43349. * This program are made available under the terms of the Apache License, Version 2.0
  43350. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43351. /**
  43352. * @class CommonServiceBase
  43353. * @deprecatedclass SuperMap.CommonServiceBase
  43354. * @category iServer Core
  43355. * @classdesc 对接 iServer 各种服务的 Service 的基类。
  43356. * @param {string} url - 服务地址。
  43357. * @param {Object} options - 参数。
  43358. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  43359. * @param {string} [options.proxy] - 服务代理地址。
  43360. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  43361. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  43362. * @param {Object} [options.headers] - 请求头。
  43363. * @usage
  43364. */
  43365. class CommonServiceBase {
  43366. constructor(url, options) {
  43367. let me = this;
  43368. this.EVENT_TYPES = ['processCompleted', 'processFailed'];
  43369. this.events = null;
  43370. this.eventListeners = null;
  43371. this.url = null;
  43372. this.urls = null;
  43373. this.proxy = null;
  43374. this.index = null;
  43375. this.length = null;
  43376. this.totalTimes = null;
  43377. this.POLLING_TIMES = 3;
  43378. this.isInTheSameDomain = null;
  43379. this.withCredentials = false;
  43380. if (Util_Util.isArray(url)) {
  43381. me.urls = url;
  43382. me.length = url.length;
  43383. me.totalTimes = me.length;
  43384. if (me.length === 1) {
  43385. me.url = url[0];
  43386. } else {
  43387. me.index = parseInt(Math.random() * me.length);
  43388. me.url = url[me.index];
  43389. }
  43390. } else {
  43391. me.totalTimes = 1;
  43392. me.url = url;
  43393. }
  43394. if (Util_Util.isArray(url) && !me.isServiceSupportPolling()) {
  43395. me.url = url[0];
  43396. me.totalTimes = 1;
  43397. }
  43398. options = options || {};
  43399. this.crossOrigin = options.crossOrigin;
  43400. this.headers = options.headers;
  43401. Util_Util.extend(this, options);
  43402. me.isInTheSameDomain = Util_Util.isInTheSameDomain(me.url);
  43403. me.events = new Events(me, null, me.EVENT_TYPES, true);
  43404. if (me.eventListeners instanceof Object) {
  43405. me.events.on(me.eventListeners);
  43406. }
  43407. this.CLASS_NAME = 'SuperMap.CommonServiceBase';
  43408. }
  43409. /**
  43410. * @function CommonServiceBase.prototype.destroy
  43411. * @description 释放资源,将引用的资源属性置空。
  43412. */
  43413. destroy() {
  43414. let me = this;
  43415. if (Util_Util.isArray(me.urls)) {
  43416. me.urls = null;
  43417. me.index = null;
  43418. me.length = null;
  43419. me.totalTimes = null;
  43420. }
  43421. me.url = null;
  43422. me._processSuccess = null;
  43423. me._processFailed = null;
  43424. me.isInTheSameDomain = null;
  43425. me.EVENT_TYPES = null;
  43426. if (me.events) {
  43427. me.events.destroy();
  43428. me.events = null;
  43429. }
  43430. if (me.eventListeners) {
  43431. me.eventListeners = null;
  43432. }
  43433. }
  43434. /**
  43435. * @function CommonServiceBase.prototype.request
  43436. * @description: 该方法用于向服务发送请求。
  43437. * @param {Object} options - 参数。
  43438. * @param {string} [options.method='GET'] - 请求方式,包括 "GET","POST","PUT","DELETE"。
  43439. * @param {string} [options.url] - 发送请求的地址。
  43440. * @param {Object} [options.params] - 作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。
  43441. * @param {string} [options.data] - 发送到服务器的数据。
  43442. * @param {function} options.success - 请求成功后的回调函数。
  43443. * @param {function} options.failure - 请求失败后的回调函数。
  43444. * @param {Object} [options.scope] - 如果回调函数是对象的一个公共方法,设定该对象的范围。
  43445. * @param {boolean} [options.isInTheSameDomain] - 请求是否在当前域中。
  43446. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  43447. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  43448. * @param {Object} [options.headers] - 请求头。
  43449. */
  43450. request(options) {
  43451. const format = options.scope.format;
  43452. if (format && !this.supportDataFormat(format)) {
  43453. throw new Error(`${this.CLASS_NAME} is not surport ${format} format!`);
  43454. }
  43455. let me = this;
  43456. options.url = options.url || me.url;
  43457. if (this._returnContent(options) && !options.url.includes('returnContent=true')) {
  43458. options.url = Util_Util.urlAppend(options.url, 'returnContent=true');
  43459. }
  43460. options.proxy = options.proxy || me.proxy;
  43461. options.withCredentials = options.withCredentials != undefined ? options.withCredentials : me.withCredentials;
  43462. options.crossOrigin = options.crossOrigin != undefined ? options.crossOrigin : me.crossOrigin;
  43463. options.headers = options.headers || me.headers;
  43464. options.isInTheSameDomain = me.isInTheSameDomain;
  43465. options.withoutFormatSuffix = options.scope.withoutFormatSuffix || false;
  43466. //为url添加安全认证信息片段
  43467. options.url = SecurityManager.appendCredential(options.url);
  43468. me.calculatePollingTimes();
  43469. options.scope = me;
  43470. var success = options.scope? options.success.bind(options.scope) : options.success;
  43471. var failure = options.scope? options.failure.bind(options.scope) : options.failure;
  43472. options.success = me.getUrlCompleted(success, options);
  43473. options.failure = me.getUrlFailed(failure, options);
  43474. me._commit(options);
  43475. }
  43476. /**
  43477. * @function CommonServiceBase.prototype.getUrlCompleted
  43478. * @description 请求成功后执行此方法。
  43479. * @param {Object} cb - 成功回调函数。
  43480. * @param {Object} options - 请求参数对象。
  43481. * @private
  43482. */
  43483. getUrlCompleted(cb, options) {
  43484. // @param {Object} result - 服务器返回的结果对象。
  43485. return function(result) {
  43486. cb && cb(result, options);
  43487. }
  43488. }
  43489. /**
  43490. * @function CommonServiceBase.prototype.getUrlFailed
  43491. * @description 请求失败后执行此方法。
  43492. * @param {Object} cb - 失败回调函数。
  43493. * @param {Object} options - 请求参数对象。
  43494. * @private
  43495. */
  43496. getUrlFailed(cb, options) {
  43497. const me = this;
  43498. // @param {Object} result - 服务器返回的结果对象。
  43499. return function(result) {
  43500. if (me.totalTimes > 0) {
  43501. me.totalTimes--;
  43502. me.ajaxPolling(options);
  43503. } else {
  43504. cb && cb(result, options);
  43505. }
  43506. }
  43507. }
  43508. /**
  43509. *
  43510. * @function CommonServiceBase.prototype.ajaxPolling
  43511. * @description 请求失败后,如果剩余请求失败次数不为 0,重新获取 URL 发送请求。
  43512. * @param {Object} options - 请求参数对象。
  43513. * @private
  43514. */
  43515. ajaxPolling(options) {
  43516. let me = this,
  43517. url = options.url,
  43518. re = /^http:\/\/([a-z]{9}|(\d+\.){3}\d+):\d{0,4}/;
  43519. me.index = parseInt(Math.random() * me.length);
  43520. me.url = me.urls[me.index];
  43521. url = url.replace(re, re.exec(me.url)[0]);
  43522. options.url = url;
  43523. options.isInTheSameDomain = Util_Util.isInTheSameDomain(url);
  43524. me._commit(options);
  43525. }
  43526. /**
  43527. * @function CommonServiceBase.prototype.calculatePollingTimes
  43528. * @description 计算剩余请求失败执行次数。
  43529. */
  43530. calculatePollingTimes() {
  43531. let me = this;
  43532. if (me.times) {
  43533. if (me.totalTimes > me.POLLING_TIMES) {
  43534. if (me.times > me.POLLING_TIMES) {
  43535. me.totalTimes = me.POLLING_TIMES;
  43536. } else {
  43537. me.totalTimes = me.times;
  43538. }
  43539. } else {
  43540. if (me.times < me.totalTimes) {
  43541. me.totalTimes = me.times;
  43542. }
  43543. }
  43544. } else {
  43545. if (me.totalTimes > me.POLLING_TIMES) {
  43546. me.totalTimes = me.POLLING_TIMES;
  43547. }
  43548. }
  43549. me.totalTimes--;
  43550. }
  43551. /**
  43552. * @function CommonServiceBase.prototype.isServiceSupportPolling
  43553. * @description 判断服务是否支持轮询。
  43554. */
  43555. isServiceSupportPolling() {
  43556. let me = this;
  43557. return !(
  43558. me.CLASS_NAME === 'SuperMap.REST.ThemeService' || me.CLASS_NAME === 'SuperMap.REST.EditFeaturesService'
  43559. );
  43560. }
  43561. /**
  43562. * @function CommonServiceBase.prototype.serviceProcessCompleted
  43563. * @description 状态完成,执行此方法。
  43564. * @param {Object} result - 服务器返回的结果对象。
  43565. * @param {Object} options - 请求参数对象。
  43566. * @private
  43567. */
  43568. serviceProcessCompleted(result, options) {
  43569. result = Util_Util.transformResult(result);
  43570. this.events.triggerEvent('processCompleted', {
  43571. result: result,
  43572. options: options
  43573. });
  43574. }
  43575. /**
  43576. * @function CommonServiceBase.prototype.serviceProcessFailed
  43577. * @description 状态失败,执行此方法。
  43578. * @param {Object} result - 服务器返回的结果对象。
  43579. * @param {Object} options - 请求参数对象。对象
  43580. * @private
  43581. */
  43582. serviceProcessFailed(result, options) {
  43583. result = Util_Util.transformResult(result);
  43584. let error = result.error || result;
  43585. this.events.triggerEvent('processFailed', {
  43586. error: error,
  43587. options: options
  43588. });
  43589. }
  43590. _returnContent(options) {
  43591. if (options.scope.format === DataFormat.FGB) {
  43592. return false;
  43593. }
  43594. if (options.scope.returnContent) {
  43595. return true;
  43596. }
  43597. return false;
  43598. }
  43599. supportDataFormat(foramt) {
  43600. return this.dataFormat().includes(foramt);
  43601. }
  43602. dataFormat() {
  43603. return [DataFormat.GEOJSON, DataFormat.ISERVER];
  43604. }
  43605. _commit(options) {
  43606. if (options.method === 'POST' || options.method === 'PUT' || options.method === 'PATCH') {
  43607. if (options.params) {
  43608. options.url = Util_Util.urlAppend(options.url, Util_Util.getParameterString(options.params || {}));
  43609. }
  43610. if (typeof options.data === 'object') {
  43611. try {
  43612. options.params = Util_Util.toJSON(options.data);
  43613. } catch (e) {
  43614. console.log('不是json对象');
  43615. }
  43616. } else {
  43617. options.params = options.data;
  43618. }
  43619. }
  43620. FetchRequest.commit(options.method, options.url, options.params, {
  43621. headers: options.headers,
  43622. withoutFormatSuffix: options.withoutFormatSuffix,
  43623. withCredentials: options.withCredentials,
  43624. crossOrigin: options.crossOrigin,
  43625. timeout: options.async ? 0 : null,
  43626. proxy: options.proxy
  43627. })
  43628. .then(function (response) {
  43629. if (response.text) {
  43630. return response.text();
  43631. }
  43632. if (response.json) {
  43633. return response.json();
  43634. }
  43635. return response;
  43636. })
  43637. .then(function (text) {
  43638. let requestResult = text;
  43639. if (typeof text === 'string') {
  43640. requestResult = new JSONFormat().read(text);
  43641. }
  43642. if (
  43643. !requestResult ||
  43644. requestResult.error ||
  43645. (requestResult.code >= 300 && requestResult.code !== 304)
  43646. ) {
  43647. if (requestResult && requestResult.error) {
  43648. requestResult = {
  43649. error: requestResult.error
  43650. };
  43651. } else {
  43652. requestResult = {
  43653. error: requestResult
  43654. };
  43655. }
  43656. }
  43657. if (requestResult && options.scope.format === DataFormat.FGB) {
  43658. requestResult.newResourceLocation = requestResult.newResourceLocation.replace('.json', '') + '.fgb';
  43659. }
  43660. return requestResult;
  43661. })
  43662. .catch(function (e) {
  43663. return { error: e };
  43664. })
  43665. .then((requestResult) => {
  43666. if (requestResult.error) {
  43667. var failure = options.scope ? FunctionExt.bind(options.failure, options.scope) : options.failure;
  43668. failure(requestResult);
  43669. } else {
  43670. requestResult.succeed = requestResult.succeed == undefined ? true : requestResult.succeed;
  43671. var success = options.scope ? FunctionExt.bind(options.success, options.scope) : options.success;
  43672. success(requestResult);
  43673. }
  43674. });
  43675. }
  43676. }
  43677. /**
  43678. * 服务器请求回调函数。
  43679. * @callback RequestCallback
  43680. * @category BaseTypes Util
  43681. * @example
  43682. * var requestCallback = function (serviceResult){
  43683. * console.log(serviceResult.result);
  43684. * }
  43685. * new QueryService(url).queryByBounds(param, requestCallback);
  43686. * @param {Object} serviceResult
  43687. * @param {Object} serviceResult.result 服务器返回结果。
  43688. * @param {Object} serviceResult.object 发布应用程序事件的对象。
  43689. * @param {Object} serviceResult.type 事件类型。
  43690. * @param {Object} serviceResult.element 接受浏览器事件的 DOM 节点。
  43691. * @param {Object} serviceResult.options 请求参数。
  43692. */
  43693. ;// CONCATENATED MODULE: ./src/common/iServer/KnowledgeGraphService.js
  43694. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43695. * This program are made available under the terms of the Apache License, Version 2.0
  43696. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43697. /**
  43698. * @class KnowledgeGraphService
  43699. * @category iServer KnowledgeGraph
  43700. * @classdesc 知识图谱服务类
  43701. * @version 11.1.0
  43702. * @extends {ProcessingServiceBase}
  43703. * @param {string} url - 服务地址。
  43704. * @param {Object} options - 可选参数。
  43705. * @param {string} [options.proxy] - 服务代理地址。
  43706. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  43707. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  43708. * @param {Object} [options.headers] - 请求头。
  43709. * @usage
  43710. */
  43711. class KnowledgeGraphService_KnowledgeGraphService extends CommonServiceBase {
  43712. constructor(url, options) {
  43713. super(url, options);
  43714. this.options = options || {};
  43715. this.eventCount = 0;
  43716. this.CLASS_NAME = 'SuperMap.KnowledgeGraphService';
  43717. }
  43718. /**
  43719. * @function KnowledgeGraphService.prototype.destroy
  43720. * @override
  43721. */
  43722. destroy() {
  43723. super.destroy();
  43724. }
  43725. /**
  43726. * @function KnowledgeGraphService.prototype.query
  43727. * @description 通过查询语句查询知识图谱数据。
  43728. * @param {string} params - 查询条件。
  43729. * @param {RequestCallback} callback 回调函数。
  43730. */
  43731. query(params, callback) {
  43732. const paramKey = 'cypherQuery';
  43733. const url = Util_Util.urlAppend(this.url + '/query.json', `${paramKey}=${params}`);
  43734. this.processAsync({ url, method: 'GET', callback });
  43735. }
  43736. // /**
  43737. // * @function KnowledgeGraphService.prototype.queryById
  43738. // * @description 根据实体id查询关联节点。
  43739. // * @param {string} id - 实体id。
  43740. // * @param {RequestCallback} callback 回调函数。
  43741. // */
  43742. // queryById(id, callback) {
  43743. // const paramKey = 'cypherQuery';
  43744. // const url = Util.urlAppend(this.url + '/query.json', `${paramKey}=match p=(n)-[]-(m) where id(n)=${id} return p;`);
  43745. // this.processAsync({ url, method: 'GET', callback });
  43746. // }
  43747. // /**
  43748. // * @function KnowledgeGraphService.prototype.getMetaData
  43749. // * @description 获取元信息(展示所有实体类型和关系类型。)
  43750. // * @param {RequestCallback} callback 回调函数。
  43751. // */
  43752. // getMetaData(callback) {
  43753. // const url = this.url + 'management/metadata.json';
  43754. // this.processAsync({ url, method: 'GET', callback });
  43755. // }
  43756. /**
  43757. * @function KnowledgeGraphService.prototype.getGraphMaps
  43758. * @description 获取图谱列表
  43759. * @param {RequestCallback} callback 回调函数。
  43760. */
  43761. getGraphMaps(callback) {
  43762. const url = this.url + '/graphmaps.json';
  43763. this.processAsync({ url, method: 'GET', callback });
  43764. }
  43765. /**
  43766. * @function KnowledgeGraphService.prototype.getGraphMap
  43767. * @description 获取图谱图序列化数据
  43768. * @param {string} graphMapName 图谱名称
  43769. * @param {RequestCallback} callback 回调函数
  43770. */
  43771. getGraphMap(graphMapName, callback) {
  43772. const url = this.url + `/graphmaps/${graphMapName}.json`;
  43773. this.processAsync({ url, method: 'GET', callback });
  43774. }
  43775. /**
  43776. * @function KnowledgeGraphService.prototype.getGraphMapData
  43777. * @description 将iServer GraphMap服务的数据格式转换为KnowledgeGraph的数据格式。
  43778. * @param {string} graphMapName - 图谱名称
  43779. * @returns {Promise} Promise 对象。
  43780. */
  43781. async getGraphMapData(graphMapName) {
  43782. let data = [];
  43783. const graphMap = await this._getGraphMapData(graphMapName);
  43784. if (!graphMap) {
  43785. return;
  43786. }
  43787. const query = (graphMap.dataContent.queries && graphMap.dataContent.queries.query) || [];
  43788. let queries = [];
  43789. if (typeof query === 'string') {
  43790. queries = [query];
  43791. } else {
  43792. queries = query;
  43793. }
  43794. const expandQueries = this._getGraphMapExpandQuery(graphMap);
  43795. if (expandQueries.length) {
  43796. queries.push(...expandQueries);
  43797. }
  43798. for (let j = 0; j < queries.length; j++) {
  43799. const cypherQuery = queries[j];
  43800. const res = await this._queryDataBySql(cypherQuery);
  43801. data = data.concat([], res);
  43802. }
  43803. return { data, graphMap };
  43804. }
  43805. /**
  43806. * @private
  43807. * @function KnowledgeGraphService.prototype._getGraphMapExpandQuery
  43808. * @description 获取graphMap图谱展开节点的query条件
  43809. * @param {Object} graphMap -将iServer GraphMap图谱服务的数据
  43810. * @param {Array.<string>} 查询条件
  43811. */
  43812. _getGraphMapExpandQuery(graphMap) {
  43813. const queries = [];
  43814. const expandIds = (graphMap.dataContent.expand && JSON.parse(graphMap.dataContent.expand)) || [];
  43815. expandIds.forEach((id) => {
  43816. queries.push(`match p=(n)-[]-(m) where id(n)=${id} return p;`);
  43817. });
  43818. return queries;
  43819. }
  43820. // /**
  43821. // * @private
  43822. // * @function KnowledgeGraphService.prototype.getEntities
  43823. // * @description 获取实体。
  43824. // * @param {Object} params - 查询条件。{type:'院落', count:1}
  43825. // * @param {number} [params.count] - 返回个数
  43826. // * @param {RequestCallback} callback 回调函数
  43827. // */
  43828. // getEntities(params, callback) {
  43829. // const url = Util.urlAppend(this.url + '/entities.json', params);
  43830. // this.processAsync({ url, params, method: 'GET', callback });
  43831. // }
  43832. // /**
  43833. // * @private
  43834. // * @function KnowledgeGraphService.prototype.getEdges
  43835. // * @description 获取实体。
  43836. // * @param {Object} params - 查询条件。{type:'院落', count:1}
  43837. // * @param {number} [params.count] - 返回个数
  43838. // * @param {RequestCallback} callback 回调函数
  43839. // */
  43840. // getEdges(params, callback) {
  43841. // const url = Util.urlAppend(this.url + '/edges.json', params);
  43842. // this.processAsync({ url, params, method: 'GET', callback });
  43843. // }
  43844. // /**
  43845. // * @private
  43846. // * @function KnowledgeGraphService.prototype.getEntities
  43847. // * @description 获取实体。
  43848. // * @param {number} id - 查询条件。{type:'院落', count:1}
  43849. // * @param {RequestCallback} callback 回调函数
  43850. // */
  43851. // deleteEntitiy(id, callback) {
  43852. // const url = Util.urlAppend(this.url + '/entities.json', `id=${id}`);
  43853. // this.processAsync({ url, method: 'DELETE', callback });
  43854. // }
  43855. // /**
  43856. // * @private
  43857. // * @function KnowledgeGraphService.prototype.addNode
  43858. // * @description 获取实体。
  43859. // * @param {Object} params - 查询条件
  43860. // * @param {number} [params.count] - 返回个数
  43861. // * @param {RequestCallback} callback 回调函数
  43862. // */
  43863. // addNode(params, callback) {
  43864. // if (!(params instanceof KnowledgeGraphNodeParameter)) {
  43865. // return;
  43866. // }
  43867. // const url = Util.urlAppend(this.url + '/entities.json', params);
  43868. // this.processAsync({ url, params, method: 'PUT', callback });
  43869. // }
  43870. // /**
  43871. // * @private
  43872. // * @function KnowledgeGraphService.prototype.addEdge
  43873. // * @description 获取实体。
  43874. // * @param {Object} params - 查询条件
  43875. // * @param {number} [params.count] - 返回个数
  43876. // * @param {RequestCallback} callback 回调函数
  43877. // */
  43878. // addEdge(params, callback) {
  43879. // if (!(params instanceof KnowledgeGraphEdgeParameter)) {
  43880. // return;
  43881. // }
  43882. // const url = Util.urlAppend(this.url + '/edges.json', params);
  43883. // this.processAsync({ url, params, method: 'PUT', callback });
  43884. // }
  43885. /**
  43886. * @function KnowledgeGraphService.prototype.processAsync
  43887. * @description 负责将客户端的动态分段服务参数传递到服务端。
  43888. * @param {string} url - 服务地址
  43889. * @param {Object} params - 参数
  43890. */
  43891. processAsync({ url, params, method, callback }) {
  43892. let eventId = ++this.eventCount;
  43893. let eventListeners = {
  43894. scope: this,
  43895. processCompleted: function (result) {
  43896. if (eventId === result.result.eventId && callback) {
  43897. delete result.result.eventId;
  43898. callback(result);
  43899. this.events && this.events.un(eventListeners);
  43900. return false;
  43901. }
  43902. },
  43903. processFailed: function (result) {
  43904. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  43905. delete result.eventId;
  43906. callback(result);
  43907. this.events && this.events.un(eventListeners);
  43908. return false;
  43909. }
  43910. }
  43911. };
  43912. this.events.on(eventListeners);
  43913. const requestParams = {
  43914. method,
  43915. url,
  43916. scope: this,
  43917. success(result, options) {
  43918. result.eventId = eventId;
  43919. this.serviceProcessCompleted(result, options);
  43920. },
  43921. failure(result, options) {
  43922. result.eventId = eventId;
  43923. this.serviceProcessFailed(result, options);
  43924. }
  43925. };
  43926. if (params) {
  43927. requestParams.params = params;
  43928. }
  43929. this.request(requestParams);
  43930. }
  43931. /**
  43932. * @private
  43933. * @function _getGraphMapData
  43934. * @description 获取图谱信息
  43935. * @param {string} graphMapName - 图谱名称
  43936. * @returns {Promise} Promise 对象
  43937. */
  43938. _getGraphMapData(graphMapName) {
  43939. return new Promise((resolve, reject) => {
  43940. this.getGraphMap(graphMapName, (res) => {
  43941. if (res.type === 'processFailed') {
  43942. reject(res.error);
  43943. } else {
  43944. if (res.result.data === '') {
  43945. reject('无数据');
  43946. } else {
  43947. resolve(res.result.graphMap);
  43948. }
  43949. }
  43950. });
  43951. });
  43952. }
  43953. /**
  43954. * @private
  43955. * @function _queryDataBySql
  43956. * @description 查询实体和关系数据。
  43957. * @param {string} cypherQuery - 查询语句
  43958. * @returns {Promise} Promise 对象。
  43959. */
  43960. _queryDataBySql(cypherQuery) {
  43961. return new Promise((resolve, reject) => {
  43962. this.query(cypherQuery, (res) => {
  43963. if (res.type === 'processFailed') {
  43964. reject(res.error);
  43965. } else {
  43966. resolve(res.result);
  43967. }
  43968. });
  43969. });
  43970. }
  43971. }
  43972. ;// CONCATENATED MODULE: ./src/mapboxgl/services/KnowledgeGraphService.js
  43973. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43974. * This program are made available under the terms of the Apache License, Version 2.0
  43975. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43976. /**
  43977. * @class KnowledgeGraphService
  43978. * @category iServer KnowledgeGraph
  43979. * @classdesc 知识图谱服务类。
  43980. * @version 11.1.0
  43981. * @example
  43982. * new KnowledgeGraphService(url)
  43983. * .query(param,function(result){
  43984. * //doSomething
  43985. * })
  43986. * @extends {ServiceBase}
  43987. * @param {string} url - 服务地址。
  43988. * @param {Object} options -参数。
  43989. * @param {string} [options.proxy] - 服务代理地址。
  43990. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  43991. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  43992. * @param {Object} [options.headers] - 请求头。
  43993. * @usage
  43994. */
  43995. class KnowledgeGraphService extends ServiceBase {
  43996. constructor(url, options) {
  43997. super(url, options);
  43998. this._knowledgeGraphService = new KnowledgeGraphService_KnowledgeGraphService(url, options);
  43999. }
  44000. /**
  44001. * @function KnowledgeGraphService.prototype.query
  44002. * @description 通过查询语句查询知识图谱数据。
  44003. * @param {string} cypherQuery - 查询条件。
  44004. * @param {RequestCallback} callback - 回调函数。
  44005. */
  44006. query(cypherQuery, callback) {
  44007. this._knowledgeGraphService.query(cypherQuery, callback);
  44008. }
  44009. // /**
  44010. // * @function KnowledgeGraphService.prototype.getMetaData
  44011. // * @description 获取元信息(展示所有实体类型和关系类型。)
  44012. // * @param {RequestCallback} callback 回调函数。
  44013. // */
  44014. // getMetaData(callback) {
  44015. // this._knowledgeGraphService.getMetaData(callback);
  44016. // }
  44017. /**
  44018. * @function KnowledgeGraphService.prototype.getGraphMaps
  44019. * @description 获取图谱列表。
  44020. * @param {RequestCallback} callback 回调函数。
  44021. */
  44022. getGraphMaps(callback) {
  44023. this._knowledgeGraphService.getGraphMaps(callback);
  44024. }
  44025. /**
  44026. * @function KnowledgeGraphService.prototype.getGraphMap
  44027. * @description 获取图谱图序列化数据。
  44028. * @param {string} params 图谱名称。
  44029. * @param {RequestCallback} callback 回调函数。
  44030. */
  44031. getGraphMap(params, callback) {
  44032. this._knowledgeGraphService.getGraphMap(params, callback);
  44033. }
  44034. /**
  44035. * @function KnowledgeGraphService.prototype.getGraphMapData
  44036. * @description 将iServer GraphMap服务的数据格式转换为KnowledgeGraph的数据格式。
  44037. * @param {string} graphMapName - 图谱名称。
  44038. * @returns {Promise} Promise 对象。
  44039. */
  44040. async getGraphMapData(graphMapName) {
  44041. const res = await this._knowledgeGraphService.getGraphMapData(graphMapName);
  44042. return res;
  44043. }
  44044. }
  44045. // EXTERNAL MODULE: ./node_modules/lodash.uniqby/index.js
  44046. var lodash_uniqby = __webpack_require__(618);
  44047. var lodash_uniqby_default = /*#__PURE__*/__webpack_require__.n(lodash_uniqby);
  44048. ;// CONCATENATED MODULE: ./src/common/overlay/knowledge-graph/format.js
  44049. function transformGraphMap(data, graphMap) {
  44050. const style = graphMap && graphMap.styles && graphMap.styles.style;
  44051. const captionField = graphMap && graphMap.captionFields && graphMap.captionFields.captionField;
  44052. const rst = { nodes: [], edges: [] };
  44053. data.forEach((item) => {
  44054. const pathData = item.path;
  44055. if (pathData) {
  44056. const { nodes, edges } = transformPath(pathData, style, captionField);
  44057. rst.nodes.push(...nodes);
  44058. rst.edges.push(...edges);
  44059. } else if (isEdge(item)) {
  44060. const edge = edgeFromGraphMap(item, style);
  44061. rst.edges.push(edge);
  44062. } else {
  44063. const node = nodeFromGraphMap(item, style, captionField);
  44064. rst.nodes.push(node);
  44065. }
  44066. });
  44067. return { nodes: uniqData(rst.nodes), edges: uniqData(rst.edges, 'edgeId') };
  44068. }
  44069. function uniqData(data, paramName = 'id') {
  44070. return lodash_uniqby_default()(data, paramName);
  44071. }
  44072. function isEdge(entity) {
  44073. return entity.hasOwnProperty('start') && entity.hasOwnProperty('end');
  44074. }
  44075. function transformPath(pathData, style, captionField) {
  44076. const rst = { nodes: [], edges: [] };
  44077. pathData.forEach((item) => {
  44078. if (isEdge(item)) {
  44079. const edge = edgeFromGraphMap(item, style);
  44080. rst.edges.push(edge);
  44081. } else {
  44082. const node = nodeFromGraphMap(item, style, captionField);
  44083. rst.nodes.push(node);
  44084. }
  44085. });
  44086. return rst;
  44087. }
  44088. function nodeFromGraphMap(entity, style, captionField) {
  44089. const { id, properties, lables } = entity;
  44090. const styleData = style ? getNodeStyle(entity, style) : {};
  44091. const label = getNodeLabel(entity, captionField);
  44092. const fillColor = styleData.fillColor || '';
  44093. const node = {
  44094. id: id + '',
  44095. label: label,
  44096. properties,
  44097. lables
  44098. };
  44099. if (styleData.size) {
  44100. node.size = styleData.size;
  44101. delete styleData.size;
  44102. }
  44103. if (styleData.fillColor) {
  44104. node.style = {
  44105. fill: fillColor,
  44106. stroke: fillColor
  44107. };
  44108. delete styleData.fillColor;
  44109. }
  44110. if (Object.keys(styleData).length !== 0) {
  44111. node.labelCfg = {
  44112. style: styleData
  44113. };
  44114. }
  44115. return node;
  44116. }
  44117. function edgeFromGraphMap(entity, style) {
  44118. const { start, end, id, type, properties } = entity;
  44119. const styleData = style ? getEdgeStyle(entity, style) : {};
  44120. return {
  44121. source: start + '',
  44122. target: end + '',
  44123. edgeId: id + '',
  44124. label: type,
  44125. labelCfg: {
  44126. style: styleData
  44127. },
  44128. properties
  44129. };
  44130. }
  44131. function getEdgeStyle(entity, style) {
  44132. if (!style) {
  44133. return {};
  44134. }
  44135. const { id, type } = entity;
  44136. const data = style.filter((item) => item.type === 'relationShip');
  44137. for (let i = 0; i < data.length; i++) {
  44138. const { textColor, font, relationTypes, relationIds } = data[i];
  44139. const ids = JSON.parse(relationIds || '[]');
  44140. const types = JSON.parse(relationTypes || '[]');
  44141. if (ids.includes(id) || types.includes(type)) {
  44142. return {
  44143. fontSize: compileFontSize(font.fontSize),
  44144. fontFamily: font.fontName,
  44145. fill: textColor,
  44146. ...formatFontStyle(font.fontStyle)
  44147. };
  44148. }
  44149. }
  44150. return {};
  44151. }
  44152. function getNodeStyle(entity, style) {
  44153. if (!style) {
  44154. return {};
  44155. }
  44156. const { id, labels } = entity;
  44157. const data = style.filter((item) => item.type === 'entity');
  44158. for (let i = 0; i < data.length; i++) {
  44159. const { color, textColor, font, size, entityTypes, entityIds } = data[i];
  44160. const ids = JSON.parse(entityIds || '[]');
  44161. const types = JSON.parse(entityTypes || '[]');
  44162. if (ids.includes(id) || types.includes(labels[0])) {
  44163. return {
  44164. fillColor: color,
  44165. fontSize: compileFontSize(font.fontSize),
  44166. fontFamily: font.fontName,
  44167. fill: textColor,
  44168. size: size,
  44169. // stroke: color,
  44170. ...formatFontStyle(font.fontStyle)
  44171. };
  44172. }
  44173. }
  44174. return {};
  44175. }
  44176. function getNodeLabel(entity, captionField) {
  44177. const { id, labels, properties } = entity;
  44178. if (captionField) {
  44179. const data = captionField instanceof Array ? captionField : [captionField];
  44180. for (let i = 0; i < data.length; i++) {
  44181. const { name, entityTypes, entityIds } = data[i];
  44182. const ids = JSON.parse(entityIds || '[]');
  44183. const types = JSON.parse(entityTypes || '[]');
  44184. if (ids.includes(id) || types.includes(labels[0])) {
  44185. return properties[name] || '';
  44186. }
  44187. }
  44188. }
  44189. return properties[properties._labelfieldname] || '';
  44190. }
  44191. function formatFontStyle(fontStyle) {
  44192. if (fontStyle === 1) {
  44193. return { fontWeight: 600 };
  44194. }
  44195. if (fontStyle === 2) {
  44196. return { fontStyle: 'italic' };
  44197. }
  44198. return {};
  44199. }
  44200. function compileFontSize(fontSize) {
  44201. return fontSize * 0.8;
  44202. }
  44203. // 处理graphMap数据的展开 折叠 隐藏的实体数据
  44204. function transformExpandCollapseHiddenData(graphMap) {
  44205. const { expand, collapse, hidden } = graphMap.dataContent;
  44206. return {
  44207. expand: expand && JSON.parse(expand),
  44208. collapse: collapse && JSON.parse(collapse),
  44209. hidden: hidden && JSON.parse(hidden)
  44210. };
  44211. }
  44212. ;// CONCATENATED MODULE: external "function(){try{return G6}catch(e){return {}}}()"
  44213. const external_function_try_return_G6_catch_e_return_namespaceObject = function(){try{return G6}catch(e){return {}}}();
  44214. var external_function_try_return_G6_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_G6_catch_e_return_namespaceObject);
  44215. // EXTERNAL MODULE: ./node_modules/insert-css/index.js
  44216. var insert_css = __webpack_require__(186);
  44217. var insert_css_default = /*#__PURE__*/__webpack_require__.n(insert_css);
  44218. ;// CONCATENATED MODULE: ./src/common/overlay/knowledge-graph/G6Render.js
  44219. /**
  44220. * @private
  44221. * @class G6Render
  44222. * @category iServer G6Render
  44223. * @classdesc G6Render
  44224. * @param {KnowledgeGraph.Data} data - 创建graph实例的数据项。
  44225. * @param {KnowledgeGraph.Config} [config] - 创建graph实例的配置项。
  44226. * @private
  44227. */
  44228. class G6Render {
  44229. constructor() {
  44230. this.config = null;
  44231. this.graph = null;
  44232. this.data = null;
  44233. this.collpasedData = {};
  44234. this.importG6();
  44235. this.CLASS_NAME = 'SuperMap.G6Render';
  44236. }
  44237. importG6() {
  44238. if (!(external_function_try_return_G6_catch_e_return_default())) {
  44239. console.log('please import g6, eg:https://gw.alipayobjects.com/os/lib/antv/g6/4.3.2/dist/g6.min.js');
  44240. }
  44241. }
  44242. /**
  44243. * @function G6Render.prototype.initGraph
  44244. * @description 创建KnowledgeGraph实例
  44245. * @param {KnowledgeGraph.Config} config - graph配置项。
  44246. * @returns {Object} graph实例。
  44247. */
  44248. initGraph(config) {
  44249. const graph = new (external_function_try_return_G6_catch_e_return_default()).Graph(config);
  44250. this.graph = graph;
  44251. if (!config || config.highlightNode !== false) {
  44252. this.highlightNode(graph);
  44253. }
  44254. if (!config || config.highlightEdge !== false) {
  44255. this.highlightEdge(graph);
  44256. }
  44257. if (config.dragCanvas !== false || config.dragNode !== false) {
  44258. // 阻止事件冒泡
  44259. this.stopDefaultEventPropagation();
  44260. }
  44261. return graph;
  44262. }
  44263. _getContextMenu() {
  44264. const contextMenu = new (external_function_try_return_G6_catch_e_return_default()).Menu({
  44265. shouldBegin(evt) {
  44266. if (evt.target && evt.target.isCanvas && evt.target.isCanvas()) {
  44267. return true;
  44268. }
  44269. if (evt.item) {
  44270. return true;
  44271. }
  44272. return false;
  44273. },
  44274. getContent: (evt) => {
  44275. const { item } = evt;
  44276. if (evt.target && evt.target.isCanvas && evt.target.isCanvas()) {
  44277. return;
  44278. }
  44279. if (!item) {
  44280. return;
  44281. }
  44282. const itemType = item.getType();
  44283. const model = item.getModel();
  44284. if (itemType && model) {
  44285. if (itemType === 'node') {
  44286. if (this.isCollpased(model.id)) {
  44287. return `<ul>
  44288. <li id='expand'>展开</li>
  44289. <li id='hide'>隐藏</li>
  44290. </ul>`;
  44291. } else {
  44292. return `<ul>
  44293. <li id='collapse'>折叠</li>
  44294. <li id='hide'>隐藏</li>
  44295. </ul>`;
  44296. }
  44297. }
  44298. }
  44299. },
  44300. handleMenuClick: (target, item) => {
  44301. const liIdStrs = target.id.split('-');
  44302. switch (liIdStrs[0]) {
  44303. case 'hide':
  44304. this.hideItem(item);
  44305. break;
  44306. case 'expand':
  44307. this.expandNode(item);
  44308. break;
  44309. case 'collapse':
  44310. this.collapseNode(item);
  44311. break;
  44312. case 'show':
  44313. this.showItem(item);
  44314. break;
  44315. default:
  44316. break;
  44317. }
  44318. },
  44319. // 需要加上父级容器的 padding-left 16 与自身偏移量 10
  44320. offsetX: 16 + 10,
  44321. // 需要加上父级容器的 padding-top 24 、画布兄弟元素高度、与自身偏移量 10
  44322. offsetY: 0,
  44323. // 在哪些类型的元素上响应
  44324. itemTypes: ['node', 'edge', 'canvas']
  44325. });
  44326. return contextMenu;
  44327. }
  44328. _getGraphConfig(config) {
  44329. const animateConfig = {
  44330. speed: 120,
  44331. maxIteration: 83,
  44332. tick: () => {
  44333. this.refreshPositions()
  44334. }
  44335. };
  44336. const defaultLayout = {
  44337. type: 'fruchterman',
  44338. gravity: 5
  44339. };
  44340. const defaultNode = {};
  44341. const defaultEdge = {
  44342. type: 'line',
  44343. style: {
  44344. endArrow: {
  44345. path: 'M 0,0 L 2,1 L 2,-1 Z'
  44346. },
  44347. lineWidth: 0.5
  44348. },
  44349. labelCfg: {
  44350. autoRotate: true,
  44351. style: {
  44352. fontSize: 4,
  44353. fill: '#333'
  44354. }
  44355. }
  44356. };
  44357. const defaultMode = {
  44358. default: ['drag-canvas', 'zoom-canvas', 'drag-node']
  44359. };
  44360. const contextMenu = this._getContextMenu();
  44361. const defaultPlugins = [new (external_function_try_return_G6_catch_e_return_default()).ToolBar(), contextMenu];
  44362. const hoverColor = '#b4d6ff';
  44363. const defaultNodeHighlightStyle = {
  44364. lineWidth: 3,
  44365. stroke: hoverColor
  44366. };
  44367. const defaultEdgeHighlightStyle = {
  44368. stroke: hoverColor,
  44369. lineWidth: 2,
  44370. endArrow: {
  44371. path: 'M 0,0 L 2,1 L 2,-1 Z',
  44372. fill: hoverColor
  44373. }
  44374. };
  44375. const defaultGraphConfig = (container = 'knowledgeGraph') => {
  44376. const dom = document.querySelector(`#${container}`);
  44377. return {
  44378. container: container, // String | HTMLElement,必须,在 Step 1 中创建的容器 id 或容器本身
  44379. width: dom.scrollWidth, // Number,必须,图的宽度
  44380. height: dom.scrollHeight, // Number,必须,图的高度
  44381. plugins: defaultPlugins,
  44382. modes: defaultMode,
  44383. layout: { ...defaultLayout, ...animateConfig },
  44384. defaultNode,
  44385. defaultEdge,
  44386. nodeStateStyles: {
  44387. hover: defaultNodeHighlightStyle
  44388. },
  44389. edgeStateStyles: {
  44390. hover: defaultEdgeHighlightStyle
  44391. }
  44392. };
  44393. };
  44394. if (!config) {
  44395. this._setToolBarStyle();
  44396. return defaultGraphConfig();
  44397. }
  44398. config.container = config.container || 'knowledgeGraph';
  44399. const dom =
  44400. typeof config.container === 'string' ? document.querySelector(`#${config.container}`) : config.container;
  44401. config.width = config.width || dom.scrollWidth;
  44402. config.height = config.height || dom.scrollHeight;
  44403. config.layout = { ...defaultLayout, ...(config.layout || {}), ...(config.animate !== false ? animateConfig : {}) };
  44404. config.defaultNode = { ...defaultNode, ...(config.defaultNode || {}) };
  44405. config.defaultEdge = { ...defaultEdge, ...(config.defaultEdge || {}) };
  44406. config.modes = {
  44407. default: [
  44408. config.dragCanvas !== false && 'drag-canvas',
  44409. config.zoomCanvas !== false && 'zoom-canvas',
  44410. config.dragNode !== false && 'drag-node'
  44411. ]
  44412. };
  44413. config.nodeStateStyles = {
  44414. hover: { ...defaultNodeHighlightStyle, ...(config.nodeHighlightStyle || {}) }
  44415. };
  44416. config.edgeStateStyles = {
  44417. hover: { ...defaultEdgeHighlightStyle, ...(config.edgeHighlightStyle || {}) }
  44418. };
  44419. if (config.showToolBar !== false) {
  44420. config.plugins = [new (external_function_try_return_G6_catch_e_return_default()).ToolBar()];
  44421. this._setToolBarStyle();
  44422. }
  44423. if (config.showContextMenu !== false) {
  44424. config.plugins = [...(config.plugins || []), contextMenu];
  44425. this._setToolBarStyle();
  44426. }
  44427. return config;
  44428. }
  44429. /**
  44430. * @function KnowledgeGraph.prototype.changeSize
  44431. * @description 当源数据中现有节点/边 的数据项发生配置的变更时,根据新数据刷新视图。
  44432. * @param {number} width - 宽度。
  44433. * @param {number} height - 高度。
  44434. */
  44435. changeSize(width, height) {
  44436. return this.graph.changeSize(width, height);
  44437. }
  44438. /**
  44439. * @function G6Render.prototype.autoResize
  44440. * @description 浏览器窗口大小发生改变时,重新渲染;
  44441. */
  44442. autoResize() {
  44443. const dom = this.getContainer();
  44444. window.addEventListener('resize', () => {
  44445. const width = dom.scrollWidth;
  44446. const height = dom.scrollHeight;
  44447. this.graph.changeSize(width, height);
  44448. this.graph.refresh();
  44449. });
  44450. }
  44451. /**
  44452. * @function G6Render.prototype.zoom
  44453. * @description 改变视口的缩放比例,在当前画布比例下缩放,是相对比例。
  44454. * @param {number} ratio 缩放比例。
  44455. * @param {Object} [center] 以 center 的 x、y 坐标为中心缩放,如果省略了 center 参数,则以元素当前位置为中心缩放。
  44456. * @param {boolean} [animate] 是否开启动画。
  44457. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  44458. */
  44459. zoom(ratio, center, animate, animateCfg) {
  44460. this.graph.zoom(ratio, center, animate, animateCfg);
  44461. }
  44462. /**
  44463. * @function G6Render.prototype.zoomTo
  44464. * @description 改变视口的缩放比例,在当前画布比例下缩放,是相对比例。
  44465. * @param {number} ratio 缩放比例。
  44466. * @param {Object} [center] 以 center 的 x、y 坐标为中心缩放,如果省略了 center 参数,则以元素当前位置为中心缩放。
  44467. * @param {boolean} [animate] 是否开启动画。
  44468. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  44469. */
  44470. zoomTo(ratio, center, animate, animateCfg) {
  44471. this.graph.zoomTo(ratio, center, animate, animateCfg);
  44472. }
  44473. /**
  44474. * @function G6Render.prototype.fitView
  44475. * @description 让画布内容适应视口。
  44476. * @param {Array.<number>|number} [padding] [top, right, bottom, left] 四个方向上的间距值。
  44477. * @param {Object} [rules] fitView 的规则,参数如下:{ onlyOutOfViewPort?: boolean; direction?: 'x' / 'y' / 'both'; ratioRule?: 'max' / 'min}。
  44478. * @param {boolean} [animate] 是否开启动画。
  44479. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  44480. */
  44481. fitView(padding, rules, animate, animateCfg) {
  44482. this.graph.fitView(padding, rules, animate, animateCfg);
  44483. }
  44484. /**
  44485. * @function G6Render.prototype.fitCenter
  44486. * @description 平移图到中心将对齐到画布中心,但不缩放。优先级低于 fitView。
  44487. * @param {boolean} [animate] 是否开启动画。
  44488. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画,参见基础动画教程。若未配置,则跟随 graph 的 animateCfg 参数。
  44489. */
  44490. fitCenter(animate, animateCfg) {
  44491. this.graph.fitCenter(animate, animateCfg);
  44492. }
  44493. /**
  44494. * @function G6Render.prototype.getGraphCenterPoint
  44495. * @description 获取图内容的中心绘制坐标。
  44496. * @return {Object} 包含的属性:x 和 y 属性,分别表示渲染坐标下的 x、y 值。
  44497. */
  44498. getGraphCenterPoint() {
  44499. return this.graph.getGraphCenterPoint();
  44500. }
  44501. /**
  44502. * @function G6Render.prototype.getViewPortCenterPoint
  44503. * @description 获取视口中心绘制坐标。
  44504. * @return {Object} 包含的属性:x 和 y 属性,分别表示渲染坐标下的 x、y 值。
  44505. */
  44506. getViewPortCenterPoint() {
  44507. return this.graph.getViewPortCenterPoint();
  44508. }
  44509. /**
  44510. * @function G6Render.prototype.getZoom
  44511. * @description 获取当前视口的缩放比例。
  44512. * @return {number} 返回值表示当前视口的缩放比例, 默认值为 1。
  44513. */
  44514. getZoom() {
  44515. return this.graph.getZoom();
  44516. }
  44517. /**
  44518. * @function G6Render.prototype.getMinZoom
  44519. * @description 获取 graph 当前允许的最小缩放比例。
  44520. * @return {number} 返回值表示当前视口的最小缩放比例。
  44521. */
  44522. getMinZoom() {
  44523. return this.graph.getMinZoom();
  44524. }
  44525. /**
  44526. * @function G6Render.prototype.setMinZoom
  44527. * @description 设置 graph 当前允许的最小缩放比例。
  44528. * @param {number} ratio 缩放比例。
  44529. */
  44530. setMinZoom(ratio) {
  44531. this.graph.setMinZoom(ratio);
  44532. }
  44533. /**
  44534. * @function G6Render.prototype.getMaxZoom
  44535. * @description 获取 graph 当前允许的最大缩放比例。
  44536. * @return {number} 返回值表示当前视口的最大缩放比例。
  44537. */
  44538. getMaxZoom() {
  44539. return this.graph.getMaxZoom();
  44540. }
  44541. /**
  44542. * @function G6Render.prototype.setMaxZoom
  44543. * @description 设置 graph 当前允许的最大缩放比例。
  44544. * @param {number} ratio 缩放比例。
  44545. */
  44546. setMaxZoom(ratio) {
  44547. this.graph.setMaxZoom(ratio);
  44548. }
  44549. /**
  44550. * @function G6Render.prototype.getWidth
  44551. * @description获取 graph 当前的宽度。
  44552. * @return {number} graph 当前的宽度。
  44553. */
  44554. getWidth() {
  44555. return this.graph.getWidth();
  44556. }
  44557. /**
  44558. * @function G6Render.prototype.getHeight
  44559. * @description 获取 graph 当前的高度。
  44560. * @return {number} graph 当前的高度。
  44561. */
  44562. getHeight() {
  44563. return this.graph.getHeight();
  44564. }
  44565. setCenter(centerDrawPoint) {
  44566. var centerCanvasPointX = this.graph.getWidth() / 2;
  44567. var centerCanvasPointY = this.graph.getHeight() / 2;
  44568. var centerCanvasPointNew = this.graph.getCanvasByPoint(centerDrawPoint.x, centerDrawPoint.y);
  44569. this.graph.translate(centerCanvasPointX - centerCanvasPointNew.x, centerCanvasPointY - centerCanvasPointNew.y);
  44570. }
  44571. /**
  44572. * @function G6Render.prototype._setToolBarStyle
  44573. * @description 隐藏工具栏的redo undo realZoom按钮
  44574. * @private
  44575. */
  44576. _setToolBarStyle() {
  44577. insert_css_default()(`
  44578. .g6-component-toolbar li[code='redo'],
  44579. .g6-component-toolbar li[code='undo'],
  44580. .g6-component-toolbar li[code='realZoom'] {
  44581. display: none;
  44582. }
  44583. .g6-component-contextmenu {
  44584. position: absolute;
  44585. z-index: 2;
  44586. list-style-type: none;
  44587. border-radius: 6px;
  44588. font-size: 14px;
  44589. width: fit-content;
  44590. transition: opacity .2s;
  44591. text-align: center;
  44592. box-shadow: 0 5px 18px 0 rgba(0, 0, 0, 0.6);
  44593. border: 0px;
  44594. }
  44595. .g6-component-contextmenu ul {
  44596. padding-left: 0px;
  44597. margin: 0;
  44598. }
  44599. .g6-component-contextmenu li {
  44600. cursor: pointer;
  44601. list-style-type: none;
  44602. list-style: none;
  44603. margin-left: 0;
  44604. line-height: 38px;
  44605. padding: 0px 35px;
  44606. }
  44607. .g6-component-contextmenu li:hover {
  44608. color: #333;
  44609. background: #aaaaaa45;
  44610. }
  44611. `);
  44612. }
  44613. /**
  44614. * @function G6Render.prototype.highlightNode
  44615. * @description 鼠标移入节点,节点高亮
  44616. * @param {Object} graph - graph实例。
  44617. */
  44618. highlightNode(graph = this.graph) {
  44619. function clearAllStats() {
  44620. graph.setAutoPaint(false);
  44621. graph.getNodes().forEach(function (node) {
  44622. graph.clearItemStates(node);
  44623. });
  44624. graph.paint();
  44625. graph.setAutoPaint(true);
  44626. }
  44627. graph.on('node:mouseenter', function (e) {
  44628. const item = e.item;
  44629. graph.setAutoPaint(false);
  44630. graph.getNodes().forEach(function (node) {
  44631. graph.clearItemStates(node);
  44632. });
  44633. graph.setItemState(item, 'hover', true);
  44634. graph.paint();
  44635. graph.setAutoPaint(true);
  44636. });
  44637. graph.on('node:mouseleave', clearAllStats);
  44638. }
  44639. /**
  44640. * @function G6Render.prototype.highlightNode
  44641. * @description 鼠标移入节点,节点高亮
  44642. * @param {Object} graph - graph实例。
  44643. */
  44644. highlightEdge(graph = this.graph) {
  44645. function clearAllStats() {
  44646. graph.setAutoPaint(false);
  44647. graph.getEdges().forEach(function (edge) {
  44648. graph.clearItemStates(edge);
  44649. });
  44650. graph.paint();
  44651. graph.setAutoPaint(true);
  44652. }
  44653. graph.on('edge:mouseenter', function (e) {
  44654. const item = e.item;
  44655. graph.setAutoPaint(false);
  44656. graph.getNodes().forEach(function (node) {
  44657. graph.clearItemStates(node);
  44658. });
  44659. graph.setItemState(item, 'hover', true);
  44660. graph.paint();
  44661. graph.setAutoPaint(true);
  44662. });
  44663. graph.on('edge:mouseleave', clearAllStats);
  44664. }
  44665. /**
  44666. * @function G6Render.prototype.setData
  44667. * @description 设置数据
  44668. * @param {KnowledgeGraph.Data} data - graph数据。
  44669. * @param {Object} [graph] - graph实例。
  44670. */
  44671. setData(data, graph = this.graph) {
  44672. if (!this.data) {
  44673. graph.data(data);
  44674. } else {
  44675. graph.changeData(data);
  44676. }
  44677. this.data = data;
  44678. }
  44679. /**
  44680. * @function G6Render.prototype.render
  44681. * @description 根据提供的数据渲染视图。
  44682. */
  44683. render(graph = this.graph) {
  44684. return graph.render();
  44685. }
  44686. /**
  44687. * @function G6Render.prototype.updateGraph
  44688. * @description 更新数据
  44689. * @param {Object} graph - graph实例。
  44690. * @param {KnowledgeGraph.Data} data - graph数据。
  44691. */
  44692. updateGraph(data, graph = this.graph) {
  44693. this.data = data;
  44694. graph.changeData(data);
  44695. }
  44696. /**
  44697. * @function G6Render.prototype.refresh
  44698. * @description 当源数据中现有节点/边的数据项发生配置的变更时,根据新数据刷新视图。
  44699. * @param {Object} graph - graph实例。
  44700. */
  44701. refresh(graph = this.graph) {
  44702. graph.refresh();
  44703. }
  44704. /**
  44705. * @function G6Render.prototype.getContainer
  44706. * @description 获取 Graph 的 DOM 容器。
  44707. * @param {Object} graph - graph实例。
  44708. * @return {HTMLElement} DOM 容器。
  44709. */
  44710. getContainer(graph = this.graph) {
  44711. return graph.getContainer();
  44712. }
  44713. /**
  44714. * @function G6Render.prototype.getCanvas
  44715. * @description 获取canvas。
  44716. * @param {Object} graph - graph实例。
  44717. * @return {HTMLElement} canvas。
  44718. */
  44719. getCanvas(graph = this.graph) {
  44720. return graph.get('canvas');
  44721. }
  44722. /**
  44723. * @function G6Render.prototype.getNodes
  44724. * @description 获取图中所有节点的实例。
  44725. * @param {Object} graph - graph实例。
  44726. * @return {Array} 返回值表示图中所有节点的实例。
  44727. */
  44728. getNodes(graph = this.graph) {
  44729. return graph.getNodes();
  44730. }
  44731. /**
  44732. * @function G6Render.prototype.getEdges
  44733. * @description 获取图中所有节点的实例。这里返回的是边的实例,而不是边的数据项。
  44734. * @param {Object} graph - graph实例。
  44735. * @return {Array} 返回值表示图中所有边的实例。
  44736. */
  44737. getEdges(graph = this.graph) {
  44738. return graph.getEdges();
  44739. }
  44740. /**
  44741. * @function G6Render.prototype.getNeighbors
  44742. * @description 获取邻居节点数组。
  44743. * @param {Object} graph - graph实例。
  44744. * @param {string | INode} node - 节点 ID 或节点实例。
  44745. * @param {string|undefined} type -['source'| 'target' |undefined] 邻居类型, 'source' 只获取当前节点的源节点,'target' 只获取当前节点指向的目标节点, 若不指定则返回所有类型的邻居。
  44746. * @return {Array} 返回值符合要求的节点数组。
  44747. */
  44748. getNeighbors(node, type, graph = this.graph) {
  44749. return graph.getNeighbors(node, type);
  44750. }
  44751. /**
  44752. * @function G6Render.prototype.findById
  44753. * @description 根据 ID,查询对应的元素实例。
  44754. * @param {Object} graph - graph实例。
  44755. * @param {string} id - 元素 ID
  44756. * @return {Object} 如果有符合规则的元素实例,则返回第一个匹配的元素实例,否则返回 undefined 。
  44757. */
  44758. findById(id, graph = this.graph) {
  44759. return graph.findById(id);
  44760. }
  44761. /**
  44762. * @function G6Render.prototype.find
  44763. * @description 获取邻居节点数组。
  44764. * @param {Object} graph - graph实例。
  44765. * @param {string} type - 元素类型,可选值为 'node'、'edge'
  44766. * @param {Function} fn - 查找的规则。
  44767. * @return {Object} 如果有符合规则的元素实例,则返回第一个匹配的元素实例,否则返回 undefined 。
  44768. */
  44769. find(type, fn, graph = this.graph) {
  44770. return graph.find(type, fn);
  44771. }
  44772. /**
  44773. * @function G6Render.prototype.findAll
  44774. * @description 获取邻居节点数组。
  44775. * @param {Object} graph - graph实例。
  44776. * @param {string} type - 元素类型,可选值为 'node'、'edge'
  44777. * @param {Function} fn - 查找的规则。
  44778. * @return {Object} 如果有符合规则的元素实例,则返回所有元素实例,否则返回 undefined。
  44779. */
  44780. findAll(type, fn, graph = this.graph) {
  44781. return graph.findAll(type, fn);
  44782. }
  44783. /**
  44784. * @function G6Render.prototype.getEdgesByNode
  44785. * @description 获取与当前节点有关联的所有边。
  44786. * @param {Object} node - node实例。
  44787. * @return {Array} edge实例数组。
  44788. */
  44789. getEdgesByNode(node) {
  44790. return node.getEdges();
  44791. }
  44792. /**
  44793. * @function G6Render.prototype.getEdgesByNode
  44794. * @description 获取与当前节点关联的所有入边。
  44795. * @param {Object} node - node实例。
  44796. * @return {Array} edge实例数组。
  44797. */
  44798. getInEdges(node) {
  44799. return node.getInEdges();
  44800. }
  44801. /**
  44802. * @function G6Render.prototype.getEdgesByNode
  44803. * @description 获取与当前节点关联的所有出边。
  44804. * @param {Object} node - node实例。
  44805. * @return {Array} edge实例数组。
  44806. */
  44807. getOutEdges(node) {
  44808. return node.getOutEdges();
  44809. }
  44810. /**
  44811. * @function G6Render.prototype.getSourceByEdge
  44812. * @description 获取当前边的起始节点
  44813. * @param {Object} edge - node实例。
  44814. * @return {Object} 返回值为起始节点的实例。
  44815. */
  44816. getSourceByEdge(edge) {
  44817. return edge.getSource();
  44818. }
  44819. /**
  44820. * @function G6Render.prototype.getTargetByEdge
  44821. * @description 获取当前边的终止节点。
  44822. * @param {Object} edge - node实例。
  44823. * @return {Object} 终止节点的实例。
  44824. */
  44825. getTargetByEdge(edge) {
  44826. return edge.getTarget();
  44827. }
  44828. /**
  44829. * @function G6Render.prototype.expandNode
  44830. * @description 展开当前节点。
  44831. * @param {Object} item - 元素 ID 或元素实例。
  44832. */
  44833. expandNode(item) {
  44834. const id = item.getModel().id;
  44835. this._expandCollapseNode(this.collpasedData[id], 'show');
  44836. delete this.collpasedData[id];
  44837. }
  44838. /**
  44839. * @function G6Render.prototype.collapseNode
  44840. * @description 收起当前节点。
  44841. * @param {Object} item - 元素 ID 或元素实例。
  44842. * @param {Object} graph - graph实例。
  44843. */
  44844. collapseNode(item) {
  44845. const id = item.getModel().id;
  44846. const result = [];
  44847. this._collapseFunc(item, result);
  44848. this.collpasedData[id] = result;
  44849. this._expandCollapseNode(result);
  44850. }
  44851. isCollpased(id) {
  44852. return !!this.collpasedData[id];
  44853. }
  44854. _collapseFunc(item, res = []) {
  44855. const sourceNodes = this.getNeighbors(item, 'target');
  44856. const targetNodes = this.getNeighbors(item, 'source');
  44857. // 指出节点, 如果没有其他链接,隐藏
  44858. for (let i = 0; i < sourceNodes.length; i++) {
  44859. const sourceNode = sourceNodes[i];
  44860. const model = sourceNode.getModel();
  44861. let nodes = this.getNeighbors(sourceNode);
  44862. // if (nodes && exceptNode) {
  44863. // nodes = nodes.filter((item) => item.id !== exceptNode);
  44864. // }
  44865. if (nodes.length === 1) {
  44866. res.push({ id: model.id });
  44867. }
  44868. }
  44869. // 指入节点, 如果没有其他链接或者没有指入节点隐藏,隐藏
  44870. for (let i = 0; i < targetNodes.length; i++) {
  44871. const targetNode = targetNodes[i];
  44872. const model = targetNode.getModel();
  44873. let nodes = this.getNeighbors(targetNode);
  44874. let targetNodeNodes = this.getNeighbors(targetNode, 'source');
  44875. // if (nodes && exceptNode) {
  44876. // nodes = nodes.filter((item) => item.id !== exceptNode);
  44877. // }
  44878. // if (targetNodeNodes && exceptNode) {
  44879. // targetNodeNodes = targetNodeNodes.filter((item) => item.id !== exceptNode);
  44880. // }
  44881. if (nodes.length === 1 || targetNodeNodes.length === 0) {
  44882. res.push({ id: model.id });
  44883. } else {
  44884. const result = [];
  44885. this._collapseFunc(targetNode, result);
  44886. res.push({ id: model.id, children: result });
  44887. }
  44888. }
  44889. return res;
  44890. }
  44891. _expandCollapseNode(data, type = 'hide') {
  44892. if (!data) {
  44893. return;
  44894. }
  44895. data.forEach((item) => {
  44896. if (type === 'hide') {
  44897. this.hideItem(item.id);
  44898. } else {
  44899. this.showItem(item.id);
  44900. // 如果是把之前的折叠也展开了, 就要把之前的折叠数据删除
  44901. if (this.isCollpased(item.id)) {
  44902. delete this.collpasedData[item.id];
  44903. }
  44904. }
  44905. if (item.children) {
  44906. this._expandCollapseNode(item.children, type);
  44907. }
  44908. });
  44909. }
  44910. /**
  44911. * @function G6Render.prototype.showItem
  44912. * @description 显示指定的元素。若 item 为节点,则相关边也会随之显示。而show() 则将只显示自身。
  44913. * @param {string|Object} item - 元素 ID 或元素实例。
  44914. * @param {boolean} [stack] - 操作是否入 undo & redo 栈,当实例化 Graph 时设置 enableStack 为 true 时,默认情况下会自动入栈,入栈以后,就支持 undo & redo 操作,如果不需要,则设置该参数为 false 即可。
  44915. * @param {Object} graph - graph实例。
  44916. */
  44917. showItem(item, stack, graph = this.graph) {
  44918. graph.showItem(item, stack);
  44919. }
  44920. /**
  44921. * @function G6Render.prototype.showItem
  44922. * @description 隐藏指定元素。若 item 为节点,则相关边也会随之隐藏。而 hide() 则将只隐藏自身。
  44923. * @param {string|Object} item - 元素 ID 或元素实例。
  44924. * @param {boolean} [stack] -操作是否入 undo & redo 栈,当实例化 Graph 时设置 enableStack 为 true 时,默认情况下会自动入栈,入栈以后,就支持 undo & redo 操作,如果不需要,则设置该参数为 false 即可。
  44925. * @param {Object} graph - graph实例。
  44926. */
  44927. hideItem(item, stack, graph = this.graph) {
  44928. graph.hideItem(item, stack);
  44929. }
  44930. /**
  44931. * @function G6Render.prototype.show
  44932. * @description 显示元素。只显示 item 自身,若需要在显示节点的同时显示相关边,应调用showItem(item)。
  44933. * @param {Object} item - 元素实例。
  44934. */
  44935. show(item) {
  44936. item.show();
  44937. }
  44938. /**
  44939. * @function G6Render.prototype.hide
  44940. * @description 隐藏元素。只隐藏 item 自身,若需要在隐藏节点的同时隐藏相关边,应调用 hideItem(item)。
  44941. * @param {Object} item - 元素实例。
  44942. */
  44943. hide(item) {
  44944. item.hide();
  44945. }
  44946. /**
  44947. * @function G6Render.prototype.changeVisibility
  44948. * @description 更改元素是否显示。
  44949. * @param {Object} item - 元素实例。
  44950. * @param {boolean} visible - 是否显示元素,true 为显示,false 为隐藏。
  44951. */
  44952. changeVisibility(item, visible) {
  44953. item.changeVisibility(visible);
  44954. }
  44955. /**
  44956. * @function G6Render.prototype.isVisible
  44957. * @description 查询元素显示状态。
  44958. * @param {Object} item - 元素实例。
  44959. * @return {boolean} - 返回值为 true,则表示当前元素处于显示状态,否则处于隐藏状态。
  44960. */
  44961. isVisible(item) {
  44962. return item.isVisible();
  44963. }
  44964. /**
  44965. * @function G6Render.prototype.getModel
  44966. * @description 获取元素的数据模型。
  44967. * @param {Object} item - 元素实例。
  44968. * @return {KnowledgeGraph.Data} - 返回值为节点的数据模型。
  44969. */
  44970. getModel(item) {
  44971. return item.getModel();
  44972. }
  44973. /**
  44974. * @function G6Render.prototype.addItem
  44975. * @description 新增元素(节点和边)。
  44976. * @param {Object} graph - graph实例。
  44977. * @param {string} type - 元素类型,可选值为 'node'、'edge'
  44978. * @param {Object} model - 元素的数据模型,具体内容参见元素配置项。
  44979. */
  44980. addItem(type, model, graph = this.graph) {
  44981. graph.addItem(type, model);
  44982. }
  44983. /**
  44984. * @function G6Render.prototype.addItem
  44985. * @description 删除元素。
  44986. * @param {string|Object} item - 元素 ID 或元素实例
  44987. * @param {Object} graph - graph实例。
  44988. */
  44989. removeItem(item, graph = this.graph) {
  44990. graph.removeItem(item);
  44991. }
  44992. /**
  44993. * @function G6Render.prototype.updateItem
  44994. * @description 更新元素,包括更新数据、样式等。
  44995. * @param {Object} graph - graph实例。
  44996. * @param {string|Object} item - 元素 ID 或元素实例。
  44997. * @param {Object} model - 元素的数据模型,具体内容参见元素配置项。
  44998. */
  44999. updateItem(item, model, graph = this.graph) {
  45000. graph.updateItem(item, model);
  45001. }
  45002. /**
  45003. * @function G6Render.prototype.refreshItem
  45004. * @description 刷新指定元素。
  45005. * @param {Object} graph - graph实例。
  45006. * @param {string|Object} item - 元素 ID 或元素实例。
  45007. */
  45008. refreshItem(item, graph = this.graph) {
  45009. graph.refreshItem(item);
  45010. }
  45011. /**
  45012. * @function G6Render.prototype.refreshPositions
  45013. * @description 当节点位置发生变化时,刷新所有节点位置,并重计算边的位置。
  45014. * @param {Object} graph - graph实例。
  45015. */
  45016. refreshPositions(graph = this.graph) {
  45017. graph.refreshPositions();
  45018. }
  45019. /**
  45020. * @function G6Render.prototype.on
  45021. * @description graph监听事件
  45022. * @param {Object} graph - graph实例。
  45023. * @param {string} eventName - 事件名,可选事件名参见 Event。
  45024. * @param {Function} handler - 监听函数。
  45025. */
  45026. on(eventName, handler, graph = this.graph) {
  45027. graph.on(eventName, handler);
  45028. }
  45029. /**
  45030. * @function G6Render.prototype.off
  45031. * @description graph关闭事件
  45032. * @param {Object} graph - graph实例。
  45033. * @param {string} eventName - 事件名,可选事件名参见 Event。
  45034. * @param {Function} handler - 监听函数。
  45035. */
  45036. off(eventName, handler, graph = this.graph) {
  45037. graph.off(eventName, handler);
  45038. }
  45039. /**
  45040. * @function G6Render.prototype.toDataURL
  45041. * @description 转换成图片
  45042. * @param {Object} graph - graph实例。
  45043. * @param {string} type - 图片类型 'image/png' / 'image/jpeg' / 'image/webp' / 'image/bmp'。
  45044. * @param {string} [backgroundColor] - 图片的背景色,可选,不传值时将导出透明背景的图片。
  45045. * @return {string} 返回值表示生成的图片的 URL。
  45046. */
  45047. toDataURL(type, backgroundColor, graph = this.graph) {
  45048. graph.toDataURL(type, backgroundColor);
  45049. }
  45050. /**
  45051. * @function G6Render.prototype.bindNodeDefaultDragEvent
  45052. * @description 给graph的节点绑定默认的拖拽事件
  45053. *
  45054. * @param {Object} graph - graph实例。
  45055. */
  45056. bindNodeDefaultDragEvent(graph = this.graph) {
  45057. graph.on('node:dragstart', function (e) {
  45058. refreshDragedNodePosition(e);
  45059. });
  45060. graph.on('node:drag', function (e) {
  45061. refreshDragedNodePosition(e);
  45062. });
  45063. graph.on('node:dragend', function (e) {
  45064. e.item.get('model').fx = null;
  45065. e.item.get('model').fy = null;
  45066. });
  45067. }
  45068. /**
  45069. * @function G6Render.prototype.stopDefaultEventPropagation
  45070. * @description 阻止点击事件冒泡
  45071. * @param {Object} graph - graph实例。
  45072. */
  45073. stopDefaultEventPropagation(graph = this.graph) {
  45074. graph.on('click', function (e) {
  45075. e.stopPropagation();
  45076. });
  45077. graph.on('mousedown', function (e) {
  45078. e.stopPropagation();
  45079. });
  45080. graph.on('mouseover', function (e) {
  45081. e.stopPropagation();
  45082. });
  45083. graph.on('mouseout', function (e) {
  45084. e.stopPropagation();
  45085. });
  45086. }
  45087. /**
  45088. * @function G6Render.prototype.clear
  45089. * @description 清除画布元素
  45090. * @param {Object} graph - graph实例。
  45091. */
  45092. clear(graph = this.graph) {
  45093. graph.clear();
  45094. }
  45095. /**
  45096. * @function G6Render.prototype.destroy
  45097. * @description 销毁画布
  45098. * @param {Object} graph - graph实例。
  45099. */
  45100. destroy(graph = this.graph) {
  45101. graph.destroy();
  45102. }
  45103. }
  45104. /**
  45105. * @description 更新拖拽后节点的x ,y
  45106. */
  45107. function refreshDragedNodePosition(e) {
  45108. const model = e.item.get('model');
  45109. model.fx = e.x;
  45110. model.fy = e.y;
  45111. model.x = e.x;
  45112. model.y = e.y;
  45113. return model;
  45114. }
  45115. // EXTERNAL MODULE: ./node_modules/lodash.clonedeep/index.js
  45116. var lodash_clonedeep = __webpack_require__(465);
  45117. var lodash_clonedeep_default = /*#__PURE__*/__webpack_require__.n(lodash_clonedeep);
  45118. ;// CONCATENATED MODULE: ./src/common/overlay/KnowledgeGraph.js
  45119. /**
  45120. * @class KnowledgeGraph
  45121. * @category iServer KnowledgeGraph
  45122. * @classdesc KnowledgeGraph知识图谱
  45123. * @version 11.1.0
  45124. * @param { KnowledgeGraph.Config } config - 创建graph实例的配置项。
  45125. * @usage
  45126. */
  45127. /**
  45128. * @typedef {Object} KnowledgeGraph.Data - 创建graph实例的数据项。
  45129. * @property {Array.<KnowledgeGraph.Node>} data.nodes - 创建graph节点。
  45130. * @property {Array.<KnowledgeGraph.Edge>} data.edges - 创建graph边。
  45131. */
  45132. /**
  45133. * @typedef {Object} KnowledgeGraph.Config - 创建graph实例的配置项。
  45134. * @property {string | HTMLElement} container - 创建的容器 id 或容器本身, 默认是'knowledgeGraph'。
  45135. * @property {number} width - 图的宽度, 默认是container的width。
  45136. * @property {number} height - 图的高度,默认是container的height。
  45137. * @property {Array.<number>} [center] - 中心点的渲染坐标。可以通过KnowledgeGraph.prototype.getViewPortCenterPoint获取。
  45138. * @property {number} [zoom] - 缩放比例。
  45139. * @property {number} [minZoom] - 最小缩放比例。若 fitView、zoom、zoomTo 等操作导致图的缩放比例小于该值,则将使用该值进行缩放,并返回 false。
  45140. * @property {number} [maxZoom] - 最大缩放比例。若 fitView、zoom、zoomTo 等操作导致图的缩放比例大于该值,则将使用该值进行缩放,并返回 false。
  45141. * @property {KnowledgeGraph.Layout} [layout] - 布局。
  45142. * @property {boolean} [animate=true] - 是否开启动画。
  45143. * @property {boolean} [autoResize=true] - 当视口变换时,是否自动重绘。
  45144. * @property {KnowledgeGraph.NodeStyle} [defaultNode] - 默认状态下节点的配置,比如 type, size, color。会被写入的 data 覆盖。
  45145. * @property {KnowledgeGraph.EdgeStyle} [defaultEdge] - 默认状态下边的配置,比如 type, size, color。会被写入的 data 覆盖。
  45146. * @property {KnowledgeGraph.NodeStyle} [nodeHighlightStyle] - 鼠标移入节点高亮样式。默认样式:{strokeColor: 'blue',stroke: 10, opacity: 0.8}。
  45147. * @property {KnowledgeGraph.EdgeStyle} [edgeHighlightStyle] - 鼠标移入边高亮样式。默认样式:{strokeColor: 'blue',stroke: 10, opacity: 0.8}。
  45148. * @property {boolean} [highlightNode = true] - 鼠标移入是否高亮节点。
  45149. * @property {boolean} [highlightEdge = true] - 鼠标移入是否高亮边。
  45150. * @property {boolean} [showToolBar = true] - 是否打开工具条, 包含放大,缩小,切换到实际大小功能。
  45151. * @property {boolean} [showContextMenu = true] - 是否打开节点的右键菜单, 包含展开\折叠、隐藏功能。
  45152. * @property {boolean} [dragCanvas = true] - 是否可以拖拽canvas。
  45153. * @property {boolean} [zoomCanvas = true] - 是否可以缩放canvas。
  45154. * @property {boolean} [dragNode = true] - 是否可以拖拽node节点。
  45155. * @property {number} [nodeLabelMaxWidth] - node节点的标签开启省略号配置项,大于该宽度使用省略号。
  45156. */
  45157. /**
  45158. * @typedef {Object} KnowledgeGraph.Layout - 布局。
  45159. * @property {string} [type='fruchterman'] - 布局类型, 可选值:['fruchterman']。 默认'fruchterman'。
  45160. */
  45161. /**
  45162. * @typedef {Object} KnowledgeGraph.Node - node节点配置项。
  45163. * @property {string} id - 元素的标识 ID,必须是唯一的 string
  45164. * @property {string} [category] - 分类。
  45165. * @property {number} [x] - x坐标。
  45166. * @property {number} [y] - y坐标。
  45167. * @property {number} [size=20] - 节点的大小。
  45168. * @property {Array.<number>|number} [anchorPoints=20] - 指定边连入节点的连接点的位置(相对于该节点而言),可以为空。例如: [0, 0],代表节点左上角的锚点,[1, 1],代表节点右下角的锚点。
  45169. * @property {string} [type] - 元素的类型,不传则使用默认值,节点默认类型为 'circle'。可选值['circle','rect','ellipse','diamond', 'image']
  45170. * @property {string} [label] - 元素的文本标签,有该字段时默认会渲染 label 。
  45171. * @property {KnowledgeGraph.NodeLabelCfg} [labelCfg] - 元素文本标签的配置项,详见各子模块内容。
  45172. * @property {KnowledgeGraph.NodeStyle} [style] - 样式属性。
  45173. */
  45174. /**
  45175. * @typedef {Object} KnowledgeGraph.Edge - edge边配置项。
  45176. * @property {string} [source] -起始点 id 。
  45177. * @property {string} [target] - 结束点 id 。
  45178. * @property {number} [sourceAnchor] - 边的起始节点上的锚点的索引值。
  45179. * @property {number} [targetAnchor] - 边的终止节点上的锚点的索引值。
  45180. * @property {string} [type='line'] - 指定边的类型,可以是内置边的类型名称,也可以是自定义边的名称。默认为 'line'。可选值['line','arc','polyline','quadratic']。
  45181. * @property {string} [label] - 文本文字,如果没有则不会显示。
  45182. * @property {KnowledgeGraph.EdgeLabelCfg} [labelCfg] - 配置标签文本。
  45183. * @property {KnowledgeGraph.EdgeStyle} [style] - 通过 style 配置来修改边的填充色、边框颜色、阴影等属性,具体配置属性见:图形样式属性。
  45184. */
  45185. /**
  45186. * @typedef {Object} KnowledgeGraph.NodeLabelCfg - node节点配置项。
  45187. * @property {string} [position] - 文本相对于节点的位置,目前支持的位置有:'center','top','left','right','bottom'。默认为 'center'。modelRect 节点不支持该属性。
  45188. * @property {KnowledgeGraph.TextStyle} [style] - 标签的样式属性。
  45189. * @property {number} [offset] - 文本的偏移,position 为 'bottom' 时,文本的上方偏移量;position 为 'left' 时,文本的右方偏移量;以此类推在其他 position 时的情况。modelRect 节点的 offset 为左边距。
  45190. */
  45191. /**
  45192. * @typedef {Object} KnowledgeGraph.NodeStyle - 节点样式通用配置项。
  45193. * @property {string} [fill] - 节点填充色。
  45194. * @property {string} [stroke] - 节点的描边颜色。
  45195. * @property {number} [lineWidth] - 描边宽度。
  45196. * @property {Array.<number>} [lineDash] -描边虚线,数组代表实、虚长度。
  45197. * @property {number} [fillOpacity] - 设置填充的 alpha 或透明值。
  45198. * @property {string} [shadowColor] - 阴影颜色。
  45199. * @property {number} [shadowBlur] - 阴影范围。
  45200. * @property {number} [shadowOffsetX] - 阴影 x 方向偏移量。
  45201. * @property {number} [shadowOffsetY] - 阴影 y 方向偏移量。
  45202. * @property {number} [opacity] - 设置绘图的当前 alpha 或透明值。
  45203. * @property {string} [cursor] - 鼠标在该边上时的鼠标样式,CSS 的 cursor 选项都支持。
  45204. */
  45205. /**
  45206. * @typedef {Object} KnowledgeGraph.TextStyle - 文本样式。
  45207. * @property {string} [textAlign] - 设置文本内容的当前对齐方式。支持的属性:center / end / left / right / start,默认值为 start。
  45208. * @property {string} [textBaseline] - 设置在绘制文本时使用的当前文本基线。支持的属性:top / middle / bottom / alphabetic / hanging。默认值为 bottom。
  45209. * @property {string} [fontStyle] - 字体样式。对应 font-style。
  45210. * @property {string} [fontVariant] - 设置为小型大写字母字体。对应 font-variant。
  45211. * @property {number} [fontWeight] - 字体粗细。对应 font-weight。
  45212. * @property {number} [fontSize] - 字体大小。对应 font-size, 边标签文本默认大小是7。
  45213. * @property {string} [fontFamily] - 字体系列。对应 font-family。
  45214. * @property {number} [lineHeight] - 行高。对应 line-height。
  45215. */
  45216. /**
  45217. * @typedef {Object} KnowledgeGraph.EdgeLabelCfg - node节点配置项。
  45218. * @property {string} [position] - 文本相对于边的位置,目前支持的位置有:'start','middle','end'。默认为'middle'。
  45219. * @property {number} [refX] - 标签在 x 方向的偏移量。
  45220. * @property {number} [refY] -标签在 y 方向的偏移量。
  45221. * @property {boolean} [autoRotate=true] - 标签文字是否跟随边旋转,默认: true。
  45222. * @property { KnowledgeGraph.TextStyle} [style] - 标签的样式属性,默认: {fontSize: 3,fill: '#333'}。
  45223. */
  45224. /**
  45225. * @typedef {Object} KnowledgeGraph.EdgeStyle - 边样式通用配置项。
  45226. * @property {string} [stroke] - 边的颜色。
  45227. * @property {number} [lineWidth] - 边宽度。
  45228. * @property {number} [lineAppendWidth] -边响应鼠标事件时的检测宽度,当 lineWidth 太小而不易选中时,可以通过该参数提升击中范围。
  45229. * @property {boolean|Object} [endArrow=true] - 为 true 时在边的结束端绘制默认箭头,为 false 时不绘制结束端箭头, 默认值{path: 'M 0,0 L 2,1 L 2,-1 Z'}
  45230. * @property {boolean|Object} [startArrow] - 为 true 时在边的开始端绘制默认箭头,为 false 时不绘制结束端箭头。
  45231. * @property {number} [strokeOpacity] - 边透明度。
  45232. * @property {string} [shadowColor] - 阴影颜色。
  45233. * @property {number} [shadowBlur] - 阴影模糊程度。
  45234. * @property {number} [shadowOffsetX] - 阴影 x 方向偏移量。
  45235. * @property {number} [shadowOffsetY] - 阴影 y 方向偏移量。
  45236. * @property {Array.<number>} [lineDash] - 设置线的虚线样式,可以指定一个数组。一组描述交替绘制线段和间距(坐标空间单位)长度的数字。 如果数组元素的数量是奇数, 数组的元素会被复制并重复。例如, [5, 15, 25] 会变成 [5, 15, 25, 5, 15, 25]。
  45237. * @property {string} [cursor] - 鼠标在该边上时的鼠标样式,CSS 的 cursor 选项都支持。
  45238. */
  45239. /**
  45240. * @typedef {Object} KnowledgeGraph.AnimateConfig - 动画配置项。
  45241. * @property {number} [duration= 500] - 一次动画的时长。
  45242. * @property {string} [easing='linearEasing'] - 动画函数。
  45243. * @property {number} [delay=0] - 是否重复执行动画。
  45244. * @property {boolean} [repeat=false] - 边透明度。
  45245. * @property {string} [shadowColor] - 阴影颜色。
  45246. */
  45247. class KnowledgeGraph {
  45248. constructor(config, type = 'G6') {
  45249. /**
  45250. * @member {string} KnowledgeGraph.prototype.graph
  45251. * @description graph实例。
  45252. */
  45253. this.graph = null;
  45254. this.config = lodash_clonedeep_default()(config);
  45255. this.graphRender = null;
  45256. this.type = type;
  45257. this.createGraphRender(this.type);
  45258. this.config = this.graphRender._getGraphConfig(this.config);
  45259. this.createGraph(this.config);
  45260. this.CLASS_NAME = 'SuperMap.KnowledgeGraph';
  45261. }
  45262. /**
  45263. * @function KnowledgeGraph.dataFromGraphMap
  45264. * @description 将iServer GraphMap数据转换成KnowledgeGraph数据。
  45265. * @param {Object} queryResult - iServer知识图谱服务query数据。
  45266. * @param {Object} graphMap - iServer知识图谱服务GraphMap数据(data.graphMap)。
  45267. * @return {KnowledgeGraph.Data} 返回数据。
  45268. */
  45269. static dataFromGraphMap(queryResult, graphMap) {
  45270. return transformGraphMap(queryResult, graphMap);
  45271. }
  45272. /**
  45273. * @function KnowledgeGraph.dataFromKnowledgeGraphQuery
  45274. * @description 将iServer KnowledgeGraphService query数据转换成KnowledgeGraph数据。
  45275. * @param {Object} queryResult - iServer知识图谱服务query数据。
  45276. * @return {KnowledgeGraph.Data} 返回数据。
  45277. */
  45278. static dataFromKnowledgeGraphQuery(queryResult) {
  45279. return transformGraphMap(queryResult);
  45280. }
  45281. /**
  45282. * @function KnowledgeGraph.prototype.handleNodeStatus
  45283. * @description 展开、折叠、隐藏节点
  45284. * @param {Object} data - 展开 折叠 隐藏的对象, eg: {expand:['id1'], collapse:['id2'], hidden:['id3']}
  45285. */
  45286. handleNodeStatus(data) {
  45287. const { expand, collapse, hidden } = data;
  45288. // 解析expand参数,里面的节点再执行一次查询显示出来
  45289. this.expandNodes(expand);
  45290. // 解析collapse参数,折叠这个里面的节点
  45291. this.collapseNodes(collapse);
  45292. // 解析hidden,隐藏这个里面额的节点
  45293. this.hideNodes(hidden);
  45294. }
  45295. /**
  45296. * @function KnowledgeGraph.prototype.expandNodes
  45297. * @description 展开节点。
  45298. * @param {Array.<string>} expandData - 元素 ID 数组。
  45299. */
  45300. expandNodes(expandData) {
  45301. if (!expandData) {
  45302. return;
  45303. }
  45304. expandData.forEach((item) => {
  45305. this.expandNode(item + '');
  45306. });
  45307. }
  45308. /**
  45309. * @function KnowledgeGraph.prototype.collapseNodes
  45310. * @description 折叠节点。
  45311. * @param {Array.<string>} collapseData - 元素 ID 数组。
  45312. */
  45313. collapseNodes(collapseData) {
  45314. if (!collapseData) {
  45315. return;
  45316. }
  45317. collapseData.forEach((item) => {
  45318. this.collapseNode(item + '');
  45319. });
  45320. }
  45321. /**
  45322. * @function KnowledgeGraph.prototype.hideNodes
  45323. * @description 隐藏节点。
  45324. * @param {Array.<string>} hiddenData - 元素 ID 数组。
  45325. */
  45326. hideNodes(hiddenData) {
  45327. if (!hiddenData) {
  45328. return;
  45329. }
  45330. hiddenData.forEach((item) => {
  45331. this.hideItem(item + '');
  45332. });
  45333. }
  45334. /**
  45335. * @function KnowledgeGraph.prototype.createGraphRender
  45336. * @description 创建KnowledgeGraphRender
  45337. * @param {string} type -类型, 默认是G6。
  45338. * @private
  45339. */
  45340. createGraphRender(type) {
  45341. if (type === 'G6') {
  45342. this.graphRender = new G6Render();
  45343. }
  45344. }
  45345. /**
  45346. * @function KnowledgeGraph.prototype.createGraph
  45347. * @description 创建KnowledgeGraph的guaph实例。
  45348. * @param {Object} config - graph配置项。
  45349. * @returns {Object} graph实例。
  45350. */
  45351. createGraph(config) {
  45352. const graph = this.initGraph(config);
  45353. this.graph = graph;
  45354. this.autoResize();
  45355. return graph;
  45356. }
  45357. /**
  45358. * @function KnowledgeGraph.prototype.getGraph
  45359. * @description 获取KnowledgeGraph的guaph实例。
  45360. * @returns {Object} graph实例。
  45361. */
  45362. getGraph() {
  45363. return this.graph;
  45364. }
  45365. /**
  45366. * @function KnowledgeGraph.prototype.autoResize
  45367. * @description 浏览器窗口大小发生改变时,重新设置canvas画布的大小,重新渲染。
  45368. */
  45369. autoResize() {
  45370. if (this.config && this.config.autoResize !== false) {
  45371. this.graphRender.autoResize();
  45372. }
  45373. }
  45374. /**
  45375. * @function KnowledgeGraph.prototype.zoom
  45376. * @description 改变视口的缩放比例,在当前画布比例下缩放,是相对比例。
  45377. * @param {number} ratio 缩放比例。
  45378. * @param {Object} [center] 以 center 的 x、y 坐标为中心缩放,如果省略了 center 参数,则以元素当前位置为中心缩放。
  45379. * @param {boolean} [animate] 是否开启动画。
  45380. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  45381. */
  45382. zoom(ratio, center, animate, animateCfg) {
  45383. this.graphRender.zoom(ratio, center, animate, animateCfg);
  45384. }
  45385. /**
  45386. * @function KnowledgeGraph.prototype.zoomTo
  45387. * @description 改变视口的缩放比例,在当前画布比例下缩放,是相对比例。
  45388. * @param {number} ratio 缩放比例。
  45389. * @param {Object} [center] 以 center 的 x、y 坐标为中心缩放,如果省略了 center 参数,则以元素当前位置为中心缩放。
  45390. * @param {boolean} [animate] 是否开启动画。
  45391. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  45392. */
  45393. zoomTo(ratio, center, animate, animateCfg) {
  45394. this.graphRender.zoomTo(ratio, center, animate, animateCfg);
  45395. }
  45396. /**
  45397. * @function KnowledgeGraph.prototype.fitView
  45398. * @description 让画布内容适应视口。
  45399. * @param {Array.<number>|number} [padding] [top, right, bottom, left] 四个方向上的间距值。
  45400. * @param {Object} [rules] fitView 的规则,参数如下:{ onlyOutOfViewPort?: boolean; direction?: 'x' / 'y' / 'both'; ratioRule?: 'max' / 'min}。
  45401. * @param {boolean} [animate] 是否开启动画。
  45402. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  45403. */
  45404. fitView(padding, rules, animate, animateCfg) {
  45405. this.graphRender.fitView(padding, rules, animate, animateCfg);
  45406. }
  45407. /**
  45408. * @function KnowledgeGraph.prototype.fitCenter
  45409. * @description 平移图到中心将对齐到画布中心,但不缩放。优先级低于 fitView。
  45410. * @param {boolean} [animate] 是否开启动画。
  45411. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画,参见基础动画教程。若未配置,则跟随 graph 的 animateCfg 参数。
  45412. */
  45413. fitCenter(animate, animateCfg) {
  45414. this.graphRender.fitCenter(animate, animateCfg);
  45415. }
  45416. /**
  45417. * @function KnowledgeGraph.prototype.getGraphCenterPoint
  45418. * @description 获取图内容的中心绘制坐标。
  45419. * @return {Object} 包含的属性:x 和 y 属性,分别表示渲染坐标下的 x、y 值。
  45420. */
  45421. getGraphCenterPoint() {
  45422. return this.graphRender.getGraphCenterPoint();
  45423. }
  45424. /**
  45425. * @function KnowledgeGraph.prototype.getViewPortCenterPoint
  45426. * @description 获取窗口的中心绘制坐标。
  45427. * @return {Object} 包含的属性:x 和 y 属性,分别表示渲染坐标下的 x、y 值。
  45428. */
  45429. getViewPortCenterPoint() {
  45430. return this.graphRender.getViewPortCenterPoint();
  45431. }
  45432. /**
  45433. * @function KnowledgeGraph.prototype.getZoom
  45434. * @description 获取当前视口的缩放比例。
  45435. * @return {number} 返回值表示当前视口的缩放比例, 默认值为 1。
  45436. */
  45437. getZoom() {
  45438. return this.graphRender.getZoom();
  45439. }
  45440. /**
  45441. * @function KnowledgeGraph.prototype.getMinZoom
  45442. * @description 获取 graph 当前允许的最小缩放比例。
  45443. * @return {number} 返回值表示当前视口的最小缩放比例。
  45444. */
  45445. getMinZoom() {
  45446. return this.graphRender.getMinZoom();
  45447. }
  45448. /**
  45449. * @function KnowledgeGraph.prototype.setMinZoom
  45450. * @description 设置 graph 当前允许的最小缩放比例。
  45451. * @param {number} ratio 缩放比例。
  45452. */
  45453. setMinZoom(ratio) {
  45454. this.graphRender.setMinZoom(ratio);
  45455. }
  45456. /**
  45457. * @function KnowledgeGraph.prototype.getMaxZoom
  45458. * @description 获取 graph 当前允许的最大缩放比例。
  45459. * @return {number} 返回值表示当前视口的最大缩放比例。
  45460. */
  45461. getMaxZoom() {
  45462. return this.graphRender.getMaxZoom();
  45463. }
  45464. /**
  45465. * @function KnowledgeGraph.prototype.setMaxZoom
  45466. * @description 设置 graph 当前允许的最大缩放比例。
  45467. * @param {number} ratio 缩放比例。
  45468. */
  45469. setMaxZoom(ratio) {
  45470. this.graphRender.setMaxZoom(ratio);
  45471. }
  45472. /**
  45473. * @function KnowledgeGraph.prototype.getWidth
  45474. * @description获取 graph 当前的宽度。
  45475. * @return {number} graph 当前的宽度。
  45476. */
  45477. getWidth() {
  45478. return this.graphRender.getWidth();
  45479. }
  45480. /**
  45481. * @function KnowledgeGraph.prototype.getHeight
  45482. * @description 获取 graph 当前的高度。
  45483. * @return {number} graph 当前的高度。
  45484. */
  45485. getHeight() {
  45486. return this.graphRender.getHeight();
  45487. }
  45488. /**
  45489. * @function KnowledgeGraph.prototype.initGraph
  45490. * @description 创建KnowledgeGraph实例
  45491. * @param {Object} config - graph配置项。
  45492. * @returns {Object} graph实例。
  45493. */
  45494. initGraph(config) {
  45495. const graph = this.graphRender.initGraph(config);
  45496. this.graph = graph;
  45497. const cb = () => {
  45498. if (this.config.zoom !== undefined) {
  45499. this.zoom(this.config.zoom);
  45500. }
  45501. if (this.config.center !== undefined) {
  45502. this.graphRender.setCenter({ x: this.config.center[0], y: this.config.center[1] });
  45503. }
  45504. };
  45505. this.graph.on('beforelayout', cb);
  45506. return graph;
  45507. }
  45508. /**
  45509. * @function KnowledgeGraph.prototype.setData
  45510. * @description 设置默认数据
  45511. * @param {KnowledgeGraph.Data} data - graph数据。
  45512. * @param {Object} [graph = this.graph] - graph实例。
  45513. */
  45514. setData(data, graph = this.graph) {
  45515. data = data || { nodes: [], edges: [] };
  45516. if (this.config && this.config.nodeLabelMaxWidth) {
  45517. data.nodes = this.nodeLabelOpenEllipsis(this.config.nodeLabelMaxWidth, data.nodes);
  45518. }
  45519. this.graphRender.setData(data, graph);
  45520. this.render(graph); // 渲染图
  45521. this.data = data;
  45522. }
  45523. /**
  45524. * @function KnowledgeGraph.prototype.render
  45525. * @description 根据提供的数据渲染视图。
  45526. * @param {Object} [graph = this.graph] - graph实例。
  45527. */
  45528. render(graph = this.graph) {
  45529. graph && this.graphRender.render(graph);
  45530. }
  45531. /**
  45532. * @function KnowledgeGraph.prototype.updateGraph
  45533. * @description 更新数据
  45534. * @param {KnowledgeGraph.Data} data - graph数据。
  45535. * @param {Object} [graph = this.graph] - graph实例。
  45536. */
  45537. updateGraph(data, graph = this.graph) {
  45538. graph && this.graphRender.updateGraph(data, graph);
  45539. }
  45540. /**
  45541. * @function KnowledgeGraph.prototype.refresh
  45542. * @description 改变画布大小。
  45543. */
  45544. refresh() {
  45545. return this.graphRender.refresh();
  45546. }
  45547. /**
  45548. * @function KnowledgeGraph.prototype.changeSize
  45549. * @description 改变画布大小。
  45550. * @param {number} width - 宽度。
  45551. * @param {number} height - 高度。
  45552. */
  45553. changeSize(width, height) {
  45554. return this.graphRender.changeSize(width, height);
  45555. }
  45556. /**
  45557. * @function KnowledgeGraph.prototype.resize
  45558. * @description 改变画布大小后,重新渲染。
  45559. * @param {number} width - 宽度。
  45560. * @param {number} height - 高度。
  45561. */
  45562. resize(width, height) {
  45563. this.graphRender.changeSize(width, height);
  45564. this.graphRender.refresh();
  45565. }
  45566. /**
  45567. * @function KnowledgeGraph.prototype.getContainer
  45568. * @description 获取 Graph 的 DOM 容器。
  45569. * @return {HTMLElement} DOM 容器。
  45570. */
  45571. getContainer() {
  45572. return this.graphRender.getContainer();
  45573. }
  45574. /**
  45575. * @function KnowledgeGraph.prototype.getCanvas
  45576. * @description 获取canvas。
  45577. * @return {HTMLElement} canvas。
  45578. */
  45579. getCanvas() {
  45580. return this.graphRender.getCanvas();
  45581. }
  45582. /**
  45583. * @function KnowledgeGraph.prototype.getNodes
  45584. * @description 获取图中所有节点的实例。
  45585. * @return {Array} 返回值表示图中所有节点的实例。
  45586. */
  45587. getNodes() {
  45588. return this.graphRender.getNodes();
  45589. }
  45590. /**
  45591. * @function KnowledgeGraph.prototype.getEdges
  45592. * @description 获取图中所有节点的实例。这里返回的是边的实例,而不是边的数据项。
  45593. * @return {Array} 返回值表示图中所有边的实例。
  45594. */
  45595. getEdges() {
  45596. return this.graphRender.getEdges();
  45597. }
  45598. /**
  45599. * @function KnowledgeGraph.prototype.getNeighbors
  45600. * @description 获取邻居节点数组。
  45601. * @param {string | INode} node - 节点 ID 或节点实例。
  45602. * @param {string | undefined} type - ['source'| 'target' | undefined] 邻居类型, 'source' 只获取当前节点的源节点,'target' 只获取当前节点指向的目标节点, 若不指定则返回所有类型的邻居。
  45603. * @return {Array} 返回值符合要求的节点数组。
  45604. */
  45605. getNeighbors(node, type) {
  45606. return this.graphRender.getNeighbors(node, type);
  45607. }
  45608. /**
  45609. * @function KnowledgeGraph.prototype.findById
  45610. * @description 根据 ID,查询对应的元素实例。
  45611. * @param {string} id - 元素 ID。
  45612. * @return {Object} 如果有符合规则的元素实例,则返回第一个匹配的元素实例,否则返回 undefined 。
  45613. */
  45614. findById(id) {
  45615. return this.graphRender.findById(id);
  45616. }
  45617. /**
  45618. * @function KnowledgeGraph.prototype.find
  45619. * @description 获取邻居节点数组。
  45620. * @param {string} type - 元素类型,可选值为 'node'、'edge'
  45621. * @param {Function} fn - 查找的规则。
  45622. * @return {Object} 如果有符合规则的元素实例,则返回第一个匹配的元素实例,否则返回 undefined 。
  45623. */
  45624. find(type, fn) {
  45625. return this.graphRender.find(type, fn);
  45626. }
  45627. /**
  45628. * @function KnowledgeGraph.prototype.findAll
  45629. * @description 获取邻居节点数组。
  45630. * @param {string} type - 元素类型,可选值为 'node'、'edge'。
  45631. * @param {Function} fn - 查找的规则。
  45632. * @return {Object} 如果有符合规则的元素实例,则返回所有元素实例,否则返回 undefined。
  45633. */
  45634. findAll(type, fn) {
  45635. return this.graphRender.findAll(type, fn);
  45636. }
  45637. /**
  45638. * @function KnowledgeGraph.prototype.getEdgesByNode
  45639. * @description 获取与当前节点有关联的所有边。
  45640. * @param {Object} node - node实例。
  45641. * @return {Array} edge实例数组。
  45642. */
  45643. getEdgesByNode(node) {
  45644. return this.graphRender.getEdgesByNode(node);
  45645. }
  45646. /**
  45647. * @function KnowledgeGraph.prototype.getInEdges
  45648. * @description 获取与当前节点关联的所有入边。
  45649. * @param {Object} node - node实例。
  45650. * @return {Array} edge实例数组。
  45651. */
  45652. getInEdges(node) {
  45653. return this.graphRender.getInEdges(node);
  45654. }
  45655. /**
  45656. * @function KnowledgeGraph.prototype.getOutEdges
  45657. * @description 获取与当前节点关联的所有出边。
  45658. * @param {Object} node - node实例。
  45659. * @return {Array} edge实例数组。
  45660. */
  45661. getOutEdges(node) {
  45662. return this.graphRender.getOutEdges(node);
  45663. }
  45664. /**
  45665. * @function KnowledgeGraph.prototype.getSourceByEdge
  45666. * @description 获取当前边的起始节点
  45667. * @param {Object} edge - node实例。
  45668. * @return {Object} 返回值为起始节点的实例。
  45669. */
  45670. getSourceByEdge(edge) {
  45671. return this.graphRender.getSourceByEdge(edge);
  45672. }
  45673. /**
  45674. * @function KnowledgeGraph.prototype.getTargetByEdge
  45675. * @description 获取当前边的终止节点。
  45676. * @param {Object} edge - node实例。
  45677. * @return {Object} 终止节点的实例。
  45678. */
  45679. getTargetByEdge(edge) {
  45680. return this.graphRender.getTargetByEdge(edge);
  45681. }
  45682. /**
  45683. * @function KnowledgeGraph.prototype.expandNode
  45684. * @description 展开当前节点。
  45685. * @param {string} id - 元素 ID。
  45686. */
  45687. expandNode(id) {
  45688. const item = this.findById(id);
  45689. item && this.graphRender.expandNode(item);
  45690. }
  45691. /**
  45692. * @function KnowledgeGraph.prototype.collapseNode
  45693. * @description 收起当前节点。
  45694. * @param {string} id - 元素 ID。
  45695. */
  45696. collapseNode(id) {
  45697. const item = this.findById(id);
  45698. item && this.graphRender.collapseNode(item);
  45699. }
  45700. /**
  45701. * @function KnowledgeGraph.prototype.showItem
  45702. * @description 显示指定的元素。若 item 为节点,则相关边也会随之显示。而show() 则将只显示自身。
  45703. * @param {string|Object} item - 元素 ID 或元素实例。
  45704. * @param {boolean} [stack] - 操作是否入 undo & redo 栈,当实例化 Graph 时设置 enableStack 为 true 时,默认情况下会自动入栈,入栈以后,就支持 undo & redo 操作,如果不需要,则设置该参数为 false 即可。
  45705. */
  45706. showItem(item, stack) {
  45707. this.graphRender.showItem(item, stack);
  45708. }
  45709. /**
  45710. * @function KnowledgeGraph.prototype.showItem
  45711. * @description 隐藏指定元素。若 item 为节点,则相关边也会随之隐藏。而 hide() 则将只隐藏自身。
  45712. * @param {string|Object} item - 元素 ID 或元素实例。
  45713. * @param {boolean} [stack] -操作是否入 undo & redo 栈,当实例化 Graph 时设置 enableStack 为 true 时,默认情况下会自动入栈,入栈以后,就支持 undo & redo 操作,如果不需要,则设置该参数为 false 即可。
  45714. */
  45715. hideItem(item, stack) {
  45716. this.graphRender.hideItem(item, stack);
  45717. }
  45718. /**
  45719. * @function KnowledgeGraph.prototype.show
  45720. * @description 显示元素。只显示 item 自身,若需要在显示节点的同时显示相关边,应调用showItem(item)。
  45721. * @param {Object} item - 元素实例。
  45722. */
  45723. show(item) {
  45724. this.graphRender.show(item);
  45725. }
  45726. /**
  45727. * @function KnowledgeGraph.prototype.hide
  45728. * @description 隐藏元素。只隐藏 item 自身,若需要在隐藏节点的同时隐藏相关边,应调用 hideItem(item)。
  45729. * @param {Object} item - 元素实例。
  45730. */
  45731. hide(item) {
  45732. this.graphRender.hide(item);
  45733. }
  45734. /**
  45735. * @function KnowledgeGraph.prototype.changeVisibility
  45736. * @description 更改元素是否显示。
  45737. * @param {Object} item - 元素实例。
  45738. * @param {boolean} visible - 是否显示元素,true 为显示,false 为隐藏。
  45739. */
  45740. changeVisibility(item, visible) {
  45741. this.graphRender.changeVisibility(item, visible);
  45742. }
  45743. /**
  45744. * @function KnowledgeGraph.prototype.isVisible
  45745. * @description 查询元素显示状态。
  45746. * @param {Object} item - 元素实例。
  45747. * @return {boolean} - 返回值为 true,则表示当前元素处于显示状态,否则处于隐藏状态。
  45748. */
  45749. isVisible(item) {
  45750. return this.graphRender.isVisible(item);
  45751. }
  45752. /**
  45753. * @function KnowledgeGraph.prototype.getModel
  45754. * @description 获取元素的数据模型。
  45755. * @param {Object} item - 元素实例。
  45756. * @return {Object} - 返回值为节点的数据模型。
  45757. */
  45758. getModel(item) {
  45759. return this.graphRender.getModel(item);
  45760. }
  45761. /**
  45762. * @function KnowledgeGraph.prototype.addItem
  45763. * @description 新增元素(节点和边)。
  45764. * @param {string} type - 元素类型,可选值为 'node'、'edge'。
  45765. * @param {Object} model - 元素的数据模型,具体内容参见元素配置项。
  45766. */
  45767. addItem(type, model) {
  45768. return this.graphRender.addItem(type, model);
  45769. }
  45770. /**
  45771. * @function KnowledgeGraph.prototype.removeItem
  45772. * @description 删除元素。
  45773. * @param {string|Object} item - 元素 ID 或元素实例。
  45774. */
  45775. removeItem(item) {
  45776. return this.graphRender.removeItem(item);
  45777. }
  45778. /**
  45779. * @function KnowledgeGraph.prototype.updateItem
  45780. * @description 更新元素,包括更新数据、样式等。
  45781. * @param {string|Object} item - 元素 ID 或元素实例。
  45782. * @param {Object} model - 元素的数据模型,具体内容参见元素配置项。
  45783. */
  45784. updateItem(item, model) {
  45785. return this.graphRender.updateItem(item, model);
  45786. }
  45787. /**
  45788. * @function KnowledgeGraph.prototype.refreshItem
  45789. * @description 刷新指定元素。
  45790. * @param {string|Object} item - 元素 ID 或元素实例。
  45791. */
  45792. refreshItem(item) {
  45793. return this.graphRender.refreshItem(item);
  45794. }
  45795. /**
  45796. * @function KnowledgeGraph.prototype.refreshPositions
  45797. * @description 当节点位置发生变化时,刷新所有节点位置,并重计算边的位置。
  45798. */
  45799. refreshPositions() {
  45800. return this.graphRender.refreshPositions();
  45801. }
  45802. /**
  45803. * @function KnowledgeGraph.prototype.on
  45804. * @description graph监听事件
  45805. * @param {string} eventName - 事件名,可选事件名参见: Node交互事件名、Edge交互事件名、Canvas交互事件名 时机事件
  45806. * 通用事件名: click dbclick mouseenter mousemove mouseout mouseover mouseleave mousedown mouseup contextmenu dragstart drag dragend dragenter dragleave drop keydown keyup wheel touchstart touchmove touchend
  45807. * Node交互事件名: node:通用事件名, 例如 node:click
  45808. * Edge交互事件名: edge:通用事件名, 例如 edge:click
  45809. * Canvas交互事件名: canvas:通用事件名,例如 canvas:click
  45810. * 时机事件:用于监听图的某方法调用前后的时机。
  45811. * beforerender 调用 render 方法之前触发
  45812. * afterrender 调用 render 方法之后触发
  45813. * beforeadditem 调用 addItem 方法之前触发
  45814. * afteradditem 调用 addItem 方法之后触发
  45815. * beforeremoveitem 调用 removeItem 方法之前触发
  45816. * afterremoveitem 调用 removeItem 方法之后触发
  45817. * beforeupdateitem 调用 updateItem 方法之前触发
  45818. * afterupdateitem 调用 updateItem 方法之后触发
  45819. * beforegraphrefresh 调用 refresh 方法之前触发
  45820. * aftergraphrefresh 调用 refresh 方法之后触发
  45821. * beforelayout 布局前触发。调用 graph.render 时会进行布局,因此 render 时会触发。或用户主动调用图的 graph.layout 时触发
  45822. * afterlayout 布局完成后触发。调用 graph.render 时会进行布局,因此 render 时布局完成后会触发。或用户主动调用图的 graph.layout 时布局完成后触发
  45823. * viewportchange 调用 graph.moveTo 或 graph.zoom 均会触发该事件
  45824. * @param {Function} handler - 监听函数。
  45825. */
  45826. on(eventName, handler) {
  45827. this.graphRender.on(eventName, handler);
  45828. }
  45829. /**
  45830. * @function KnowledgeGraph.prototype.off
  45831. * @description graph关闭事件。
  45832. * @param {string} eventName - 事件名,参考on方法的事件名。
  45833. * @param {Function} handler - 监听函数。
  45834. */
  45835. off(eventName, handler) {
  45836. this.graphRender.off(eventName, handler);
  45837. }
  45838. /**
  45839. * @function KnowledgeGraph.prototype.toDataURL
  45840. * @description 转换成图片。
  45841. * @param {string} type - 图片类型 'image/png' / 'image/jpeg' / 'image/webp' / 'image/bmp'。
  45842. * @param {string} [backgroundColor] - 图片的背景色,可选,不传值时将导出透明背景的图片。
  45843. * @return {string} 返回值表示生成的图片的 URL。
  45844. */
  45845. toDataURL(type, backgroundColor) {
  45846. this.graphRender.toDataURL(type, backgroundColor);
  45847. }
  45848. /**
  45849. * @function KnowledgeGraph.prototype.nodeLabelOpenEllipsis
  45850. * @description 转换label的省略号。
  45851. * @param {Object} nodeLabelMaxWidth - node节点标签是否开启省略号
  45852. * @param {Object} nodes - graph的nodes数据。
  45853. * @return {Array} nodes
  45854. */
  45855. nodeLabelOpenEllipsis(nodeLabelMaxWidth, nodes) {
  45856. if (!nodes) {
  45857. return [];
  45858. }
  45859. if (!nodeLabelMaxWidth) {
  45860. return nodes;
  45861. }
  45862. return nodes.map((node) => {
  45863. const fontSize =
  45864. (node.labelCfg && node.labelCfg.fontSize) ||
  45865. (this.defaultNode && this.defaultNode.labelCfg && this.defaultNode.labelCfg.fontSize) ||
  45866. 14;
  45867. node.label = fittingStr(node.label, nodeLabelMaxWidth, fontSize);
  45868. return node;
  45869. });
  45870. }
  45871. /**
  45872. * @function KnowledgeGraph.prototype.clear
  45873. * @description 清除画布元素。
  45874. * @param {Object} [graph = this.graph] - graph实例。
  45875. */
  45876. clear(graph = this.graph) {
  45877. graph && graph.clear();
  45878. }
  45879. /**
  45880. * @function KnowledgeGraph.prototype.destroy
  45881. * @description 销毁画布。
  45882. * @param {Object} [graph = this.graph] - graph实例。
  45883. */
  45884. destroy(graph = this.graph) {
  45885. graph && graph.destroy();
  45886. }
  45887. }
  45888. /**
  45889. * @private
  45890. * @description 大于最大宽度的字符串会返回带有省略号的字符串 xxx...。
  45891. * @param {string} label - 需要处理的字符串。
  45892. * @param {number} maxWidth - 最大宽度。
  45893. * @param {number} fontSize - 字体大小。
  45894. * @returns {string} 处理之后的字符串。
  45895. */
  45896. function fittingStr(label, maxWidth, fontSize) {
  45897. const calcLabelLength = (label) => {
  45898. let len = 0;
  45899. for (let i = 0; i < label.length; i++) {
  45900. if (label.charCodeAt(i) > 0 && label.charCodeAt(i) < 128) {
  45901. len++;
  45902. } else {
  45903. len += 2;
  45904. }
  45905. }
  45906. return len;
  45907. };
  45908. const fontWidth = fontSize * 1; //字号+边距
  45909. maxWidth = maxWidth * 1.6; // 需要根据自己项目调整
  45910. const width = calcLabelLength(label) * fontWidth;
  45911. const ellipsis = '…';
  45912. if (width > maxWidth) {
  45913. const len = Math.floor((maxWidth - 20) / fontWidth);
  45914. const result = label.substring(0, len);
  45915. if ((label.substring(len).length + ellipsis.length) * fontWidth > maxWidth) {
  45916. return result + '\n' + label.substring(len, len + len - 2) + ellipsis;
  45917. } else if (label.substring(len).length == 0) {
  45918. return result;
  45919. } else {
  45920. return result + '\n' + label.substring(len);
  45921. }
  45922. } else {
  45923. return label;
  45924. }
  45925. }
  45926. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/GraphMap.js
  45927. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45928. * This program are made available under the terms of the Apache License, Version 2.0
  45929. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45930. /**
  45931. * @class GraphMap
  45932. * @classdesc 对接 iServer GraphMap。
  45933. * @category iServer KnowledgeGraph
  45934. * @version 11.1.0
  45935. * @param {string} serverUrl - GraphMap服务地址, 例如:http://{iserver}/services/{knowledgeGraph-provider}/restjsr/graph/graphmaps/{graphmap}。
  45936. * @param {Object} [options] - 参数。
  45937. * @param {KnowledgeGraph.Config} [options.config] - KnowledgeGraph的配置项。
  45938. * @param {string} [options.proxy] - 服务代理地址。
  45939. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  45940. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  45941. * @param {Object} [options.headers] - 请求头。
  45942. * @fires GraphMap#loaded
  45943. * @extends {mapboxgl.Evented}
  45944. * @usage
  45945. */
  45946. class GraphMap extends (external_mapboxgl_default()).Evented {
  45947. constructor(serverUrl, options) {
  45948. super(serverUrl, options);
  45949. /**
  45950. * @member GraphMap.prototype.graph
  45951. * @description KnowledgeGraph的实例.
  45952. *
  45953. */
  45954. this.graph = null;
  45955. /**
  45956. * @member GraphMap.prototype.EVENT_TYPES
  45957. * @description 监听一个自定义事件可用如下方式:
  45958. *
  45959. * 支持的事件如下:
  45960. * loaded - 渲染完成时触发。
  45961. */
  45962. this.EVENT_TYPES = ['loaded'];
  45963. const graphMapName = serverUrl.split('/').pop();
  45964. this.url = serverUrl.replace(`/graphmaps/${graphMapName}`, '');
  45965. this.createGraphMap(graphMapName, options);
  45966. }
  45967. /**
  45968. * @private
  45969. * @function GraphMap.prototype.createGraphMap
  45970. * @description 创建图谱。
  45971. * @param {string} graphMapName - 图谱名称
  45972. * @param {Object} options - 参数。
  45973. * @param {string} [options.proxy] - 服务代理地址。
  45974. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  45975. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  45976. * @param {Object} [options.headers] - 请求头。
  45977. * @param {KnowledgeGraph.Config} [options.config] - knowledgegrah配置项。
  45978. */
  45979. async createGraphMap(graphMapName, options) {
  45980. this.knowledgeGraphService = this.createKnowledgeGraphService(this.url, options);
  45981. const res = await this.knowledgeGraphService.getGraphMapData(graphMapName);
  45982. const result = KnowledgeGraph.dataFromGraphMap(res.data, res.graphMap);
  45983. this.graph = new KnowledgeGraph(options && options.config);
  45984. this.graph.on('beforelayout', () => {
  45985. /**
  45986. * @event GraphMap#loaded
  45987. * @description 渲染完成时触发。
  45988. */
  45989. this.fire(this.EVENT_TYPES[0]);
  45990. });
  45991. this.graph.setData(result);
  45992. this.graph.handleNodeStatus(transformExpandCollapseHiddenData(res.graphMap));
  45993. }
  45994. /**
  45995. * @private
  45996. * @function GraphMap.prototype.createKnowledgeGraphService
  45997. * @description 创建KnowledgeGraphService实例。
  45998. * @param {string} serverUrl - GraphMap服务地址, 例如:http://{iserver}/services/knowledgeGraph-test/restjsr/graph
  45999. * @param {Object} options - 参数。
  46000. * @param {string} [options.proxy] - 服务代理地址。
  46001. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  46002. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  46003. * @param {Object} [options.headers] - 请求头。
  46004. */
  46005. createKnowledgeGraphService(serverUrl, options) {
  46006. return new KnowledgeGraphService(serverUrl, options);
  46007. }
  46008. }
  46009. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/graphic/Graphic.js
  46010. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46011. * This program are made available under the terms of the Apache License, Version 2.0
  46012. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46013. /**
  46014. * @class Graphic
  46015. * @classdesc 高效率点图层点要素类。
  46016. * @category Visualization Graphic
  46017. * @param {(Object|Array.<number>)} lngLat - 坐标。格式:经纬度数组或包含{lng,lat}格式对象。
  46018. * @param {Object} style - 图形参数。
  46019. * @param {Array.<number>} [style.color] - 点颜色。目前只支持 rgba 数组。
  46020. * @param {Object} [style.radius] - 点半径。
  46021. * @param {Object} [attributes] - 属性信息。
  46022. * @example
  46023. * var graphic = new Graphic(
  46024. * {
  46025. * lng:116,
  46026. * lat:39
  46027. * },{
  46028. * color:[255,0,0],
  46029. * radius:30
  46030. * }
  46031. * });
  46032. * @usage
  46033. */
  46034. class Graphic {
  46035. constructor(lngLat, style, attributes) {
  46036. this.lngLat = core_Util_Util.isArray(lngLat) ? {lng: lngLat[0], lat: lngLat[1]} : lngLat;
  46037. this.style = core_Util_Util.extend({}, style);
  46038. this.attributes = attributes;
  46039. }
  46040. /**
  46041. * @function Graphic.prototype.getId
  46042. * @description 获取当前 ID。
  46043. * @returns {string} ID。
  46044. */
  46045. getId() {
  46046. return this.id;
  46047. }
  46048. /**
  46049. * @function Graphic.prototype.setId
  46050. * @description 设置当前要素 ID。
  46051. * @param {string} id - 要素 ID。
  46052. */
  46053. setId(id) {
  46054. this.id = id;
  46055. }
  46056. /**
  46057. * @function Graphic.prototype.getLngLat
  46058. * @description 获取经纬度坐标。
  46059. * @returns {Object} 经纬度坐标,数据格式{lng,lat}。
  46060. */
  46061. getLngLat() {
  46062. return this.lngLat;
  46063. }
  46064. /**
  46065. * @function Graphic.prototype.setLngLat
  46066. * @description 设置经纬度坐标。
  46067. * @param {Object} lngLat - 经纬度坐标,数据格式{lng,lat}。
  46068. */
  46069. setLngLat(lngLat) {
  46070. this.lngLat = core_Util_Util.isArray(lngLat) ? {lng: lngLat[0], lat: lngLat[1]} : lngLat;
  46071. }
  46072. /**
  46073. * @function Graphic.prototype.setStyle
  46074. * @description 设置点样式。
  46075. * @param {Object} style -样式选项。
  46076. * @param {Array} [style.color] - 颜色。
  46077. * @param {number} [style.radius] - 半径。
  46078. */
  46079. setStyle(style) {
  46080. this.style = core_Util_Util.extend(this.style, style);
  46081. }
  46082. /**
  46083. * @function Graphic.prototype.getStyle
  46084. * @description 获取样式。
  46085. * @returns {Object} 点样式。
  46086. */
  46087. getStyle() {
  46088. return this.style;
  46089. }
  46090. /**
  46091. * @function Graphic.prototype.setAttributes
  46092. * @description 设置属性信息。
  46093. * @param {Object} [attributes] - 属性信息。
  46094. */
  46095. setAttributes(attributes) {
  46096. this.attributes = core_Util_Util.extend({}, this.attributes, attributes);
  46097. }
  46098. /**
  46099. * @function Graphic.prototype.getAttributes
  46100. * @description 获取属性信息。
  46101. * @returns {Object} 属性信息。
  46102. */
  46103. getAttributes() {
  46104. return this.attributes;
  46105. }
  46106. }
  46107. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/graphic/index.js
  46108. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46109. * This program are made available under the terms of the Apache License, Version 2.0
  46110. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46111. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/mapv/MapvDataSet.js
  46112. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46113. * This program are made available under the terms of the Apache License, Version 2.0
  46114. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46115. var MapvDataSet = {
  46116. /**
  46117. * 返回mapv点数据集
  46118. */
  46119. getPoint: function (center) {
  46120. if (center && (center instanceof Array)) {
  46121. return new external_function_try_return_mapv_catch_e_return_namespaceObject.DataSet([{
  46122. geometry: {
  46123. type: 'Point',
  46124. coordinates: center
  46125. }
  46126. }]);
  46127. }
  46128. },
  46129. /**
  46130. * 返回mapv多点数据集
  46131. */
  46132. getPoints: function (points) {
  46133. if (points && (points instanceof Array)) {
  46134. var mPoints = [];
  46135. points.forEach(data => {
  46136. mPoints.push({
  46137. geometry: {
  46138. type: 'Point',
  46139. coordinates: data.geometry.coordinates
  46140. }
  46141. });
  46142. });
  46143. return new external_function_try_return_mapv_catch_e_return_namespaceObject.DataSet(mPoints);
  46144. }
  46145. },
  46146. /**
  46147. * 返回mapv弧形线数据集
  46148. */
  46149. getCurveLines: function (startPoint, LinePoints) {
  46150. if (startPoint && (startPoint instanceof Array) && LinePoints && (LinePoints instanceof Array)) {
  46151. var lineData = [];
  46152. LinePoints.forEach(data => {
  46153. var coords = data.geometry && data.geometry.coordinates;
  46154. var toCenter = {lng: coords[0], lat: coords[1]};
  46155. var fromCenter = {lng: startPoint[0], lat: startPoint[1]};
  46156. var cv = external_function_try_return_mapv_catch_e_return_namespaceObject.utilCurve.getPoints([fromCenter, toCenter]);
  46157. lineData.push({
  46158. geometry: {
  46159. type: 'LineString',
  46160. coordinates: cv
  46161. }
  46162. });
  46163. });
  46164. return new external_function_try_return_mapv_catch_e_return_namespaceObject.DataSet(lineData);
  46165. }
  46166. },
  46167. /**
  46168. * 返回mapv弧形动态点数据集
  46169. */
  46170. getCurveDynamicPoints: function (center, endPoints) {
  46171. if (center && (center instanceof Array) && endPoints && (endPoints instanceof Array)) {
  46172. var timeData = [];
  46173. endPoints.forEach(data => {
  46174. var coords = data.geometry && data.geometry.coordinates;
  46175. var toCenter = {lng: coords[0], lat: coords[1]};
  46176. var fromCenter = {lng: center[0], lat: center[1]};
  46177. var cv = external_function_try_return_mapv_catch_e_return_namespaceObject.utilCurve.getPoints([fromCenter, toCenter]);
  46178. for (var j = 0; j < cv.length; j++) {
  46179. timeData.push({
  46180. geometry: {
  46181. type: 'Point',
  46182. coordinates: cv[j]
  46183. },
  46184. time: j
  46185. });
  46186. }
  46187. });
  46188. return new external_function_try_return_mapv_catch_e_return_namespaceObject.DataSet(timeData);
  46189. }
  46190. }
  46191. };
  46192. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/mapv/MapExtend.js
  46193. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46194. * This program are made available under the terms of the Apache License, Version 2.0
  46195. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46196. var getDefaultVectorTileStyle = function (urlTemplate, options) {
  46197. options = options || {};
  46198. var defaultOptions = {};
  46199. defaultOptions.version = options.version || 8;
  46200. defaultOptions.layers = options.layers || [];
  46201. defaultOptions.light = options.light || {
  46202. "anchor": "viewport",
  46203. "color": "#fcf6ef",
  46204. "intensity": 0.5,
  46205. "position": [1.15, 201, 20]
  46206. };
  46207. var style = {
  46208. "version": defaultOptions.version,
  46209. "sources": {
  46210. "vector-tiles": {
  46211. "type": "vector",
  46212. "tiles": [urlTemplate]
  46213. }
  46214. },
  46215. "layers": defaultOptions.layers,
  46216. "light": defaultOptions.light
  46217. };
  46218. if (options.sprite != null) {
  46219. style.sprite = options.sprite;
  46220. }
  46221. if (options.glyphs != null) {
  46222. style.glyphs = options.glyphs;
  46223. }
  46224. return style;
  46225. };
  46226. var setBackground = function (map, color) {
  46227. if (color && map) {
  46228. map.addLayer({
  46229. "id": "background",
  46230. "type": "background",
  46231. "paint": {
  46232. "background-color": color
  46233. }
  46234. }, "background");
  46235. }
  46236. };
  46237. var setPaintProperty = function (map, layerIds, type, paint, source, sourceLayers) {
  46238. if (layerIds && map) {
  46239. if (Object.prototype.toString.call(layerIds) !== '[object Array]') {
  46240. layerIds = [layerIds];
  46241. }
  46242. for (var i = 0; i < layerIds.length; i++) {
  46243. var sourceLayer = sourceLayers ? sourceLayers[i] : null;
  46244. var layer = getLayer(layerIds[i], type, source, sourceLayer, paint);
  46245. map.addLayer(layer, layerIds[i]);
  46246. map.moveLayer(layerIds[i]);
  46247. }
  46248. }
  46249. };
  46250. function getLayer(id, type, source, sourceLayer, paint) {
  46251. var sourceType = source || "vector-tiles";
  46252. var sLayer = sourceLayer || id;
  46253. var layer = {
  46254. "id": id,
  46255. "type": type,
  46256. "source": sourceType,
  46257. "source-layer": sLayer,
  46258. "paint": paint
  46259. };
  46260. return layer;
  46261. }
  46262. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/mapv/index.js
  46263. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46264. * This program are made available under the terms of the Apache License, Version 2.0
  46265. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46266. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/theme/index.js
  46267. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46268. * This program are made available under the terms of the Apache License, Version 2.0
  46269. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46270. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/symbol/SingleSymbolRender.js
  46271. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46272. * This program are made available under the terms of the Apache License, Version 2.0
  46273. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46274. /**
  46275. * 单个符号
  46276. * @returns {Object}
  46277. * @private
  46278. */
  46279. class SingleSymbolRender {
  46280. constructor(map) {
  46281. this.map = map;
  46282. }
  46283. /**
  46284. * 符号转换成图层
  46285. * @param {*} layer
  46286. * @param {*} before
  46287. */
  46288. addLayer(layer, symbol, before) {
  46289. if(layer.layout && layer.layout.visibility === 'none') {
  46290. Object.assign(layer.layout, {visibility: 'visible'});
  46291. }
  46292. layer.paint && Object.assign(symbol.paint || {}, layer.paint);
  46293. layer.layout && Object.assign(symbol.layout || {}, layer.layout);
  46294. this.map.addLayerBySymbolBak({ ...layer, ...symbol }, before);
  46295. }
  46296. }
  46297. /* harmony default export */ const symbol_SingleSymbolRender = (SingleSymbolRender);
  46298. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/symbol/CompositeSymbolRender.js
  46299. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46300. * This program are made available under the terms of the Apache License, Version 2.0
  46301. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46302. /**
  46303. * 符号图层管理器
  46304. * @returns {Object}
  46305. * @private
  46306. */
  46307. class CompositeSymbolRender {
  46308. constructor(map) {
  46309. this.map = map;
  46310. this.singleSymbol = new symbol_SingleSymbolRender(map);
  46311. this.layerIds = {};
  46312. }
  46313. /**
  46314. * 符号转换成图层
  46315. * @param {*} layer
  46316. * @param {*} before
  46317. */
  46318. addLayer(layer, symbol, before) {
  46319. symbol.forEach((style) => {
  46320. const id = Util_Util.createUniqueID(`${layer.id}_`);
  46321. this.singleSymbol.addLayer({ ...layer, id }, style, before);
  46322. this.addLayerId(layer.id, id);
  46323. })
  46324. }
  46325. /**
  46326. * 添加图层
  46327. * @param {string} id
  46328. * @param {string} childId
  46329. */
  46330. addLayerId(id, childId) {
  46331. if (!this.layerIds[id]) {
  46332. this.layerIds[id] = [];
  46333. }
  46334. !this.layerIds[id].includes(childId) && this.layerIds[id].push(childId);
  46335. }
  46336. /**
  46337. * 删除图层
  46338. * @param {string} id
  46339. */
  46340. removeLayerId(id) {
  46341. delete this.layerIds[id];
  46342. }
  46343. /**
  46344. * 获取图层
  46345. * @param {string} id
  46346. * @returns {Array}
  46347. */
  46348. getLayerIds(id) {
  46349. return this.layerIds[id];
  46350. }
  46351. /**
  46352. * 获取组合图层ID
  46353. * @param {string} childId
  46354. * @returns {string}
  46355. */
  46356. getLayerId(childId) {
  46357. for (const id in this.layerIds) {
  46358. if (this.layerIds[id].find(i => i === childId)) {
  46359. return id;
  46360. }
  46361. }
  46362. }
  46363. }
  46364. /* harmony default export */ const symbol_CompositeSymbolRender = (CompositeSymbolRender);
  46365. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/symbol/SymbolManager.js
  46366. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46367. * This program are made available under the terms of the Apache License, Version 2.0
  46368. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46369. class SymbolManager {
  46370. constructor() {
  46371. this.symbols = {};//addSymbol接口添加的symbol信息
  46372. this.images = {};//在loadImage的时候存下image
  46373. }
  46374. addSymbol(id, symbol) {
  46375. this.symbols[id] = symbol;
  46376. }
  46377. getSymbol(id) {
  46378. return this.symbols[id] && JSON.parse(JSON.stringify(this.symbols[id]));
  46379. }
  46380. removeSymbol(id) {
  46381. delete this.symbols[id];
  46382. }
  46383. addImageInfo(id, image) {
  46384. this.images[id] = image;
  46385. }
  46386. getImageInfo(id) {
  46387. return this.images[id];
  46388. }
  46389. }
  46390. /* harmony default export */ const symbol_SymbolManager = (SymbolManager);
  46391. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/symbol/SymbolUtil.js
  46392. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46393. * This program are made available under the terms of the Apache License, Version 2.0
  46394. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46395. const SymbolUtil_LayerType = {
  46396. circle: 'circle',
  46397. symbol: 'symbol',
  46398. line: 'line',
  46399. fill: 'fill'
  46400. }
  46401. // 判断符号类型
  46402. const GET_TYPE_RULE = [{
  46403. prefix: 'line-',
  46404. type: SymbolUtil_LayerType.line
  46405. }, {
  46406. prefix: 'fill-',
  46407. type: SymbolUtil_LayerType.fill
  46408. }, {
  46409. prefix: 'circle-',
  46410. type: SymbolUtil_LayerType.circle
  46411. }];
  46412. function isMultiSymbol(symbol) {
  46413. return symbol && symbol.length > 0;
  46414. }
  46415. /**
  46416. * 获取不同图层类型使用image的属性名
  46417. * @param {object} symbol
  46418. * @returns {object}
  46419. * @private
  46420. */
  46421. function getImageKey(symbol) {
  46422. const symbolType = getSymbolType(symbol);
  46423. const IMAGE_MAPBOX_KEY = {
  46424. [SymbolUtil_LayerType.symbol]: {
  46425. type: 'layout',
  46426. name: 'icon-image'
  46427. },
  46428. [SymbolUtil_LayerType.line]: {
  46429. type: 'paint',
  46430. name: 'line-pattern'
  46431. },
  46432. [SymbolUtil_LayerType.fill]: {
  46433. type: 'paint',
  46434. name: 'fill-pattern'
  46435. }
  46436. }
  46437. const result = IMAGE_MAPBOX_KEY[symbolType];
  46438. return result;
  46439. }
  46440. /**
  46441. * 通过符号属性获取该符号类型
  46442. * @param {*} symbol
  46443. * @returns {string}
  46444. * @private
  46445. */
  46446. function getSymbolType(symbol) {
  46447. const { paint = {}, layout = {} } = symbol;
  46448. const keys = Object.keys(paint).concat(Object.keys(layout));
  46449. let type;
  46450. for (const v of GET_TYPE_RULE) {
  46451. const isMatch = keys.some(k => k.startsWith(v.prefix));
  46452. if (isMatch) {
  46453. type = v.type;
  46454. break;
  46455. }
  46456. }
  46457. return type || SymbolUtil_LayerType.symbol;
  46458. }
  46459. const MAPBOX_EXPRESSION_FIRST_VALUE = [
  46460. 'array',
  46461. 'boolean',
  46462. 'collator',
  46463. 'format',
  46464. 'literal',
  46465. 'number',
  46466. 'object',
  46467. 'string',
  46468. 'to-boolean',
  46469. 'to-color',
  46470. 'to-number',
  46471. 'to-string',
  46472. 'typeof',
  46473. 'feature-state',
  46474. 'geometry-type',
  46475. 'id',
  46476. 'line-progress',
  46477. 'properties',
  46478. 'at',
  46479. 'get',
  46480. 'has',
  46481. 'length',
  46482. '!',
  46483. '!=',
  46484. '<',
  46485. '<=',
  46486. '==',
  46487. '>',
  46488. '>=',
  46489. 'all',
  46490. 'any',
  46491. 'case',
  46492. 'match',
  46493. 'coalesce',
  46494. 'interpolate',
  46495. 'interpolate-hcl',
  46496. 'interpolate-lab',
  46497. 'step',
  46498. 'let',
  46499. 'var',
  46500. 'concat',
  46501. 'downcase',
  46502. 'is-supported-script',
  46503. 'resolved-locale',
  46504. 'upcase',
  46505. 'rgb',
  46506. 'rgba',
  46507. '-',
  46508. '*',
  46509. '/',
  46510. '%',
  46511. '^',
  46512. '+',
  46513. 'abs',
  46514. 'acos',
  46515. 'asin',
  46516. 'atan',
  46517. 'ceil',
  46518. 'cos',
  46519. 'e',
  46520. 'floor',
  46521. 'ln',
  46522. 'ln2',
  46523. 'log10',
  46524. 'log2',
  46525. 'max',
  46526. 'min',
  46527. 'pi',
  46528. 'round',
  46529. 'sin',
  46530. 'sqrt',
  46531. 'tan',
  46532. 'zoom',
  46533. 'heatmap-density'
  46534. ];
  46535. /**
  46536. * 是否为表达式
  46537. * @param key
  46538. * @param value
  46539. * @returns boolean
  46540. * @private
  46541. */
  46542. function isMapboxExpression(value) {
  46543. if (value && value.length > 0) {
  46544. const [v] = value;
  46545. return typeof v === 'string' && MAPBOX_EXPRESSION_FIRST_VALUE.includes(v);
  46546. }
  46547. return false;
  46548. }
  46549. function validateStyleKey(value) {
  46550. return Object.keys(value).every(k => {
  46551. return !isMapboxExpression(value[k]);
  46552. });
  46553. }
  46554. function validateSymbol(symbol) {
  46555. const symbolInfo = isMultiSymbol(symbol) ? symbol : [symbol];
  46556. return symbolInfo.every((s) => {
  46557. return validateStyleKey(s.paint || {}) && validateStyleKey(s.layout || {});
  46558. });
  46559. }
  46560. const isPaintKey = (key) => {
  46561. return [
  46562. 'icon-color',
  46563. 'icon-opacity',
  46564. 'icon-translate',
  46565. 'line-opacity',
  46566. 'line-blur',
  46567. 'line-translate',
  46568. 'line-color',
  46569. 'line-width',
  46570. 'line-offset',
  46571. 'line-dasharray',
  46572. 'line-pattern',
  46573. 'fill-color',
  46574. 'fill-opacity',
  46575. 'fill-pattern',
  46576. 'fill-outline-color',
  46577. 'text-color',
  46578. 'text-halo-blur',
  46579. 'text-halo-color',
  46580. 'text-halo-width',
  46581. 'text-opacity',
  46582. 'text-translate',
  46583. 'text-translate-anchor',
  46584. 'circle-blur',
  46585. 'circle-color',
  46586. 'circle-opacity',
  46587. 'circle-translate',
  46588. 'circle-radius',
  46589. 'circle-stroke-color',
  46590. 'circle-stroke-opacity',
  46591. 'circle-stroke-width'
  46592. ].includes(key);
  46593. }
  46594. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/symbol/SymbolHandler.js
  46595. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46596. * This program are made available under the terms of the Apache License, Version 2.0
  46597. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46598. /**
  46599. * 符号图层管理器
  46600. * @returns {Object}
  46601. * @private
  46602. */
  46603. class SymbolHandler {
  46604. constructor(map) {
  46605. this.map = map;
  46606. this.symbolManager = new symbol_SymbolManager();
  46607. this.singleSymbolRender = new symbol_SingleSymbolRender(map);
  46608. this.compositeSymbolRender = new symbol_CompositeSymbolRender(map);
  46609. this._layerSymbols = {};// 图层与symbol的映射关系
  46610. }
  46611. _update(map) {
  46612. this.map = map;
  46613. return this;
  46614. }
  46615. /**
  46616. * 添加符号图层
  46617. * @param {Object} layer
  46618. * @param {string} before
  46619. */
  46620. addLayer(layer, before) {
  46621. if (typeof layer.symbol === 'string') {
  46622. const id = layer.symbol;
  46623. if (id) {
  46624. const symbol = this.symbolManager.getSymbol(id);
  46625. if (!symbol) {
  46626. return this.map.fire('error', {
  46627. error: new Error(`Symbol "${id}" could not be loaded. Please make sure you have added the symbol with map.addSymbol().`)
  46628. });
  46629. }
  46630. this.setSymbolTolayer(layer.id, id);
  46631. this.getSymbolRender(symbol).addLayer(layer, symbol, before);
  46632. }
  46633. } else if (isMapboxExpression(layer.symbol)) {
  46634. this.setSymbolTolayer(layer.id, layer.symbol);
  46635. this.addExpressionLayer(layer, before);
  46636. }
  46637. }
  46638. /**
  46639. * 更新图层上的symbol
  46640. * @param {string} layerId
  46641. * @param {string | array} symbol
  46642. */
  46643. setSymbol(layerId, symbol) {
  46644. const layers = this.map.getStyle().layers;
  46645. const layerIndex = layers.findIndex(l => l.id === layerId);
  46646. if (layerIndex === -1) {
  46647. return this.map.fire('error', {
  46648. error: new Error(`Cannot set symbol "${symbol}" to non-existing layer "${layerId}".`)
  46649. });
  46650. }
  46651. this.map.removeLayer(layerId);
  46652. const beforeId = layers[layerIndex + 1] && layers[layerIndex + 1].id;
  46653. const layer = beforeId && this.map.style.getLayer(beforeId);
  46654. const before = (layer && layer.id) || (beforeId && this.getFirstLayerId(beforeId));
  46655. const orginLayer = layers[layerIndex];
  46656. this.addLayer({ ...orginLayer, paint: {}, layout: {
  46657. visibility: (orginLayer.layout && orginLayer.layout.visibility) || 'visible'
  46658. }, symbol }, before);
  46659. }
  46660. /**
  46661. * 处理match表达式为多个图层
  46662. * @param {object} layer
  46663. * @returns {array}
  46664. */
  46665. getMatchLayers(layer) {
  46666. const layers = [];
  46667. const filter = ["all"];
  46668. if (layer.filter) {
  46669. filter.push(layer.filter);
  46670. }
  46671. const expression = layer.symbol.slice(2);
  46672. expression.forEach((r, index) => {
  46673. if (index % 2 === 1) {
  46674. layers.push({
  46675. ...layer, "filter": [
  46676. ...filter,
  46677. [
  46678. "==",
  46679. layer.symbol[1][1],
  46680. expression[index - 1]
  46681. ]
  46682. ], symbol: r
  46683. });
  46684. } else if (index === expression.length - 1) {
  46685. layers.unshift({ ...layer, symbol: r });
  46686. }
  46687. });
  46688. return layers;
  46689. }
  46690. /**
  46691. * 处理match表达式为多个图层
  46692. * @param {object} layer
  46693. * @returns {array}
  46694. */
  46695. getCaseLayers(layer) {
  46696. const layers = [];
  46697. const filter = ["all"];
  46698. if (layer.filter) {
  46699. filter.push(layer.filter);
  46700. }
  46701. const expression = layer.symbol.slice(1);
  46702. expression.forEach((r, index) => {
  46703. if (index % 2 === 1) {
  46704. layers.push({
  46705. ...layer, "filter": [
  46706. ...filter,
  46707. expression[index - 1]
  46708. ], symbol: r
  46709. });
  46710. } else if (index === expression.length - 1) {
  46711. layers.unshift({ ...layer, symbol: r });
  46712. }
  46713. });
  46714. return layers;
  46715. }
  46716. /**
  46717. * 将symbol表达式拆成filter
  46718. * @param {object} layer
  46719. * @param {string} before
  46720. */
  46721. addExpressionLayer(layer, before) {
  46722. // symbol支持表达式的话,paint、layout不生效
  46723. delete layer.paint;
  46724. delete layer.layout;
  46725. const rules = {
  46726. match: this.getMatchLayers,
  46727. case: this.getCaseLayers
  46728. }
  46729. const getLayersFn = rules[layer.symbol[0]];
  46730. const layers = getLayersFn && getLayersFn(layer);
  46731. if (!layers) {
  46732. return this.map.fire('error', {
  46733. error: new Error(`This expressions not supported`)
  46734. });
  46735. }
  46736. layers.forEach((l) => {
  46737. l.id = Util_Util.createUniqueID(`${layer.id}_`);
  46738. this.compositeSymbolRender.addLayerId(layer.id, l.id);
  46739. this.addLayer(l, before);
  46740. });
  46741. }
  46742. /**
  46743. * 通过symbol判断使用管理器
  46744. * @param {object | array} symbol
  46745. * @returns {SingleSymbolRender | CompositeSymbolRender}
  46746. */
  46747. getSymbolRender(symbol) {
  46748. return isMultiSymbol(symbol) ? this.compositeSymbolRender : this.singleSymbolRender;
  46749. }
  46750. /**
  46751. * 将Web符号中的image添加到地图上
  46752. * @param {object} symbol
  46753. * @param {object} image
  46754. */
  46755. addSymbolImageToMap(symbol, image) {
  46756. const { type, name } = getImageKey(symbol);
  46757. const id = symbol[type] && symbol[type][name];
  46758. if (id && !this.map.hasImage(id)) {
  46759. // 如果需要使用到image 的需要addImage
  46760. this.map.addImage(id, image);
  46761. // 为了解决sdf问题,需要把load后的image信息存下
  46762. this.symbolManager.addImageInfo(id, image);
  46763. }
  46764. }
  46765. /**
  46766. * 给指定图层添加symbol
  46767. * @param {string} id
  46768. * @param {object} symbol
  46769. */
  46770. addSymbol(id, symbol) {
  46771. if (this.symbolManager.getSymbol(id)) {
  46772. return this.map.fire('error', {
  46773. error: new Error('An symbol with this name already exists.')
  46774. });
  46775. }
  46776. if (validateSymbol(symbol)) {
  46777. this.symbolManager.addSymbol(id, symbol);
  46778. } else {
  46779. return this.map.fire('error', {
  46780. error: new Error('Symbol is not supported expressions.')
  46781. });
  46782. }
  46783. }
  46784. /**
  46785. * 设置layer 对应的 symbol属性值
  46786. * @param {string} layerId
  46787. * @param {string | array} symbol
  46788. */
  46789. setSymbolTolayer(layerId, symbol) {
  46790. this._layerSymbols[layerId] = symbol;
  46791. }
  46792. /**
  46793. * 通过layerID获取symbol属性值
  46794. * @param {string} layerId
  46795. * @return {string | array} symbol
  46796. */
  46797. getSymbol(layerId) {
  46798. return this._layerSymbols[layerId];
  46799. }
  46800. /**
  46801. * 判断是否有symbol
  46802. * @return {boolean}
  46803. */
  46804. hasSymbol() {
  46805. return Object.keys(this._layerSymbols).length > 0;
  46806. }
  46807. /**
  46808. * 删除symbol
  46809. * @param {string} id
  46810. */
  46811. removeSymbol(id) {
  46812. this.symbolManager.removeSymbol(id);
  46813. }
  46814. /**
  46815. * 通过symbolId获取symbol内容
  46816. * @param {string} symbolId
  46817. */
  46818. getSymbolInfo(symbolId) {
  46819. return this.symbolManager.getSymbol(symbolId);
  46820. }
  46821. /**
  46822. * 获取组合图层的子图层IDs
  46823. * @param {string} layerId
  46824. * @returns {array}
  46825. */
  46826. getLayerIds(layerId) {
  46827. return this.compositeSymbolRender.getLayerIds(layerId) || [];
  46828. }
  46829. /**
  46830. * 获取子图层ID对应的组合图层
  46831. * @param {string} layerId
  46832. * @returns {string}
  46833. */
  46834. getLayerId(layerId) {
  46835. return this.compositeSymbolRender.getLayerId(layerId);
  46836. }
  46837. /**
  46838. * 删除图层ID
  46839. * @param {string} layerId
  46840. * @returns {string}
  46841. */
  46842. removeLayerId(layerId) {
  46843. return this.compositeSymbolRender.removeLayerId(layerId);
  46844. }
  46845. /**
  46846. * 获取指定ID的layer
  46847. * @param {string} layerId
  46848. * @returns {object}
  46849. */
  46850. getLayer(layerId) {
  46851. const layer = this.map.getLayerBySymbolBak(layerId);
  46852. const symbol = this.getSymbol(layerId);
  46853. if (layer) {
  46854. return symbol ? { ...layer, symbol } : layer;
  46855. } else {
  46856. const layerIds = this.getLayerIds(layerId);
  46857. if (layerIds[0]) {
  46858. const reallayer = this.map.getLayerBySymbolBak(layerIds[0]);
  46859. return reallayer && { ...reallayer, symbol, id: layerId }
  46860. }
  46861. }
  46862. }
  46863. /**
  46864. * 删除指定图层
  46865. * @param {string} layerId
  46866. */
  46867. removeLayer(layerId) {
  46868. const layerIds = this.getLayerIds(layerId);
  46869. if (layerIds.length > 0) {
  46870. layerIds.forEach(id => this.map.style.removeLayer(id));
  46871. this.removeLayerId(layerId);
  46872. } else {
  46873. this.map.style.removeLayer(layerId);
  46874. }
  46875. }
  46876. /**
  46877. * 获取style
  46878. * @returns {object}
  46879. */
  46880. getStyle() {
  46881. const style = this.map.style.serialize();
  46882. if (this.hasSymbol()) {
  46883. style.layers = style.layers.reduce((pre, layer) => {
  46884. const compositeId = this.getLayerId(layer.id);
  46885. if (compositeId) {
  46886. !pre.find(l => l.id === compositeId) && pre.push({ ...layer, symbol: this.getSymbol(compositeId), id: compositeId })
  46887. } else if (this.getSymbol(layer.id)) {
  46888. pre.push({ ...layer, symbol: this.getSymbol(layer.id) })
  46889. } else {
  46890. pre.push(layer);
  46891. }
  46892. return pre;
  46893. }, []);
  46894. }
  46895. return style;
  46896. }
  46897. /**
  46898. * 获取组合图层的子图层0 id
  46899. * @param {string} layerId
  46900. * @returns {string | undefined}
  46901. */
  46902. getFirstLayerId(layerId) {
  46903. const layerIds = this.getLayerIds(layerId);
  46904. return layerIds[0];
  46905. }
  46906. /**
  46907. * 扩展map的moveLayer
  46908. * @param {string} layerId
  46909. * @param {string | undefined} beforeId
  46910. */
  46911. moveLayer(layerId, beforeId) {
  46912. const layerIds = this.getLayerIds(layerId);
  46913. const layer = beforeId && this.map.style.getLayer(beforeId);
  46914. const realBeforeId = (layer && layer.id) || (beforeId && this.getFirstLayerId(beforeId));
  46915. if (layerIds.length > 0) {
  46916. layerIds.forEach(id => this.map.style.moveLayer(id, realBeforeId));
  46917. } else {
  46918. this.map.style.moveLayer(layerId, realBeforeId);
  46919. }
  46920. }
  46921. /**
  46922. * 扩展map的setFilter
  46923. * @param {string} layerId
  46924. * @param {Array} filter
  46925. * @param {object} options
  46926. */
  46927. setFilter(layerId, filter, options) {
  46928. const symbol = this.getSymbol(layerId);
  46929. if (isMapboxExpression(symbol)) {
  46930. // 如果 symbol 是数据驱动,filter需要重新计算
  46931. const realLayerId = this.getFirstLayerId(layerId);
  46932. this.map.style.setFilter(realLayerId, filter, options);
  46933. const symbol = this.getSymbol(layerId);
  46934. this.setSymbol(layerId, symbol);
  46935. return;
  46936. }
  46937. const layerIds = this.getLayerIds(layerId);
  46938. if (layerIds.length > 0) {
  46939. layerIds.forEach(id => this.map.style.setFilter(id, filter, options));
  46940. } else {
  46941. this.map.style.setFilter(layerId, filter, options);
  46942. }
  46943. }
  46944. /**
  46945. * 扩展map的getFilter
  46946. * @param {string} layerId
  46947. * @returns {object}
  46948. */
  46949. getFilter(layerId) {
  46950. const realLayerId = this.getFirstLayerId(layerId);
  46951. if (this.map.style.getLayer(realLayerId)) {
  46952. return this.map.style.getFilter(realLayerId);
  46953. }
  46954. }
  46955. /**
  46956. * 扩展map的setLayerZoomRange
  46957. * @param {string} layerId
  46958. * @param {number} minzoom
  46959. * @param {number} maxzoom
  46960. */
  46961. setLayerZoomRange(layerId, minzoom, maxzoom) {
  46962. const layerIds = this.getLayerIds(layerId);
  46963. if (layerIds.length > 0) {
  46964. layerIds.forEach(id => this.map.style.setLayerZoomRange(id, minzoom, maxzoom));
  46965. } else {
  46966. this.map.style.setLayerZoomRange(layerId, minzoom, maxzoom);
  46967. }
  46968. }
  46969. /**
  46970. * 扩展map的setPaintProperty
  46971. * @param {string} layerId
  46972. * @param {string} name
  46973. * @param {*} value
  46974. * @param {object} options
  46975. */
  46976. setPaintProperty(layerId, name, value, options) {
  46977. const layerIds = this.getLayerIds(layerId);
  46978. if (layerIds.length > 0) {
  46979. layerIds.forEach(id => this.map.style.setPaintProperty(id, name, value, options));
  46980. } else {
  46981. this.map.style.setPaintProperty(layerId, name, value, options);
  46982. }
  46983. }
  46984. /**
  46985. * 扩展map的getPaintProperty
  46986. * @param {string} layerId
  46987. * @param {string} name
  46988. * @returns {object}
  46989. */
  46990. getPaintProperty(layerId, name) {
  46991. const realLayerId = this.getFirstLayerId(layerId);
  46992. return this.map.style.getPaintProperty(realLayerId, name);
  46993. }
  46994. /**
  46995. * 扩展map的setLayoutProperty
  46996. * @param {string} layerId
  46997. * @param {string} name
  46998. * @param {*} value
  46999. * @param {object} options
  47000. */
  47001. setLayoutProperty(layerId, name, value, options) {
  47002. const layerIds = this.getLayerIds(layerId);
  47003. if (layerIds.length > 0) {
  47004. layerIds.forEach(id => this.map.style.setLayoutProperty(id, name, value, options));
  47005. } else {
  47006. this.map.style.setLayoutProperty(layerId, name, value, options);
  47007. }
  47008. }
  47009. /**
  47010. * 扩展map的getLayoutProperty
  47011. * @param {string} layerId
  47012. * @param {string} name
  47013. * @returns {object}
  47014. */
  47015. getLayoutProperty(layerId, name) {
  47016. const realLayerId = this.getFirstLayerId(layerId);
  47017. return this.map.style.getLayoutProperty(realLayerId, name);
  47018. }
  47019. /**
  47020. * 遍历this._layerSymbols, 更新使用到symbolId的图层
  47021. * @param {string} symbolId
  47022. */
  47023. updateLayerSymbol(symbolId) {
  47024. Object.keys(this._layerSymbols).forEach(layerId => {
  47025. const symbol = this._layerSymbols[layerId];
  47026. if (symbol.includes(symbolId)) {
  47027. this.setSymbol(layerId, symbol);
  47028. }
  47029. })
  47030. }
  47031. /**
  47032. * 更新符号
  47033. * @param {string} symbolId
  47034. * @param {object | array} symbol
  47035. */
  47036. updateSymbol(symbolId, symbol) {
  47037. // symbol不存在
  47038. if (!this.symbolManager.getSymbol(symbolId)) {
  47039. return this.map.fire('error', {
  47040. error: new Error(`Symbol "${symbolId}" could not be loaded. Please make sure you have added the symbol with map.addSymbol().`)
  47041. });
  47042. }
  47043. if (validateSymbol(symbol)) {
  47044. // 更新symbol
  47045. this.symbolManager.addSymbol(symbolId, symbol);
  47046. this.updateLayerSymbol(symbolId);
  47047. } else {
  47048. return this.map.fire('error', {
  47049. error: new Error('Symbol is not supported expressions.')
  47050. });
  47051. }
  47052. }
  47053. /**
  47054. * 设置symbol属性值
  47055. * @param {string} symbolId
  47056. * @param {number} symbolIndex
  47057. * @param {string} name
  47058. * @param {any} value
  47059. */
  47060. setSymbolProperty(symbolId, symbolIndex, name, value) {
  47061. const symbol = this.symbolManager.getSymbol(symbolId);
  47062. // symbol不存在
  47063. if (!symbol) {
  47064. return this.map.fire('error', {
  47065. error: new Error(`Symbol "${symbolId}" could not be loaded. Please make sure you have added the symbol with map.addSymbol().`)
  47066. });
  47067. }
  47068. // value不支持表达式
  47069. if (isMapboxExpression(value)) {
  47070. return this.map.fire('error', {
  47071. error: new Error('Symbol value is not supported expressions.')
  47072. });
  47073. }
  47074. const paintOrLayout = isPaintKey(name) ? 'paint' : 'layout';
  47075. if (symbol.length > 0) {
  47076. const symbolChild = symbol[symbolIndex];
  47077. if (!symbolChild) {
  47078. return this.map.fire('error', {
  47079. error: new Error(`symbol[${symbolIndex}] does not exist.`)
  47080. });
  47081. }
  47082. if (!symbolChild[paintOrLayout]) {
  47083. symbolChild[paintOrLayout] = {};
  47084. }
  47085. Object.assign(symbolChild[paintOrLayout], { [name]: value });
  47086. } else {
  47087. if (!symbol[paintOrLayout]) {
  47088. symbol[paintOrLayout] = {};
  47089. }
  47090. Object.assign(symbol[paintOrLayout], { [name]: value });
  47091. }
  47092. // 更新symbol
  47093. this.symbolManager.addSymbol(symbolId, symbol);
  47094. this.updateLayerSymbol(symbolId);
  47095. }
  47096. /**
  47097. * 获取symbol的属性值
  47098. * @param {string} symbolId
  47099. * @param {number} symbolIndex
  47100. * @param {string} name
  47101. * @returns {any}
  47102. */
  47103. getSymbolProperty(symbolId, symbolIndex, name) {
  47104. const symbol = this.symbolManager.getSymbol(symbolId);
  47105. // symbol不存在
  47106. if (!symbol) {
  47107. this.map.fire('error', {
  47108. error: new Error(`Symbol "${symbolId}" could not be loaded. Please make sure you have added the symbol with map.addSymbol().`)
  47109. });
  47110. return;
  47111. }
  47112. const paintOrLayout = isPaintKey(name) ? 'paint' : 'layout';
  47113. if (symbol.length > 0) {
  47114. return symbol[symbolIndex] && symbol[symbolIndex][paintOrLayout] && symbol[symbolIndex][paintOrLayout][name];
  47115. } else {
  47116. return symbol[paintOrLayout] && symbol[paintOrLayout][name];
  47117. }
  47118. }
  47119. }
  47120. /* harmony default export */ const symbol_SymbolHandler = (SymbolHandler);
  47121. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/symbol/MapExtendSymbol.js
  47122. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47123. * This program are made available under the terms of the Apache License, Version 2.0
  47124. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47125. /**
  47126. * @function MapExtendSymbol
  47127. * @description 扩展了 mapboxgl.Map 对图层相关的操作。
  47128. * @private
  47129. */
  47130. function MapExtendSymbol(){
  47131. /**
  47132. * 获取symbol管理
  47133. * @param {*} map
  47134. * @returns {object}
  47135. */
  47136. const getSymbolHandler = (map) => {
  47137. if (!(external_mapboxgl_default()).Map.prototype.symbolHandler) {
  47138. (external_mapboxgl_default()).Map.prototype.symbolHandler = new symbol_SymbolHandler(map);
  47139. }
  47140. return external_mapboxgl_default().Map.prototype.symbolHandler._update(map);
  47141. }
  47142. if ((external_mapboxgl_default()).Map.prototype.addLayerBySymbolBak === undefined) {
  47143. (external_mapboxgl_default()).Map.prototype.addLayerBySymbolBak = (external_mapboxgl_default()).Map.prototype.addLayer;
  47144. (external_mapboxgl_default()).Map.prototype.addLayer = function (layer, before) {
  47145. if (layer.symbol) {
  47146. getSymbolHandler(this).addLayer(layer, before);
  47147. return this;
  47148. }
  47149. this.addLayerBySymbolBak(layer, before);
  47150. return this;
  47151. };
  47152. }
  47153. if ((external_mapboxgl_default()).Map.prototype.getLayerBySymbolBak === undefined) {
  47154. (external_mapboxgl_default()).Map.prototype.getLayerBySymbolBak = (external_mapboxgl_default()).Map.prototype.getLayer;
  47155. (external_mapboxgl_default()).Map.prototype.getLayer = function (id) {
  47156. return getSymbolHandler(this).getLayer(id);
  47157. };
  47158. }
  47159. if ((external_mapboxgl_default()).Map.prototype.moveLayerBySymbolBak === undefined) {
  47160. (external_mapboxgl_default()).Map.prototype.moveLayerBySymbolBak = (external_mapboxgl_default()).Map.prototype.moveLayer;
  47161. ;(external_mapboxgl_default()).Map.prototype.moveLayer = function (id, beforeId) {
  47162. if (this.style.getLayer(id) && (!beforeId || this.style.getLayer(beforeId))) {
  47163. return this.moveLayerBySymbolBak(id, beforeId);
  47164. }
  47165. getSymbolHandler(this).moveLayer(id, beforeId);
  47166. return this._update(true);
  47167. }
  47168. }
  47169. if ((external_mapboxgl_default()).Map.prototype.removeLayerBySymbolBak === undefined) {
  47170. (external_mapboxgl_default()).Map.prototype.removeLayerBySymbolBak = (external_mapboxgl_default()).Map.prototype.removeLayer;
  47171. (external_mapboxgl_default()).Map.prototype.removeLayer = function (id) {
  47172. if (this.style.getLayer(id)) {
  47173. return this.removeLayerBySymbolBak(id);
  47174. }
  47175. return getSymbolHandler(this).removeLayer(id);
  47176. };
  47177. }
  47178. if ((external_mapboxgl_default()).Map.prototype.setLayoutPropertyBySymbolBak === undefined) {
  47179. //目前扩展的overlayer,只支持显示或隐藏图层操作
  47180. (external_mapboxgl_default()).Map.prototype.setLayoutPropertyBySymbolBak = (external_mapboxgl_default()).Map.prototype.setLayoutProperty;
  47181. (external_mapboxgl_default()).Map.prototype.setLayoutProperty = function (layerID, name, value, options) {
  47182. if (this.overlayLayersManager[layerID] || this.style.getLayer(layerID)) {
  47183. return this.setLayoutPropertyBySymbolBak(layerID, name, value, options);
  47184. }
  47185. getSymbolHandler(this).setLayoutProperty(layerID, name, value, options);
  47186. return this._update(true);
  47187. };
  47188. }
  47189. /**
  47190. * 指定图层设置符号
  47191. * @param {string} layerId
  47192. * @param {string | array} symbol
  47193. */
  47194. (external_mapboxgl_default()).Map.prototype.setSymbol = function (layerId, symbol) {
  47195. getSymbolHandler(this).setSymbol(layerId, symbol);
  47196. };
  47197. /**
  47198. * Layer新增symbol属性
  47199. */
  47200. if (!((external_mapboxgl_default()).Map.prototype).setStyleBak) {
  47201. ((external_mapboxgl_default()).Map.prototype).setStyleBak = (external_mapboxgl_default()).Map.prototype.setStyle;
  47202. ;(external_mapboxgl_default()).Map.prototype.setStyle = function (style, options) {
  47203. this.setStyleBak(style, options);
  47204. this.style && this.style.once('style.load', () => {
  47205. const symbolLayers = style.layers.filter(l => l.symbol);
  47206. symbolLayers.forEach((l) => {
  47207. this.setSymbol(l.id, l.symbol);
  47208. });
  47209. });
  47210. return this;
  47211. }
  47212. }
  47213. /**
  47214. * 加载Web符号
  47215. * @param {string} id
  47216. * @param {function} callback
  47217. */
  47218. (external_mapboxgl_default()).Map.prototype.loadSymbol = async function (id, callback) {
  47219. if (typeof id === 'string') {
  47220. let symbolInfo = getSymbolHandler(this).getSymbolInfo(id);
  47221. if (!symbolInfo) {
  47222. const symbolResult = await getSymbol(id, this);
  47223. if (!symbolResult) {
  47224. callback({
  47225. message: 'This symbol is not exists.'
  47226. });
  47227. return;
  47228. }
  47229. const { value, image } = symbolResult;
  47230. symbolInfo = value;
  47231. image && getSymbolHandler(this).addSymbolImageToMap(value, image);
  47232. }
  47233. callback(null, symbolInfo);
  47234. } else {
  47235. callback({
  47236. message: 'Symbol id must be a string.'
  47237. });
  47238. }
  47239. };
  47240. /**
  47241. * 添加符号
  47242. * @param {string} id
  47243. * @param {object} symbol
  47244. */
  47245. (external_mapboxgl_default()).Map.prototype.addSymbol = function (id, symbol) {
  47246. getSymbolHandler(this).addSymbol(id, symbol);
  47247. };
  47248. /**
  47249. * 判断符号是否存在
  47250. * @param {string} id
  47251. */
  47252. (external_mapboxgl_default()).Map.prototype.hasSymbol = function (id) {
  47253. if (!id) {
  47254. this.fire('error', {
  47255. error: new Error('Missing required symbol id')
  47256. });
  47257. return false;
  47258. }
  47259. return !!getSymbolHandler(this).getSymbolInfo(id);
  47260. };
  47261. /**
  47262. * 删除符号
  47263. * @param {string} id
  47264. */
  47265. (external_mapboxgl_default()).Map.prototype.removeSymbol = function (id) {
  47266. getSymbolHandler(this).removeSymbol(id);
  47267. };
  47268. /**
  47269. * 更新符号
  47270. * @param {string} id
  47271. * @param {object} symbol
  47272. */
  47273. (external_mapboxgl_default()).Map.prototype.updateSymbol = function (id, symbol) {
  47274. getSymbolHandler(this).updateSymbol(id, symbol);
  47275. };
  47276. /**
  47277. * 设置symbol属性值
  47278. * @param {string} id
  47279. * @param {number} index
  47280. * @param {string} name
  47281. * @param {any} value
  47282. */
  47283. (external_mapboxgl_default()).Map.prototype.setSymbolProperty = function (id, index, name, value) {
  47284. getSymbolHandler(this).setSymbolProperty(id, index, name, value);
  47285. };
  47286. /**
  47287. * 获取symbol的属性值
  47288. * @param {string} id
  47289. * @param {number} index
  47290. * @param {string} name
  47291. * @returns {any}
  47292. */
  47293. (external_mapboxgl_default()).Map.prototype.getSymbolProperty = function (id, index, name) {
  47294. return getSymbolHandler(this).getSymbolProperty(id, index, name);
  47295. };
  47296. (external_mapboxgl_default()).Map.prototype.getStyle = function () {
  47297. if (this.style) {
  47298. return getSymbolHandler(this).getStyle();
  47299. }
  47300. };
  47301. (external_mapboxgl_default()).Map.prototype.setFilter = function (layerId, filter, options) {
  47302. if (this.style.getLayer(layerId)) {
  47303. this.style.setFilter(layerId, filter, options);
  47304. return this._update(true);
  47305. }
  47306. getSymbolHandler(this).setFilter(layerId, filter, options);
  47307. return this._update(true);
  47308. };
  47309. (external_mapboxgl_default()).Map.prototype.getFilter = function (layerId) {
  47310. if (this.style.getLayer(layerId)) {
  47311. return this.style.getFilter(layerId);
  47312. }
  47313. return getSymbolHandler(this).getFilter(layerId);
  47314. };
  47315. (external_mapboxgl_default()).Map.prototype.setLayerZoomRange = function (layerId, minzoom, maxzoom) {
  47316. if (this.style.getLayer(layerId)) {
  47317. this.style.setLayerZoomRange(layerId, minzoom, maxzoom);
  47318. return this._update(true);
  47319. }
  47320. getSymbolHandler(this).setLayerZoomRange(layerId, minzoom, maxzoom);
  47321. return this._update(true);
  47322. };
  47323. (external_mapboxgl_default()).Map.prototype.setPaintProperty = function (layerId, name, value, options) {
  47324. if (this.style.getLayer(layerId)) {
  47325. this.style.setPaintProperty(layerId, name, value, options);
  47326. return this._update(true);
  47327. }
  47328. getSymbolHandler(this).setPaintProperty(layerId, name, value, options);
  47329. return this._update(true);
  47330. };
  47331. (external_mapboxgl_default()).Map.prototype.getPaintProperty = function (layerId, name) {
  47332. if (this.style.getLayer(layerId)) {
  47333. return this.style.getPaintProperty(layerId, name);
  47334. }
  47335. return getSymbolHandler(this).getPaintProperty(layerId, name);
  47336. };
  47337. (external_mapboxgl_default()).Map.prototype.getLayoutProperty = function (layerId, name) {
  47338. if (this.style.getLayer(layerId)) {
  47339. return this.style.getLayoutProperty(layerId, name);
  47340. }
  47341. return getSymbolHandler(this).getLayoutProperty(layerId, name);
  47342. };
  47343. /**
  47344. * @function WebSymbol.prototype.getSymbol
  47345. * @param {string} id - 符号ID。
  47346. * @description 获取符号信息。
  47347. * @returns {object} 符号信息。
  47348. * @private
  47349. */
  47350. async function getSymbol(id, map) {
  47351. let url = `${map.basePath}/${id}/${id}`;
  47352. if (false) {}
  47353. const value = await FetchRequest.get(`${url}.json`).then(response => {
  47354. if (!response.ok) {
  47355. return;
  47356. }
  47357. return response.json();
  47358. })
  47359. .catch(() => null);
  47360. if (!value) {
  47361. return null;
  47362. }
  47363. const paint = value.paint || {};
  47364. const layout = value.layout || {};
  47365. const hasImage = paint['fill-pattern'] || paint['line-pattern'] || layout['icon-image'];
  47366. const image = hasImage && await new Promise((resolve) => {
  47367. const image = new Image();
  47368. image.src = `${url}.png`;
  47369. image.onload = (content) => {
  47370. resolve(content ? image : null);
  47371. };
  47372. image.onerror = () => {
  47373. resolve(null);
  47374. };
  47375. });
  47376. return {
  47377. value,
  47378. image
  47379. }
  47380. }
  47381. }
  47382. /* harmony default export */ const symbol_MapExtendSymbol = (MapExtendSymbol);
  47383. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/symbol/WebSymbol.js
  47384. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47385. * This program are made available under the terms of the Apache License, Version 2.0
  47386. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47387. /**
  47388. * @class WebSymbol
  47389. * @classdesc SuperMap iClient for MapboxGL 支持 Web 符号库,扩展了 [MapboxGL](https://docs.mapbox.com/mapbox-gl-js/api/) 的 API。
  47390. * @category Visualization WebSymbol
  47391. * @description
  47392. *
  47393. * ## 初始化
  47394. * 使用Web符号资源时, 通过接口指定符号资源路径。
  47395. * ```
  47396. * new mapboxgl.supermap.WebSymbol().init({basePath: "./resources/symbols"});
  47397. * ```
  47398. *
  47399. * ## 新增 API
  47400. * ## mapboxgl.Map.prototype.loadSymbol
  47401. * 通过[Web符号ID](../../../../../examples/mapboxgl/websymbol_gallery.html)加载Web符号, 用于Map#addSymbol。
  47402. *
  47403. * 参数名称 |类型 |描述
  47404. * :---- |:--- |:---
  47405. * id |string |[Web符号ID](../../../../../examples/mapboxgl/websymbol_gallery.html)
  47406. * callback |function |在符号加载完成后调用,返回符号信息;如果有错误,则返回错误参数。
  47407. *
  47408. * **Example**
  47409. * ```
  47410. * map.loadSymbol('point-1', (error, symbol) => {
  47411. * if (error) throw error;
  47412. * // Add the loaded symbol with the ID 'point-1'.
  47413. * map.addSymbol('point-1', symbol);
  47414. * });
  47415. * ```
  47416. *
  47417. *
  47418. * ## mapboxgl.Map.prototype.addSymbol
  47419. * 添加一个符号。该符号可以显示在地图上。Mapbox layers 的 symbol属性可以使用该符号ID。
  47420. *
  47421. * |参数名称 |类型 |描述 | ||
  47422. * |---- |--- |--- |---|---|
  47423. * |id |string |符号ID |||
  47424. * |symbol |object |由Mapbox Layers中的[paint](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#paint-property)、[layout](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#layout-property)(visibility 属性除外)组成的符号对象|||
  47425. * | | |参数名称 |类型 |描述 |
  47426. * | | |paint |object |Mapbox Layers [paint](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#paint-property)|
  47427. * | | |layout |object |Mapbox Layers [layout](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#layout-property)(visibility 属性除外)|
  47428. *
  47429. * **Example**
  47430. * ```
  47431. * map.addSymbol('point-1', symbol);
  47432. * ```
  47433. *
  47434. *
  47435. * ## mapboxgl.Map.prototype.setSymbol
  47436. * 给指定图层设置符号。
  47437. *
  47438. * 参数名称 |类型 |描述
  47439. * :---- |:--- |:---
  47440. * layerId |string |图层ID
  47441. * symbol |string、array |已经添加的符号ID(addSymbol中的符号ID), 或者[符号表达式](#expression)
  47442. *
  47443. * **Example**
  47444. * ```
  47445. * map.setSymbol("layerId", 'point-1');
  47446. * map.setSymbol("layerId", [
  47447. "match",
  47448. ["get", "DLBM"],
  47449. "011", "line-964458", //公路用地
  47450. "013", "line-964462", //农村道路
  47451. "021", "line-962613", //河流水面
  47452. "023", "line-962613", //河流水面
  47453. "line-962613"
  47454. ]);
  47455. * ```
  47456. *
  47457. *
  47458. * ## mapboxgl.Map.prototype.hasSymbol
  47459. * 检查是否存在指定 ID 的符号。
  47460. *
  47461. * 参数名称 |类型 |描述
  47462. * :---- |:--- |:---
  47463. * id |string |符号ID
  47464. *
  47465. * **Example**
  47466. * ```
  47467. * const pointExists = map.hasSymbol('point-1');
  47468. * ```
  47469. *
  47470. *
  47471. * ## mapboxgl.Map.prototype.removeSymbol
  47472. * 删除指定 ID 的符号。
  47473. *
  47474. * 参数名称 |类型 |描述
  47475. * :---- |:--- |:---
  47476. * id |string |已经添加的符号ID
  47477. *
  47478. * **Example**
  47479. * ```
  47480. * map.removeSymbol('point-1');
  47481. * ```
  47482. *
  47483. *
  47484. * ## mapboxgl.Map.prototype.updateSymbol
  47485. * 更新指定 ID 的符号。
  47486. *
  47487. * 参数名称 |类型 |描述
  47488. * :---- |:--- |:---
  47489. * id |string |已经添加的符号ID
  47490. * |symbol |object |由Mapbox Layers中的[paint](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#paint-property)、[layout](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#layout-property)(visibility 属性除外)组成的符号对象|||
  47491. * | | |参数名称 |类型 |描述 |
  47492. * | | |paint |object |Mapbox Layers [paint](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#paint-property)|
  47493. * | | |layout |object |Mapbox Layers [layout](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#layout-property)(visibility 属性除外)|
  47494. *
  47495. * **Example**
  47496. * ```
  47497. * map.updateSymbol('point-1', symbol);
  47498. * ```
  47499. *
  47500. *
  47501. * ## mapboxgl.Map.prototype.setSymbolProperty
  47502. * 设置指定ID符号的属性值。
  47503. *
  47504. * 参数名称 |类型 |描述
  47505. * :---- |:--- |:---
  47506. * id |string |符号ID
  47507. * index |number |符号数组的index, 符号不是数组的设置为null
  47508. * name |string |属性名称
  47509. * value |any |属性值
  47510. *
  47511. * **Example**
  47512. * ```
  47513. * map.setSymbolProperty('point-1', null, "icon-color", "black");
  47514. * map.setSymbolProperty('line-962529', 0, "line-width", 10);
  47515. * ```
  47516. *
  47517. *
  47518. * ## mapboxgl.Map.prototype.getSymbolProperty
  47519. * 获取指定ID符号的属性值。
  47520. *
  47521. * 参数名称 |类型 |描述
  47522. * :---- |:--- |:---
  47523. * id |string |符号ID
  47524. * index |number |符号数组的index, 符号不是数组的设置为null
  47525. * name |string |属性名称
  47526. *
  47527. * **Example**
  47528. * ```
  47529. * map.getSymbolProperty('point-1', null, "icon-color");
  47530. * map.getSymbolProperty('line-962529', 0, "line-width");
  47531. * ```
  47532. *
  47533. *
  47534. * ## 扩展 [Mapbox Layers](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/)
  47535. * 在[Mapbox Layers](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/) 属性的基础上新增了symbol 属性, 指定符号ID 或者 [符号表达式](#expression)。
  47536. *
  47537. * **符号ID**
  47538. * ```
  47539. * map.addLayer({
  47540. * id: "symbol",
  47541. * source: "sourceId",
  47542. * type: "symbol",
  47543. * symbol: 'point-1'
  47544. * });
  47545. * ```
  47546. * ```
  47547. * map.setStyle({
  47548. * version: 8,
  47549. * sources: {},
  47550. * layers: [{
  47551. * id: "symbol",
  47552. * source: "sourceId",
  47553. * type: "symbol",
  47554. * symbol: 'point-1'
  47555. * }]
  47556. * })
  47557. * ```
  47558. * **<a id="expression">符号支持的MapboxGL表达式</a>**
  47559. *
  47560. * **[Match](https://docs.mapbox.com/mapbox-gl-js/style-spec/expressions/#match)**
  47561. *
  47562. * ```
  47563. * map.addLayer({
  47564. * id: "symbol",
  47565. * source: "sourceId",
  47566. * type: "symbol",
  47567. * symbol: [
  47568. "match",
  47569. ["get", "DLBM"],
  47570. "011", "line-964458", //公路用地
  47571. "013", "line-964462", //农村道路
  47572. "021", "line-962613", //河流水面
  47573. "023", "line-962613", //河流水面
  47574. "line-962613"
  47575. ]
  47576. * });
  47577. * ```
  47578. * **[Case](https://docs.mapbox.com/mapbox-gl-js/style-spec/expressions/#case)**
  47579. * ```
  47580. * map.addLayer({
  47581. * id: "symbol",
  47582. * source: "sourceId",
  47583. * type: "symbol",
  47584. * symbol: [
  47585. "case",
  47586. ["all", ["<=", ["get", "dMaxZValue"], 70]], "PoPdensity_R_MAX70",
  47587. ["all", [">", ["get", "dMaxZValue"], 70],["<=", ["get", "dMaxZValue"], 140]], "PoPdensity_R_MAX140",
  47588. ["all", [">", ["get", "dMaxZValue"], 140],["<=", ["get", "dMaxZValue"], 210]], "PoPdensity_R_MAX210",
  47589. ["all", [">", ["get", "dMaxZValue"], 210],["<=", ["get", "dMaxZValue"], 280]], "PoPdensity_R_MAX280",
  47590. ["all", [">", ["get", "dMaxZValue"], 280],["<=", ["get", "dMaxZValue"], 350]], "PoPdensity_R_MAX350",
  47591. ["all", [">", ["get", "dMaxZValue"], 350],["<=", ["get", "dMaxZValue"], 420]], "PoPdensity_R_MAX420",
  47592. ["all", [">", ["get", "dMaxZValue"], 420],["<=", ["get", "dMaxZValue"], 490]], "PoPdensity_R_MAX490",
  47593. ["all", [">", ["get", "dMaxZValue"], 490],["<=", ["get", "dMaxZValue"], 560]], "PoPdensity_R_MAX560",
  47594. ["all", [">", ["get", "dMaxZValue"], 560],["<=", ["get", "dMaxZValue"], 640]], "PoPdensity_R_MAX640",
  47595. ["all", [">", ["get", "dMaxZValue"], 640],["<=", ["get", "dMaxZValue"], 700]], "PoPdensity_R_MAX700",
  47596. ["all", [">", ["get", "dMaxZValue"], 700],["<=", ["get", "dMaxZValue"], 770]], "PoPdensity_R_MAX770",
  47597. ["all", [">", ["get", "dMaxZValue"], 770],["<=", ["get", "dMaxZValue"], 1000]], "PoPdensity_R_MAX1000",
  47598. ["all", [">", ["get", "dMaxZValue"], 1000]], "PoPdensity_R_Exceed1000",
  47599. "Country_R"
  47600. ]
  47601. * });
  47602. * ```
  47603. * @usage
  47604. */
  47605. class WebSymbol {
  47606. constructor() {
  47607. /**
  47608. * @member WebSymbol.prototype.defaultBasePath
  47609. * @description 符号资源路径。
  47610. * @private
  47611. */
  47612. this.defaultBasePath = './resources/symbols';
  47613. }
  47614. /**
  47615. * @function WebSymbol.prototype.init
  47616. * @description 初始化Web符号配置。
  47617. * @param {object} config - 配置信息
  47618. * @param {string} [config.basePath] - 指定符号资源路径
  47619. */
  47620. init(config) {
  47621. (external_mapboxgl_default()).Map.prototype.basePath = config && config.basePath || this.defaultBasePath;
  47622. symbol_MapExtendSymbol();
  47623. }
  47624. }
  47625. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/symbol/index.js
  47626. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47627. * This program are made available under the terms of the Apache License, Version 2.0
  47628. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47629. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/index.js
  47630. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47631. * This program are made available under the terms of the Apache License, Version 2.0
  47632. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47633. ;// CONCATENATED MODULE: ./src/common/iServer/GeoCodingParameter.js
  47634. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47635. * This program are made available under the terms of the Apache License, Version 2.0
  47636. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47637. /**
  47638. * @class GeoCodingParameter
  47639. * @deprecatedclass SuperMap.GeoCodingParameter
  47640. * @category iServer AddressMatch
  47641. * @classdesc 地理正向匹配参数类。
  47642. * @param {Object} options - 参数。
  47643. * @param {string} options.address - 地点关键词。
  47644. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  47645. * @param {number} [options.toIndex] - 设置返回对象的结束索引值。
  47646. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  47647. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  47648. * @param {number} [options.maxReturn] - 最大返回结果数。
  47649. * @usage
  47650. */
  47651. class GeoCodingParameter {
  47652. constructor(options) {
  47653. if (options.filters && typeof(options.filters) === 'string') {
  47654. options.filters = options.filters.split(',');
  47655. }
  47656. /**
  47657. * @member {string} GeoCodingParameter.prototype.address
  47658. * @description 地点关键词。
  47659. */
  47660. this.address = null;
  47661. /**
  47662. * @member {number} [GeoCodingParameter.prototype.fromIndex]
  47663. * @description 设置返回对象的起始索引值。
  47664. */
  47665. this.fromIndex = null;
  47666. /**
  47667. * @member {number} [GeoCodingParameter.prototype.toIndex]
  47668. * @description 设置返回对象的结束索引值。
  47669. */
  47670. this.toIndex = null;
  47671. /**
  47672. * @member {Array.<string>} [GeoCodingParameter.prototype.filters]
  47673. * @description 过滤字段,限定查询区域。
  47674. */
  47675. this.filters = null;
  47676. /**
  47677. * @member {string} [GeoCodingParameter.prototype.prjCoordSys]
  47678. * @description 查询结果的坐标系。
  47679. */
  47680. this.prjCoordSys = null;
  47681. /**
  47682. * @member {number} [GeoCodingParameter.prototype.maxReturn]
  47683. * @description 最大返回结果数。
  47684. */
  47685. this.maxReturn = null;
  47686. Util_Util.extend(this, options);
  47687. }
  47688. /**
  47689. * @function GeoCodingParameter.prototype.destroy
  47690. * @description 释放资源,将引用资源的属性置空。
  47691. */
  47692. destroy() {
  47693. this.address = null;
  47694. this.fromIndex = null;
  47695. this.toIndex = null;
  47696. this.filters = null;
  47697. this.prjCoordSys = null;
  47698. this.maxReturn = null;
  47699. }
  47700. }
  47701. ;// CONCATENATED MODULE: ./src/common/iServer/GeoDecodingParameter.js
  47702. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47703. * This program are made available under the terms of the Apache License, Version 2.0
  47704. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47705. /**
  47706. * @class GeoDecodingParameter
  47707. * @deprecatedclass SuperMap.GeoDecodingParameter
  47708. * @category iServer AddressMatch
  47709. * @classdesc 地理反向匹配参数类。
  47710. * @param {Object} options - 参数。
  47711. * @param {number} options.x - 查询位置的横坐标。
  47712. * @param {number} options.y - 查询位置的纵坐标。
  47713. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  47714. * @param {number} [options.toIndex] - 设置返回对象的结束索引值。
  47715. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  47716. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  47717. * @param {number} [options.maxReturn] - 最大返回结果数。
  47718. * @param {number} [options.geoDecodingRadius] - 查询半径。
  47719. * @usage
  47720. */
  47721. class GeoDecodingParameter {
  47722. constructor(options) {
  47723. if (options.filters) {
  47724. options.filters = options.filters.split(',');
  47725. }
  47726. /**
  47727. * @member {number} GeoDecodingParameter.prototype.x
  47728. * @description 查询位置的横坐标。
  47729. */
  47730. this.x = null;
  47731. /**
  47732. * @member {number} GeoDecodingParameter.prototype.y
  47733. * @description 查询位置的纵坐标。
  47734. */
  47735. this.y = null;
  47736. /**
  47737. * @member {number} [GeoDecodingParameter.prototype.fromIndex]
  47738. * @description 设置返回对象的起始索引值。
  47739. */
  47740. this.fromIndex = null;
  47741. /**
  47742. * @member {number} [GeoDecodingParameter.prototype.toIndex]
  47743. * @description 设置返回对象的结束索引值。
  47744. */
  47745. this.toIndex = null;
  47746. /**
  47747. * @member {Array.<string>} [GeoDecodingParameter.prototype.filters]
  47748. * @description 过滤字段,限定查询区域。
  47749. */
  47750. this.filters = null;
  47751. /**
  47752. * @member {string} [GeoDecodingParameter.prototype.prjCoordSys]
  47753. * @description 查询结果的坐标系。
  47754. */
  47755. this.prjCoordSys = null;
  47756. /**
  47757. * @member {number} [GeoDecodingParameter.prototype.maxReturn]
  47758. * @description 最大返回结果数。
  47759. */
  47760. this.maxReturn = null;
  47761. /**
  47762. * @member {number} GeoDecodingParameter.prototype.geoDecodingRadius
  47763. * @description 查询半径。
  47764. */
  47765. this.geoDecodingRadius = null;
  47766. Util_Util.extend(this, options);
  47767. }
  47768. /**
  47769. * @function GeoDecodingParameter.prototype.destroy
  47770. * @description 释放资源,将引用资源的属性置空。
  47771. */
  47772. destroy() {
  47773. this.x = null;
  47774. this.y = null;
  47775. this.fromIndex = null;
  47776. this.toIndex = null;
  47777. this.filters = null;
  47778. this.prjCoordSys = null;
  47779. this.maxReturn = null;
  47780. this.geoDecodingRadius = null;
  47781. }
  47782. }
  47783. ;// CONCATENATED MODULE: ./src/common/iServer/AddressMatchService.js
  47784. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47785. * This program are made available under the terms of the Apache License, Version 2.0
  47786. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47787. /**
  47788. * @class AddressMatchService
  47789. * @deprecatedclass SuperMap.AddressMatchService
  47790. * @category iServer AddressMatch
  47791. * @classdesc 地址匹配服务,包括正向匹配和反向匹配。
  47792. * @param {string} url - 服务地址。
  47793. * @param {Object} options - 可选参数。
  47794. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  47795. * @param {Object} [options.headers] - 请求头。
  47796. * @usage
  47797. */
  47798. class AddressMatchService_AddressMatchService extends CommonServiceBase {
  47799. constructor(url, options) {
  47800. super(url, options);
  47801. this.options = options || {};
  47802. this.eventCount = 0;
  47803. this.CLASS_NAME = 'SuperMap.AddressMatchService';
  47804. }
  47805. /**
  47806. * @function AddressMatchService.prototype.destroy
  47807. * @override
  47808. */
  47809. destroy() {
  47810. super.destroy();
  47811. }
  47812. /**
  47813. * @function AddressMatchService.prototype.code
  47814. * @param {string} url - 正向地址匹配服务地址。
  47815. * @param {GeoCodingParameter} params - 正向地址匹配服务参数。
  47816. */
  47817. code(url, params, callback) {
  47818. if (!(params instanceof GeoCodingParameter)) {
  47819. return;
  47820. }
  47821. this.processAsync(url, params, callback);
  47822. }
  47823. /**
  47824. * @function AddressMatchService.prototype.decode
  47825. * @param {string} url - 反向地址匹配服务地址。
  47826. * @param {GeoDecodingParameter} params - 反向地址匹配服务参数。
  47827. */
  47828. decode(url, params, callback) {
  47829. if (!(params instanceof GeoDecodingParameter)) {
  47830. return;
  47831. }
  47832. this.processAsync(url, params, callback);
  47833. }
  47834. /**
  47835. * @function AddressMatchService.prototype.processAsync
  47836. * @description 负责将客户端的动态分段服务参数传递到服务端。
  47837. * @param {string} url - 服务地址。
  47838. * @param {Object} params - 参数。
  47839. */
  47840. processAsync(url, params, callback) {
  47841. let eventId = ++this.eventCount;
  47842. let eventListeners = {
  47843. scope: this,
  47844. processCompleted: function(result) {
  47845. if (eventId === result.result.eventId && callback) {
  47846. delete result.result.eventId;
  47847. callback(result);
  47848. this.events && this.events.un(eventListeners);
  47849. return false;
  47850. }
  47851. },
  47852. processFailed: function(result) {
  47853. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  47854. callback(result);
  47855. this.events && this.events.un(eventListeners);
  47856. return false;
  47857. }
  47858. }
  47859. }
  47860. this.events.on(eventListeners);
  47861. this.request({
  47862. method: 'GET',
  47863. url,
  47864. params,
  47865. scope: this,
  47866. success(result, options) {
  47867. result.eventId = eventId;
  47868. this.serviceProcessCompleted(result, options);
  47869. },
  47870. failure(result, options) {
  47871. if (result.error) {
  47872. result.error.eventId = eventId;
  47873. }
  47874. result.eventId = eventId;
  47875. this.serviceProcessFailed(result, options);
  47876. }
  47877. });
  47878. }
  47879. /**
  47880. * @function AddressMatchService.prototype.serviceProcessCompleted
  47881. * @param {Object} result - 服务器返回的结果对象。
  47882. * @description 服务流程是否完成
  47883. */
  47884. serviceProcessCompleted(result, options) {
  47885. if (result.succeed) {
  47886. delete result.succeed;
  47887. }
  47888. super.serviceProcessCompleted(result, options);
  47889. }
  47890. /**
  47891. * @function AddressMatchService.prototype.serviceProcessCompleted
  47892. * @param {Object} result - 服务器返回的结果对象。
  47893. * @description 服务流程是否失败
  47894. */
  47895. serviceProcessFailed(result, options) {
  47896. super.serviceProcessFailed(result, options);
  47897. }
  47898. }
  47899. ;// CONCATENATED MODULE: ./src/mapboxgl/services/AddressMatchService.js
  47900. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47901. * This program are made available under the terms of the Apache License, Version 2.0
  47902. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47903. /**
  47904. * @class AddressMatchService
  47905. * @category iServer AddressMatch
  47906. * @classdesc 地址匹配服务类。
  47907. * @modulecategory Services
  47908. * @example
  47909. * new AddressMatchService(url,options)
  47910. * .code(function(result){
  47911. * //doSomething
  47912. * })
  47913. * @param {string} url - 服务地址。
  47914. * @param {Object} options - 参数。
  47915. * @param {string} [options.proxy] - 服务代理地址。
  47916. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  47917. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  47918. * @param {Object} [options.headers] - 请求头。
  47919. * @extends {ServiceBase}
  47920. * @usage
  47921. */
  47922. class AddressMatchService extends ServiceBase {
  47923. constructor(url, options) {
  47924. super(url, options);
  47925. this._addressMatchService = new AddressMatchService_AddressMatchService(url, options);
  47926. }
  47927. /**
  47928. * @function AddressMatchService.prototype.code
  47929. * @description 获取正向地址匹配结果。
  47930. * @param {GeoCodingParameter} params - 正向匹配参数。
  47931. * @param {RequestCallback} callback - 回调函数。
  47932. */
  47933. code(params, callback) {
  47934. this._addressMatchService.code(Util_Util.urlPathAppend(this.url, 'geocoding'), params, callback);
  47935. }
  47936. /**
  47937. * @function AddressMatchService.prototype.decode
  47938. * @description 获取反向地址匹配结果。
  47939. * @param {GeoDecodingParameter} params -反向匹配参数。
  47940. * @param {RequestCallback} callback - 回调函数。
  47941. */
  47942. decode(params, callback) {
  47943. this._addressMatchService.decode(Util_Util.urlPathAppend(this.url, 'geodecoding'), params, callback);
  47944. }
  47945. }
  47946. ;// CONCATENATED MODULE: ./src/common/iServer/QueryParameters.js
  47947. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47948. * This program are made available under the terms of the Apache License, Version 2.0
  47949. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47950. /**
  47951. * @class QueryParameters
  47952. * @deprecatedclass SuperMap.QueryParameters
  47953. * @category iServer Map QueryResults
  47954. * @classdesc 查询参数基类。距离查询、SQL 查询、几何地物查询等各自的参数均继承此类。
  47955. * @param {Object} options - 参数。
  47956. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  47957. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  47958. * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  47959. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  47960. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  47961. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  47962. * @param {number} [options.startRecord=0] - 查询起始记录号。
  47963. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  47964. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  47965. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  47966. * @usage
  47967. */
  47968. class QueryParameters {
  47969. constructor(options) {
  47970. if (!options) {
  47971. return;
  47972. }
  47973. /**
  47974. * @member {string} [QueryParameters.prototype.customParams]
  47975. * @description 自定义参数,供扩展使用。
  47976. */
  47977. this.customParams = null;
  47978. /**
  47979. * @member {Object} [QueryParameters.prototype.prjCoordSys]
  47980. * @description 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}
  47981. */
  47982. this.prjCoordSys = null;
  47983. /**
  47984. * @member {number} [QueryParameters.prototype.expectCount=100000]
  47985. * @description 期望返回结果记录个数,默认返回100000条查询记录,
  47986. * 如果实际不足100000条则返回实际记录条数。
  47987. */
  47988. this.expectCount = 100000;
  47989. /**
  47990. * @member {GeometryType} [QueryParameters.prototype.networkType=GeometryType.LINE]
  47991. * @description 网络数据集对应的查询类型,分为点和线两种类型。
  47992. */
  47993. this.networkType = REST_GeometryType.LINE;
  47994. /**
  47995. * @member {QueryOption} [QueryParameters.prototype.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY]
  47996. * @description 查询结果类型枚举类。
  47997. * 该类描述查询结果返回类型,包括只返回属性、
  47998. * 只返回几何实体以及返回属性和几何实体。
  47999. */
  48000. this.queryOption = QueryOption.ATTRIBUTEANDGEOMETRY;
  48001. /**
  48002. * @member {Array.<FilterParameter>} QueryParameters.prototype.queryParams
  48003. * @description 查询过滤条件参数数组。
  48004. * 该类用于设置查询数据集的查询过滤参数。
  48005. */
  48006. this.queryParams = null;
  48007. /**
  48008. * @member {number} [QueryParameters.prototype.startRecord=0]
  48009. * @description 查询起始记录号。
  48010. */
  48011. this.startRecord = 0;
  48012. /**
  48013. * @member {number} [QueryParameters.prototype.holdTime=10]
  48014. * @description 资源在服务端保存的时间,单位为分钟。
  48015. */
  48016. this.holdTime = 10;
  48017. /**
  48018. * @member {boolean} [QueryParameters.prototype.returnCustomResult=false]
  48019. * @description 仅供三维使用。
  48020. */
  48021. this.returnCustomResult = false;
  48022. /**
  48023. * @member {boolean} [QueryParameters.prototype.returnFeatureWithFieldCaption=false]
  48024. * @description 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  48025. */
  48026. this.returnFeatureWithFieldCaption = false;
  48027. Util_Util.extend(this, options);
  48028. this.CLASS_NAME = "SuperMap.QueryParameters";
  48029. }
  48030. /**
  48031. * @function QueryParameters.prototype.destroy
  48032. * @description 释放资源,将引用资源的属性置空。
  48033. */
  48034. destroy() {
  48035. var me = this;
  48036. me.customParams = null;
  48037. me.expectCount = null;
  48038. me.networkType = null;
  48039. me.queryOption = null;
  48040. if (me.queryParams) {
  48041. for (var i = 0, qps = me.queryParams, len = qps.length; i < len; i++) {
  48042. qps[i].destroy();
  48043. }
  48044. me.queryParams = null;
  48045. }
  48046. me.startRecord = null;
  48047. me.holdTime = null;
  48048. me.returnCustomResult = null;
  48049. me.prjCoordSys = null;
  48050. }
  48051. }
  48052. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryFilterParameter.js
  48053. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48054. * This program are made available under the terms of the Apache License, Version 2.0
  48055. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48056. /**
  48057. * @class ChartQueryFilterParameter
  48058. * @deprecatedclass SuperMap.ChartQueryFilterParameter
  48059. * @category iServer Map Chart
  48060. * @classdesc 海图查询过滤参数类,用于设置海图查询的过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  48061. * @param {Object} options - 参数。
  48062. * @param {string} options.attributeFilter - 属性字段过滤条件。
  48063. * @param {number} options.chartFeatureInfoSpecCode - 查询的物标代号。
  48064. * @param {boolean} [options.isQueryPoint] - 是否查询点。
  48065. * @param {boolean} [options.isQueryLine] - 是否查询线。
  48066. * @param {boolean} [options.isQueryRegion] - 是否查询面。
  48067. * @usage
  48068. */
  48069. class ChartQueryFilterParameter {
  48070. constructor(options) {
  48071. /**
  48072. * @member {boolean} [ChartQueryFilterParameter.prototype.isQueryPoint]
  48073. * @description 是否查询点。
  48074. */
  48075. this.isQueryPoint = null;
  48076. /**
  48077. * @member {boolean} [ChartQueryFilterParameter.prototype.isQueryLine]
  48078. * @description 是否查询线。
  48079. */
  48080. this.isQueryLine = null;
  48081. /**
  48082. * @member {boolean} [ChartQueryFilterParameter.prototype.isQueryRegion]
  48083. * @description 是否查询面。
  48084. */
  48085. this.isQueryRegion = null;
  48086. /**
  48087. * @member {string} ChartQueryFilterParameter.prototype.attributeFilter
  48088. * @description 属性字段过滤条件。
  48089. */
  48090. this.attributeFilter = null;
  48091. /**
  48092. * @member {number} ChartQueryFilterParameter.prototype.chartFeatureInfoSpecCode
  48093. * @description 查询的物标代号。
  48094. */
  48095. this.chartFeatureInfoSpecCode = null;
  48096. Util_Util.extend(this, options);
  48097. this.CLASS_NAME = "SuperMap.ChartQueryFilterParameter";
  48098. }
  48099. /**
  48100. * @function ChartQueryFilterParameter.prototype.destroy
  48101. * @description 释放资源,将引用资源的属性置空。
  48102. */
  48103. destroy() {
  48104. var me = this;
  48105. me.isQueryPoint = null;
  48106. me.isQueryLine = null;
  48107. me.isQueryRegion = null;
  48108. me.attributeFilter = null;
  48109. me.chartFeatureInfoSpecCode = null;
  48110. }
  48111. /**
  48112. * @function ChartQueryFilterParameter.prototype.toJson
  48113. * @description 将属性信息转化成 JSON 格式字符串。
  48114. */
  48115. toJson() {
  48116. var json = "";
  48117. json += "\"isQueryPoint\":" + this.isQueryPoint + ",";
  48118. json += "\"isQueryLine\":" + this.isQueryLine + ",";
  48119. json += "\"isQueryRegion\":" + this.isQueryRegion + ",";
  48120. if (this.attributeFilter) {
  48121. json += "\"attributeFilter\": \"" + this.attributeFilter + "\",";
  48122. }
  48123. json += "\"chartFeatureInfoSpecCode\":" + this.chartFeatureInfoSpecCode;
  48124. json = "{" + json + "}";
  48125. return json;
  48126. }
  48127. }
  48128. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryParameters.js
  48129. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48130. * This program are made available under the terms of the Apache License, Version 2.0
  48131. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48132. /**
  48133. * @class ChartQueryParameters
  48134. * @deprecatedclass SuperMap.ChartQueryParameters
  48135. * @category iServer Map Chart
  48136. * @classdesc 海图查询参数类,该类用于设置海图查询时的相关参数,海图查询分为海图属性查询和海图范围查询两类,通过属性 queryMode 指定查询模式。
  48137. * 必设属性有:queryMode、chartLayerNames、chartQueryFilterParameters。当进行海图范围查询时,必设属性还包括 bounds。
  48138. * @param {Object} options - 参数。
  48139. * @param {string} options.queryMode - 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery")。
  48140. * @param {Array.<string>} options.chartLayerNames - 查询的海图图层的名称。
  48141. * @param {Array.<ChartQueryFilterParameter>} options.chartQueryFilterParameters - 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  48142. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 海图查询范围。当进行海图范围查询时,此为必选参数。
  48143. * @param {boolean} [options.returnContent=true] - 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
  48144. * @param {number} [options.startRecord=0] - 查询起始记录位置。
  48145. * @param {number} [options.expectCount] - 期望查询结果返回的记录数,该值大于0。
  48146. * @usage
  48147. */
  48148. class ChartQueryParameters {
  48149. constructor(options) {
  48150. /**
  48151. * @member {string} ChartQueryParameters.prototype.queryMode
  48152. * @description 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery")。
  48153. */
  48154. this.queryMode = null;
  48155. /**
  48156. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} ChartQueryParameters.prototype.bounds
  48157. * @description 海图查询范围。
  48158. */
  48159. this.bounds = null;
  48160. /**
  48161. * @member {Array.<string>} ChartQueryParameters.prototype.chartLayerNames
  48162. * @description 查询的海图图层的名称。
  48163. */
  48164. this.chartLayerNames = null;
  48165. /**
  48166. * @member {Array.<ChartQueryFilterParameter>} ChartQueryParameters.prototype.chartQueryFilterParameters
  48167. * @description 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  48168. */
  48169. this.chartQueryFilterParameters = null;
  48170. /**
  48171. * @member {boolean} [ChartQueryParameters.prototype.returnContent=true]
  48172. * @description 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
  48173. */
  48174. this.returnContent = true;
  48175. /**
  48176. * @member {number} [ChartQueryParameters.prototype.startRecord=0]
  48177. * @description 查询起始记录位置。
  48178. */
  48179. this.startRecord = 0;
  48180. /**
  48181. * @member {number} [ChartQueryParameters.prototype.expectCount]
  48182. * @description 期望查询结果返回的记录数,该值大于0。
  48183. */
  48184. this.expectCount = null;
  48185. Util_Util.extend(this, options);
  48186. this.CLASS_NAME = "SuperMap.ChartQueryParameters";
  48187. }
  48188. /**
  48189. * @function ChartQueryParameters.prototype.destroy
  48190. * @description 释放资源,将引用资源的属性置空。
  48191. */
  48192. destroy() {
  48193. var me = this;
  48194. me.queryMode = null;
  48195. me.bounds = null;
  48196. me.chartLayerNames = null;
  48197. me.chartQueryFilterParameters = null;
  48198. me.returnContent = true;
  48199. me.startRecord = 0;
  48200. me.expectCount = null;
  48201. }
  48202. /**
  48203. * @function ChartQueryParameters.prototype.getVariablesJson
  48204. * @description 将属性信息转换成能够被服务识别的 JSON 格式字符串。
  48205. * @returns {string} JSON 字符串。
  48206. */
  48207. getVariablesJson() {
  48208. var json = "";
  48209. json += "\"queryMode\":\"" + this.queryMode + "\",";
  48210. if (this.chartLayerNames && this.chartLayerNames.length) {
  48211. var chartLayersArray = [];
  48212. var layerLength = this.chartLayerNames.length;
  48213. for (var i = 0; i < layerLength; i++) {
  48214. chartLayersArray.push("\"" + this.chartLayerNames[i] + "\"");
  48215. }
  48216. var layerNames = "[" + chartLayersArray.join(",") + "]";
  48217. json += "\"chartLayerNames\":" + layerNames + ",";
  48218. }
  48219. if (this.queryMode === "ChartBoundsQuery" && this.bounds) {
  48220. json += "\"bounds\":" + "{" + "\"leftBottom\":" + "{" + "\"x\":" + this.bounds.left + "," +
  48221. "\"y\":" + this.bounds.bottom + "}" + "," + "\"rightTop\":" + "{" + "\"x\":" + this.bounds.right + "," +
  48222. "\"y\":" + this.bounds.top + "}" + "},";
  48223. }
  48224. if (this.chartQueryFilterParameters && this.chartQueryFilterParameters.length) {
  48225. var chartParamArray = [];
  48226. var chartLength = this.chartQueryFilterParameters.length;
  48227. for (var j = 0; j < chartLength; j++) {
  48228. var chartQueryFilterParameter = this.chartQueryFilterParameters[j];
  48229. if (!(chartQueryFilterParameter instanceof ChartQueryFilterParameter)) {
  48230. continue;
  48231. }
  48232. chartParamArray.push(chartQueryFilterParameter.toJson());
  48233. }
  48234. var chartParamsJson = "[" + chartParamArray.join(",") + "]";
  48235. chartParamsJson = "\"chartQueryParams\":" + chartParamsJson + ",";
  48236. chartParamsJson += "\"startRecord\":" + this.startRecord + ",";
  48237. chartParamsJson += "\"expectCount\":" + this.expectCount;
  48238. chartParamsJson = "{" + chartParamsJson + "}";
  48239. json += "\"chartQueryParameters\":" + chartParamsJson;
  48240. }
  48241. json = "{" + json + "}";
  48242. return json;
  48243. }
  48244. }
  48245. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryService.js
  48246. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48247. * This program are made available under the terms of the Apache License, Version 2.0
  48248. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48249. /**
  48250. * @class ChartQueryService
  48251. * @deprecatedclass SuperMap.ChartQueryService
  48252. * @category iServer Map Chart
  48253. * @classdesc 海图查询服务类。该类负责将海图查询所需参数(ChartQueryParameters)传递至服务端,并获取服务端的返回结果。
  48254. * 用户可以通过两种方式获取查询结果:
  48255. * 1.通过 AsyncResponder 类获取(推荐使用);
  48256. * 2.通过监听 QueryEvent.PROCESS_COMPLETE 事件获取。
  48257. * @extends {CommonServiceBase}
  48258. * @param {string} url - 地图查询服务访问地址。如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
  48259. * @param {Object} options - 参数。
  48260. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  48261. * @param {DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为"ISERVER","GEOJSON"。
  48262. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  48263. * @param {Object} [options.headers] - 请求头。
  48264. * @example
  48265. * 下面示例显示了如何进行海图属性查询:
  48266. * var nameArray = ["GB4X0000_52000"];
  48267. * var chartQueryFilterParameter = new ChartQueryFilterParameter({
  48268. * isQueryPoint:true,
  48269. * isQueryLine:true,
  48270. * isQueryRegion:true,
  48271. * attributeFilter:"SmID<10",
  48272. * chartFeatureInfoSpecCode:1
  48273. * });
  48274. *
  48275. * var chartQueryParameters = new ChartQueryParameters({
  48276. * queryMode:"ChartAttributeQuery",
  48277. * chartLayerNames:nameArray,
  48278. * returnContent:true,
  48279. * chartQueryFilterParameters:[chartQueryFilterParameter]
  48280. * });
  48281. *
  48282. * var chartQueryService = new ChartQueryService(url);
  48283. *
  48284. * chartQueryService.events.on({
  48285. * "processCompleted":processCompleted,
  48286. * "processFailed":processFailed
  48287. * });
  48288. * chartQueryService.processAsync(chartQueryParameters);
  48289. * @usage
  48290. */
  48291. class ChartQueryService extends CommonServiceBase {
  48292. constructor(url, options) {
  48293. super(url, options);
  48294. options = options || {};
  48295. /**
  48296. * @member {boolean} ChartQueryService.prototype.returnContent
  48297. * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
  48298. */
  48299. this.returnContent = null;
  48300. /**
  48301. * @member {DataFormat} ChartQueryService.prototype.format
  48302. * @description 查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式
  48303. * 参数格式为"ISERVER","GEOJSON",GEOJSON
  48304. */
  48305. this.format = DataFormat.GEOJSON;
  48306. Util_Util.extend(this, options);
  48307. var me = this;
  48308. if (options.format) {
  48309. me.format = options.format.toUpperCase();
  48310. }
  48311. if (!me.url) {
  48312. return;
  48313. }
  48314. me.url = Util_Util.urlPathAppend(me.url, 'queryResults');
  48315. this.CLASS_NAME = "SuperMap.ChartQueryService";
  48316. }
  48317. /**
  48318. * @function ChartQueryService.prototype.destroy
  48319. * @override
  48320. */
  48321. destroy() {
  48322. var me = this;
  48323. CommonServiceBase.prototype.destroy.apply(this, arguments);
  48324. me.returnContent = null;
  48325. me.format = null;
  48326. }
  48327. /**
  48328. * @function ChartQueryService.prototype.processAsync
  48329. * @description 使用服务地址 URL 实例化 ChartQueryService 对象。
  48330. * @param {ChartQueryParameters} params - 查询参数。
  48331. */
  48332. processAsync(params) {
  48333. //todo重点需要添加代码的地方
  48334. if (!(params instanceof ChartQueryParameters)) {
  48335. return;
  48336. }
  48337. var me = this, jsonParameters;
  48338. me.returnContent = params.returnContent;
  48339. jsonParameters = params.getVariablesJson();
  48340. if (me.returnContent) {
  48341. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  48342. }
  48343. me.request({
  48344. method: "POST",
  48345. data: jsonParameters,
  48346. scope: me,
  48347. success: me.serviceProcessCompleted,
  48348. failure: me.serviceProcessFailed
  48349. });
  48350. }
  48351. /**
  48352. * @function ChartQueryService.prototype.serviceProcessCompleted
  48353. * @description 查询完成,执行此方法。
  48354. * @param {Object} result - 服务器返回的结果对象。
  48355. */
  48356. serviceProcessCompleted(result, options) {
  48357. var me = this;
  48358. result = Util_Util.transformResult(result);
  48359. if (result && result.recordsets && me.format === DataFormat.GEOJSON) {
  48360. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  48361. if (recordsets[i].features) {
  48362. var geoJSONFormat = new GeoJSON();
  48363. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  48364. }
  48365. }
  48366. }
  48367. me.events.triggerEvent("processCompleted", {result: result, options});
  48368. }
  48369. /**
  48370. * @function ChartQueryService.prototype.getQueryParameters
  48371. * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
  48372. * @param {Object} params - JSON 字符串表示的查询参数。
  48373. * @returns {QueryParameters} 返回查询结果
  48374. */
  48375. getQueryParameters(params) {
  48376. return new QueryParameters({
  48377. queryMode: params.queryMode,
  48378. bounds: params.bounds,
  48379. chartLayerNames: params.chartLayerNames,
  48380. chartQueryFilterParameters: params.chartQueryFilterParameters,
  48381. returnContent: params.returnContent
  48382. });
  48383. }
  48384. }
  48385. ;// CONCATENATED MODULE: ./src/common/iServer/ChartFeatureInfoSpecsService.js
  48386. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48387. * This program are made available under the terms of the Apache License, Version 2.0
  48388. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48389. /**
  48390. * @class ChartFeatureInfoSpecsService
  48391. * @deprecatedclass SuperMap.ChartFeatureInfoSpecsService
  48392. * @category iServer Map Chart
  48393. * @classdesc 海图物标信息服务类,通过该服务类可以查询到服务端支持的所有海图物标信息。
  48394. * 用户可以通过两种方式获取查询结果:
  48395. * 一种是通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件;
  48396. * 另一种是使用 AsyncResponder 类实现异步处理。
  48397. * @extends {CommonServiceBase}
  48398. * @param {string} url - 地图(特指海图)服务地址。
  48399. * 如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
  48400. * 发送请求格式类似于:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图/chartFeatureInfoSpecs.json"。
  48401. * @param {Object} options - 参数。
  48402. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  48403. * @param {DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为"ISERVER","GEOJSON"。
  48404. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  48405. * @param {Object} [options.headers] - 请求头。
  48406. * @usage
  48407. */
  48408. class ChartFeatureInfoSpecsService extends CommonServiceBase {
  48409. constructor(url, options) {
  48410. super(url, options);
  48411. this.CLASS_NAME = "SuperMap.ChartFeatureInfoSpecsService";
  48412. }
  48413. /**
  48414. * @function ChartFeatureInfoSpecsService.prototype.destroy
  48415. * @override
  48416. */
  48417. destroy() {
  48418. super.destroy();
  48419. Util_Util.reset(this);
  48420. }
  48421. /**
  48422. * @function ChartFeatureInfoSpecsService.prototype.processAsync
  48423. * @description 根据地图(特指海图)服务地址与服务端完成异步通讯,获取物标信息。
  48424. * 当查询物标信息成功时,将触发 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE
  48425. * 事件。用可以通过户两种方式获取图层信息:
  48426. * 1. 通过 AsyncResponder 类获取(推荐使用);
  48427. * 2. 通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件获取。
  48428. */
  48429. processAsync() {
  48430. var me = this, method = "GET";
  48431. if (!me.isTempLayers) {
  48432. Util_Util.urlPathAppend(me.url,'chartFeatureInfoSpecs');
  48433. }
  48434. me.request({
  48435. method: method,
  48436. params: null,
  48437. scope: me,
  48438. success: me.serviceProcessCompleted,
  48439. failure: me.serviceProcessFailed
  48440. });
  48441. }
  48442. }
  48443. ;// CONCATENATED MODULE: ./src/common/iServer/ChartService.js
  48444. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48445. * This program are made available under the terms of the Apache License, Version 2.0
  48446. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48447. /**
  48448. * @class ChartService
  48449. * @category iServer Map Chart
  48450. * @classdesc 海图服务。
  48451. * @extends {ServiceBase}
  48452. * @example
  48453. * new ChartService(url).queryChart(param,function(result){
  48454. * //doSomething
  48455. * })
  48456. * @param {string} url - 服务地址。
  48457. * @param {Object} options - 参数。
  48458. * @param {string} [options.proxy] - 服务代理地址。
  48459. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  48460. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  48461. * @param {Object} [options.headers] - 请求头。
  48462. * @usage
  48463. */
  48464. class ChartService_ChartService {
  48465. constructor(url, options) {
  48466. this.url = url;
  48467. this.options = options || {};
  48468. }
  48469. /**
  48470. * @function ChartService.prototype.queryChart
  48471. * @description 查询海图服务。
  48472. * @param {ChartQueryParameters} params - 海图查询所需参数类。
  48473. * @param {RequestCallback} callback - 回调函数。
  48474. * @param {DataFormat} resultFormat - 返回结果类型。
  48475. */
  48476. queryChart(params, callback, resultFormat) {
  48477. var me = this,
  48478. param = params,
  48479. format = me._processFormat(resultFormat);
  48480. var chartQueryService = new ChartQueryService(me.url, {
  48481. proxy: me.options.proxy,
  48482. withCredentials: me.options.withCredentials,
  48483. crossOrigin: me.options.crossOrigin,
  48484. headers: me.options.headers,
  48485. eventListeners: {
  48486. scope: me,
  48487. processCompleted: callback,
  48488. processFailed: callback
  48489. },
  48490. format: format
  48491. });
  48492. chartQueryService.processAsync(param);
  48493. }
  48494. /**
  48495. * @function ChartService.prototype.getChartFeatureInfo
  48496. * @description 获取海图物标信息服务。
  48497. * @param {RequestCallback} callback 回调函数。
  48498. */
  48499. getChartFeatureInfo(callback) {
  48500. var me = this;
  48501. var url = Util_Util.urlPathAppend(me.url, 'chartFeatureInfoSpecs');
  48502. var chartFeatureInfoSpecsService = new ChartFeatureInfoSpecsService(url, {
  48503. proxy: me.options.proxy,
  48504. withCredentials: me.options.withCredentials,
  48505. crossOrigin: me.options.crossOrigin,
  48506. headers: me.options.headers,
  48507. eventListeners: {
  48508. scope: me,
  48509. processCompleted: callback,
  48510. processFailed: callback
  48511. }
  48512. });
  48513. chartFeatureInfoSpecsService.processAsync();
  48514. }
  48515. _processFormat(resultFormat) {
  48516. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  48517. }
  48518. }
  48519. ;// CONCATENATED MODULE: ./src/mapboxgl/services/ChartService.js
  48520. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48521. * This program are made available under the terms of the Apache License, Version 2.0
  48522. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48523. /**
  48524. * @class ChartService
  48525. * @category iServer Map Chart
  48526. * @classdesc 海图服务类。
  48527. * @modulecategory Services
  48528. * @extends {ServiceBase}
  48529. * @example
  48530. * new ChartService(url)
  48531. * .queryChart(param,function(result){
  48532. * //doSomething
  48533. * })
  48534. * @param {string} url - 服务地址。
  48535. * @param {Object} options - 参数。
  48536. * @param {string} [options.proxy] - 服务代理地址。
  48537. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  48538. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  48539. * @param {Object} [options.headers] - 请求头。
  48540. * @usage
  48541. */
  48542. class ChartService extends ServiceBase {
  48543. constructor(url, options) {
  48544. super(url, options);
  48545. this._chartService = new ChartService_ChartService(url, options);
  48546. }
  48547. /**
  48548. * @function ChartService.prototype.queryChart
  48549. * @description 查询海图服务。
  48550. * @param {ChartQueryParameters} params - 海图查询参数类。
  48551. * @param {RequestCallback} callback 回调函数。
  48552. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  48553. */
  48554. queryChart(params, callback, resultFormat) {
  48555. this._chartService.queryChart(params, callback, resultFormat);
  48556. }
  48557. /**
  48558. * @function ChartService.prototype.getChartFeatureInfo
  48559. * @description 获取海图物标信息服务。
  48560. * @param {RequestCallback} callback 回调函数。
  48561. */
  48562. getChartFeatureInfo(callback) {
  48563. this._chartService.getChartFeatureInfo(callback);
  48564. }
  48565. _processFormat(resultFormat) {
  48566. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  48567. }
  48568. }
  48569. ;// CONCATENATED MODULE: ./src/common/iServer/DataFlowService.js
  48570. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48571. * This program are made available under the terms of the Apache License, Version 2.0
  48572. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48573. /**
  48574. * @class DataFlowService
  48575. * @deprecatedclass SuperMap.DataFlowService
  48576. * @category iServer DataFlow
  48577. * @classdesc 数据流服务类。
  48578. * @extends {CommonServiceBase}
  48579. * @param {string} url - 数据流服务地址。
  48580. * @param {Object} options - 参数。
  48581. * @param {function} options.style - 设置数据加载样式。
  48582. * @param {function} [options.onEachFeature] - 设置每个数据加载popup等。
  48583. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  48584. * @param {Object} [options.excludeField] - 排除字段。
  48585. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  48586. * @param {Object} [options.headers] - 请求头。
  48587. * @usage
  48588. */
  48589. class DataFlowService_DataFlowService extends CommonServiceBase {
  48590. constructor(url, options) {
  48591. options = options || {};
  48592. /*
  48593. * @constant EVENT_TYPES
  48594. * {Array.<string>}
  48595. * 此类支持的事件类型
  48596. */
  48597. options.EVENT_TYPES = ["broadcastSocketConnected", "broadcastSocketClosed", "broadcastSocketError", "broadcastFailed", "broadcastSucceeded", "subscribeSocketConnected", "subscribeSocketClosed", "subscribeSocketError", "messageSucceeded", "setFilterParamSucceeded"]
  48598. super(url, options);
  48599. /**
  48600. * @member {GeoJSONObject} DataFlowService.prototype.geometry
  48601. * @description 指定几何范围,该范围内的要素才能被订阅。
  48602. */
  48603. this.geometry = null;
  48604. /**
  48605. * @member {Object} DataFlowService.prototype.prjCoordSys
  48606. * @description 动态投影参数。
  48607. */
  48608. this.prjCoordSys = null;
  48609. /**
  48610. * @member {Object} DataFlowService.prototype.excludeField
  48611. * @description 排除字段。
  48612. */
  48613. this.excludeField = null;
  48614. Util_Util.extend(this, options);
  48615. this.CLASS_NAME = "SuperMap.DataFlowService";
  48616. }
  48617. /**
  48618. * @function DataFlowService.prototype.initBroadcast
  48619. * @description 初始化广播。
  48620. * @returns {DataFlowService}
  48621. */
  48622. initBroadcast() {
  48623. var me = this;
  48624. this.broadcastWebSocket = this._connect(Util_Util.urlPathAppend(me.url, 'broadcast'));
  48625. this.broadcastWebSocket.onopen = function (e) {
  48626. me.broadcastWebSocket.isOpen = true;
  48627. e.eventType = 'broadcastSocketConnected';
  48628. me.events.triggerEvent('broadcastSocketConnected', e);
  48629. };
  48630. this.broadcastWebSocket.onclose = function (e) {
  48631. if (me.broadcastWebSocket) {
  48632. me.broadcastWebSocket.isOpen = false;
  48633. }
  48634. e.eventType = 'broadcastSocketClosed';
  48635. me.events.triggerEvent('broadcastSocketClosed', e);
  48636. };
  48637. this.broadcastWebSocket.onerror = function (e) {
  48638. e.eventType = 'broadcastSocketError';
  48639. me.events.triggerEvent('broadcastSocketError', e);
  48640. };
  48641. return this;
  48642. }
  48643. /**
  48644. * @function DataFlowService.prototype.broadcast
  48645. * @description 加载广播数据。
  48646. * @param {GeoJSONObject} geoJSONFeature - JSON 格式的要素数据。
  48647. */
  48648. broadcast(geoJSONFeature) {
  48649. if (!this.broadcastWebSocket||!this.broadcastWebSocket.isOpen) {
  48650. this.events.triggerEvent('broadcastFailed');
  48651. return;
  48652. }
  48653. this.broadcastWebSocket.send(JSON.stringify(geoJSONFeature));
  48654. this.events.triggerEvent('broadcastSucceeded');
  48655. }
  48656. /**
  48657. * @function DataFlowService.prototype.initSubscribe
  48658. * @description 初始化订阅数据。
  48659. * @returns {DataFlowService} DataFlowService的实例对象。
  48660. */
  48661. initSubscribe() {
  48662. var me = this;
  48663. this.subscribeWebSocket = this._connect(Util_Util.urlPathAppend(me.url, 'subscribe'));
  48664. this.subscribeWebSocket.onopen = function (e) {
  48665. me.subscribeWebSocket.send(me._getFilterParams());
  48666. e.eventType = 'subscribeSocketConnected';
  48667. me.events.triggerEvent('subscribeSocketConnected', e);
  48668. };
  48669. this.subscribeWebSocket.onclose = function (e) {
  48670. e.eventType = 'subscribeWebSocketClosed';
  48671. me.events.triggerEvent('subscribeWebSocketClosed', e);
  48672. };
  48673. this.subscribeWebSocket.onerror = function (e) {
  48674. e.eventType = 'subscribeSocketError';
  48675. me.events.triggerEvent('subscribeSocketError', e);
  48676. };
  48677. this.subscribeWebSocket.onmessage = function (e) {
  48678. me._onMessage(e);
  48679. };
  48680. return this;
  48681. }
  48682. /**
  48683. * @function DataFlowService.prototype.setExcludeField
  48684. * @description 设置排除字段。
  48685. * @param {Object} excludeField - 排除字段。
  48686. * @returns {DataFlowService} DataFlowService的实例对象。
  48687. */
  48688. setExcludeField(excludeField) {
  48689. this.excludeField = excludeField;
  48690. this.subscribeWebSocket.send(this._getFilterParams());
  48691. return this;
  48692. }
  48693. /**
  48694. * @function DataFlowService.prototype.setGeometry
  48695. * @description 设置添加的几何要素数据。
  48696. * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
  48697. * @returns {DataFlowService} DataFlowService的实例对象。
  48698. */
  48699. setGeometry(geometry) {
  48700. this.geometry = geometry;
  48701. this.subscribeWebSocket.send(this._getFilterParams());
  48702. return this;
  48703. }
  48704. /**
  48705. * @function DataFlowService.prototype.unSubscribe
  48706. * @description 结束订阅数据。
  48707. */
  48708. unSubscribe() {
  48709. if (!this.subscribeWebSocket) {
  48710. return;
  48711. }
  48712. this.subscribeWebSocket.close();
  48713. this.subscribeWebSocket = null;
  48714. }
  48715. /**
  48716. * @function DataFlowService.prototype.unBroadcast
  48717. * @description 结束加载广播。
  48718. */
  48719. unBroadcast() {
  48720. if (!this.broadcastWebSocket) {
  48721. return;
  48722. }
  48723. this.broadcastWebSocket.close();
  48724. this.broadcastWebSocket = null;
  48725. }
  48726. /**
  48727. * @function DataFlowService.prototype.destroy
  48728. * @override
  48729. */
  48730. destroy() {
  48731. CommonServiceBase.prototype.destroy.apply(this, arguments);
  48732. var me = this;
  48733. me.geometry = null;
  48734. me.prjCoordSys = null;
  48735. me.excludeField = null;
  48736. this.unBroadcast();
  48737. this.unSubscribe();
  48738. }
  48739. _getFilterParams() {
  48740. var filter = {
  48741. filterParam: {
  48742. prjCoordSys: this.prjCoordSys,
  48743. excludeField: this.excludeField,
  48744. geometry: this.geometry
  48745. }
  48746. };
  48747. return Util_Util.toJSON(filter);
  48748. }
  48749. _onMessage(e) {
  48750. if (e.data && e.data.indexOf("filterParam") >= 0) {
  48751. var filterParam = JSON.parse(e.data);
  48752. e.filterParam = filterParam;
  48753. e.eventType = 'setFilterParamSucceeded';
  48754. this.events.triggerEvent('setFilterParamSucceeded', e);
  48755. return;
  48756. }
  48757. var feature = JSON.parse(e.data);
  48758. e.featureResult = feature;
  48759. e.eventType = 'messageSucceeded';
  48760. this.events.triggerEvent('messageSucceeded', e);
  48761. }
  48762. _connect(url) {
  48763. url = SecurityManager.appendCredential(url);
  48764. if ("WebSocket" in window) {
  48765. return new WebSocket(url);
  48766. } else if ("MozWebSocket" in window) {
  48767. var mozWebSocket = window.MozWebSocket;
  48768. return new mozWebSocket(url);
  48769. } else {
  48770. console.log("no WebSocket");
  48771. return null;
  48772. }
  48773. }
  48774. }
  48775. ;// CONCATENATED MODULE: ./src/mapboxgl/services/DataFlowService.js
  48776. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48777. * This program are made available under the terms of the Apache License, Version 2.0
  48778. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48779. /**
  48780. * @class DataFlowService
  48781. * @category iServer DataFlow
  48782. * @classdesc 数据流服务类。
  48783. * @modulecategory Services
  48784. * @extends {ServiceBase}
  48785. * @example
  48786. * new DataFlowService(url)
  48787. * .queryChart(param,function(result){
  48788. * //doSomething
  48789. * })
  48790. * @param {string} url - 服务地址。
  48791. * @param {Object} options - 参数。
  48792. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  48793. * @param {Object} [options.excludeField] - 排除字段。
  48794. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  48795. * @param {Object} [options.headers] - 请求头。
  48796. * @fires DataFlowService#broadcastSocketConnected
  48797. * @fires DataFlowService#broadcastSocketError
  48798. * @fires DataFlowService#broadcastFailed
  48799. * @fires DataFlowService#broadcastSucceeded
  48800. * @fires DataFlowService#subscribeSocketError
  48801. * @fires DataFlowService#messageSucceeded
  48802. * @fires DataFlowService#setFilterParamSucceeded
  48803. * @usage
  48804. */
  48805. class DataFlowService extends ServiceBase {
  48806. constructor(url, options) {
  48807. options = options || {};
  48808. if (options.projection) {
  48809. options.prjCoordSys = options.projection;
  48810. }
  48811. super(url, options);
  48812. this.dataFlow = new DataFlowService_DataFlowService(url, options);
  48813. /**
  48814. * @event DataFlowService#broadcastSocketConnected
  48815. * @description broadcast Socket 连接成功。
  48816. */
  48817. /**
  48818. * @event DataFlowService#broadcastSocketError
  48819. * @description broadcast Socket 连接失败。
  48820. */
  48821. /**
  48822. * @event DataFlowService#broadcastFailed
  48823. * @description 广播失败。
  48824. */
  48825. /**
  48826. * @event DataFlowService#broadcastSucceeded
  48827. * @description 广播成功。
  48828. */
  48829. /**
  48830. * @event DataFlowService#subscribeSocketConnected
  48831. * @description 订阅数据连接成功。
  48832. */
  48833. /**
  48834. * @event DataFlowService#subscribeSocketError
  48835. * @description 订阅数据连接失败。
  48836. */
  48837. /**
  48838. * @event DataFlowService#messageSucceeded
  48839. * @description 获取信息成功。
  48840. */
  48841. /**
  48842. * @event DataFlowService#setFilterParamSucceeded
  48843. * @description 设置过滤参数成功。
  48844. */
  48845. this.dataFlow.events.on({
  48846. "broadcastSocketConnected": this._defaultEvent,
  48847. "broadcastSocketError": this._defaultEvent,
  48848. "broadcastFailed": this._defaultEvent,
  48849. "broadcastSucceeded": this._defaultEvent,
  48850. "subscribeSocketConnected": this._defaultEvent,
  48851. "subscribeSocketError": this._defaultEvent,
  48852. "messageSucceeded": this._defaultEvent,
  48853. "setFilterParamSucceeded": this._defaultEvent,
  48854. scope: this
  48855. });
  48856. var me = this;
  48857. me.on('subscribeSocketConnected', function (e) {
  48858. /**
  48859. * @event DataFlowService#subscribesucceeded
  48860. * @description 数据流服务订阅成功后触发。
  48861. * @property {Object} e - 事件对象。
  48862. */
  48863. me.fire('subscribesucceeded', e);
  48864. })
  48865. }
  48866. /**
  48867. * @function DataFlowService.prototype.initBroadcast
  48868. * @description 初始化广播。
  48869. * @returns {DataFlowService}
  48870. */
  48871. initBroadcast() {
  48872. this.dataFlow.initBroadcast();
  48873. return this;
  48874. }
  48875. /**
  48876. * @function DataFlowService.prototype.broadcast
  48877. * @description 加载广播数据。
  48878. * @param {JSONObject} obj - 要素数据。
  48879. */
  48880. broadcast(obj) {
  48881. this.dataFlow.broadcast(obj);
  48882. }
  48883. /**
  48884. * @function DataFlowService.prototype.initSubscribe
  48885. * @description 初始化订阅数据。
  48886. */
  48887. initSubscribe() {
  48888. this.dataFlow.initSubscribe();
  48889. return this;
  48890. }
  48891. /**
  48892. * @function DataFlowService.prototype.setExcludeField
  48893. * @description 设置排除字段。
  48894. * @param {Object} excludeField - 排除字段。
  48895. */
  48896. setExcludeField(excludeField) {
  48897. this.dataFlow.setExcludeField(excludeField);
  48898. this.options.excludeField = excludeField;
  48899. return this;
  48900. }
  48901. /**
  48902. * @function DataFlowService.prototype.setGeometry
  48903. * @description 设置添加的几何要素数据。
  48904. * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
  48905. */
  48906. setGeometry(geometry) {
  48907. this.dataFlow.setGeometry(geometry);
  48908. this.options.geometry = geometry;
  48909. return this;
  48910. }
  48911. /**
  48912. * @function DataFlowService.prototype.unSubscribe
  48913. * @description 结束订阅数据。
  48914. */
  48915. unSubscribe() {
  48916. this.dataFlow.unSubscribe();
  48917. }
  48918. /**
  48919. * @function DataFlowService.prototype.unBroadcast
  48920. * @description 结束加载广播。
  48921. */
  48922. unBroadcast() {
  48923. this.dataFlow.unBroadcast();
  48924. }
  48925. _defaultEvent(e) {
  48926. this.fire(e.eventType || e.type, e);
  48927. }
  48928. }
  48929. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetService.js
  48930. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48931. * This program are made available under the terms of the Apache License, Version 2.0
  48932. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48933. /**
  48934. * @class DatasetService
  48935. * @deprecatedclass SuperMap.DatasetService
  48936. * @category iServer Data Dataset
  48937. * @classdesc 数据集查询服务。
  48938. * @param {string} url - 服务的访问地址。如访问World Data服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  48939. * @param {Object} options - 参数。
  48940. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  48941. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  48942. * @param {string}options.datasource - 数据源名称。
  48943. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  48944. * @param {Object} [options.headers] - 请求头。
  48945. * @usage
  48946. */
  48947. class DatasetService_DatasetService extends CommonServiceBase {
  48948. constructor(url, options) {
  48949. super(url, options);
  48950. if(!options){
  48951. return;
  48952. }
  48953. /**
  48954. * @member {string} DatasetService.prototype.datasource
  48955. * @description 要查询的数据集所在的数据源名称。
  48956. */
  48957. this.datasource = null;
  48958. /**
  48959. * @member {string} DatasetService.prototype.dataset
  48960. * @description 要查询的数据集名称。
  48961. */
  48962. this.dataset = null;
  48963. this.eventCount = 0;
  48964. if (options) {
  48965. Util_Util.extend(this, options);
  48966. }
  48967. this.CLASS_NAME = "SuperMap.DatasetService";
  48968. }
  48969. /**
  48970. * @function DatasetService.prototype.destroy
  48971. * @override
  48972. */
  48973. destroy() {
  48974. super.destroy();
  48975. var me = this;
  48976. me.datasource = null;
  48977. me.dataset = null;
  48978. }
  48979. /**
  48980. * @function DatasetService.prototype.getDatasetsService
  48981. * @description 执行服务,查询数据集服务。
  48982. */
  48983. getDatasetsService(params, callback) {
  48984. const url = Util_Util.urlPathAppend(this.url,`datasources/name/${params}/datasets`);
  48985. this.processAsync(url, 'GET', callback);
  48986. }
  48987. /**
  48988. * @function DatasetService.prototype.getDatasetService
  48989. * @description 执行服务,查询数据集信息服务。
  48990. */
  48991. getDatasetService(datasourceName, datasetName, callback) {
  48992. const url = Util_Util.urlPathAppend(this.url,`datasources/name/${datasourceName}/datasets/name/${datasetName}`);
  48993. this.processAsync(url, 'GET', callback);
  48994. }
  48995. /**
  48996. * @function DatasetService.prototype.setDatasetService
  48997. * @description 执行服务,更改数据集信息服务。
  48998. */
  48999. setDatasetService(params, callback) {
  49000. if (!params) {
  49001. return;
  49002. }
  49003. const url = Util_Util.urlPathAppend(this.url, `datasources/name/${params.datasourceName}/datasets/name/${params.datasetName}`);
  49004. delete params.datasourceName;
  49005. this.processAsync(url, 'PUT', callback, params);
  49006. }
  49007. /**
  49008. * @function DatasetService.prototype.deleteDatasetService
  49009. * @description 执行服务,删除数据集信息服务。
  49010. */
  49011. deleteDatasetService(datasourceName, datasetName, callback) {
  49012. const url = Util_Util.urlPathAppend(this.url, `datasources/name/${datasourceName}/datasets/name/${datasetName}`);
  49013. this.processAsync(url, 'DELETE', callback);
  49014. }
  49015. processAsync(url, method, callback, params) {
  49016. let eventId = ++this.eventCount;
  49017. let eventListeners = {
  49018. scope: this,
  49019. processCompleted: function(result) {
  49020. if (eventId === result.result.eventId && callback) {
  49021. delete result.result.eventId;
  49022. callback(result);
  49023. this.events && this.events.un(eventListeners);
  49024. return false;
  49025. }
  49026. },
  49027. processFailed: function(result) {
  49028. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  49029. callback(result);
  49030. this.events && this.events.un(eventListeners);
  49031. return false;
  49032. }
  49033. }
  49034. }
  49035. this.events.on(eventListeners);
  49036. var me = this;
  49037. let requestConfig = {
  49038. url,
  49039. method,
  49040. scope: me,
  49041. success(result, options) {
  49042. result.eventId = eventId;
  49043. me.serviceProcessCompleted(result, options);
  49044. },
  49045. failure(result, options) {
  49046. if (result.error) {
  49047. result.error.eventId = eventId;
  49048. }
  49049. result.eventId = eventId;
  49050. me.serviceProcessFailed(result, options);
  49051. }
  49052. }
  49053. params && (requestConfig.data = Util_Util.toJSON(params));
  49054. me.request(requestConfig);
  49055. }
  49056. }
  49057. ;// CONCATENATED MODULE: ./src/common/iServer/CreateDatasetParameters.js
  49058. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49059. * This program are made available under the terms of the Apache License, Version 2.0
  49060. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49061. /**
  49062. * @class CreateDatasetParameters
  49063. * @deprecatedclass SuperMap.CreateDatasetParameters
  49064. * @category iServer Data Dataset
  49065. * @classdesc 数据集创建参数类。
  49066. * @param {Object} options - 参数。
  49067. * @param {string} options.datasourceName - 数据源名称,此为必选参数。
  49068. * @param {string} options.datasetName - 数据集名称,此为必选参数。
  49069. * @param {string} options.datasetType - 数据集类型。目前支持创建的数据集类型有:点、线、面、文本、复合(CAD)和属性数据集。
  49070. * @usage
  49071. */
  49072. class CreateDatasetParameters {
  49073. constructor(options) {
  49074. if (!options) {
  49075. return;
  49076. }
  49077. /**
  49078. * @member {string} CreateDatasetParameters.prototype.datasourceName
  49079. * @description 数据源名称,此为必选参数。
  49080. */
  49081. this.datasourceName = null;
  49082. /**
  49083. * @member {string} CreateDatasetParameters.prototype.datasetName
  49084. * @description 数据集名称,此为必选参数。
  49085. */
  49086. this.datasetName = null;
  49087. /**
  49088. * @member {string} CreateDatasetParameters.prototype.datasetType
  49089. * @description 数据集类型。目前支持创建的数据集类型有:点、线、面、文本、复合(CAD)和属性数据集。
  49090. */
  49091. this.datasetType = null;
  49092. if (options) {
  49093. Util_Util.extend(this, options);
  49094. }
  49095. this.CLASS_NAME = "SuperMap.CreateDatasetParameters";
  49096. }
  49097. /**
  49098. * @function CreateDatasetParameters.prototype.destroy
  49099. * @description 释放资源,将引用资源的属性置空。
  49100. */
  49101. destroy() {
  49102. var me = this;
  49103. me.datasourceName = null;
  49104. me.datasetName = null;
  49105. me.datasetType = null;
  49106. }
  49107. }
  49108. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateDatasetParameters.js
  49109. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49110. * This program are made available under the terms of the Apache License, Version 2.0
  49111. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49112. /**
  49113. * @class UpdateDatasetParameters
  49114. * @deprecatedclass SuperMap.UpdateDatasetParameters
  49115. * @category iServer Data Dataset
  49116. * @classdesc 数据集信息更改参数类。
  49117. * @param {Object} options - 参数。
  49118. * @param {string} options.datasourceName - 数据源名称。
  49119. * @param {string} options.datasetName - 数据集名称。
  49120. * @param {boolean} options.isFileCache - 是否使用文件形式的缓存。仅对数据库型数据源中的矢量数据集有效。
  49121. * @param {string} options.description - 数据集描述信息。
  49122. * @param {string} options.prjCoordSys - 投影坐标系。
  49123. * @param {Object} options.charset - 矢量数据集的字符集。当数据集类型为矢量数据集时,可以传递此参数。如果用户传递空值,则编码方式保持不变。
  49124. * @param {Array.<string>} options.palette - 影像数据的颜色调色板。当数据集类型为影像数据集时,可以传递此参数。
  49125. * @param {number} options.noValue - 栅格数据集中没有数据的像元的栅格值。当数据集类型为栅格数据集时,可以传递此参数。
  49126. * @usage
  49127. */
  49128. class UpdateDatasetParameters {
  49129. constructor(options) {
  49130. if (!options) {
  49131. return;
  49132. }
  49133. /**
  49134. * @member {string} UpdateDatasetParameters.prototype.datasourceName
  49135. * @description 数据源名称。
  49136. */
  49137. this.datasourceName = null;
  49138. /**
  49139. * @member {string} UpdateDatasetParameters.prototype.datasetName
  49140. * @description 数据集名称。
  49141. */
  49142. this.datasetName = null;
  49143. /**
  49144. * @member {boolean} UpdateDatasetParameters.prototype.isFileCache
  49145. * @description 是否使用文件形式的缓存。仅对数据库型数据源中的矢量数据集有效。
  49146. */
  49147. this.isFileCache = null;
  49148. /**
  49149. * @member {string} UpdateDatasetParameters.prototype.description
  49150. * @description 数据集描述信息。
  49151. */
  49152. this.description = null;
  49153. /**
  49154. * @member {string} UpdateDatasetParameters.prototype.prjCoordSys
  49155. * @description 投影坐标系。
  49156. */
  49157. this.prjCoordSys = null;
  49158. /**
  49159. * @member {Object} UpdateDatasetParameters.prototype.charset
  49160. * @description 矢量数据集的字符集。
  49161. */
  49162. this.charset = null;
  49163. /**
  49164. * @member {Array.<string>} UpdateDatasetParameters.prototype.palette
  49165. * @description 影像数据的颜色调色板。
  49166. */
  49167. this.palette = null;
  49168. /**
  49169. * @member {number} UpdateDatasetParameters.prototype.noValue
  49170. * @description 栅格数据集中没有数据的像元的栅格值。
  49171. */
  49172. this.noValue = null;
  49173. if (options) {
  49174. Util_Util.extend(this, options);
  49175. }
  49176. this.CLASS_NAME = "SuperMap.UpdateDatasetParameters";
  49177. }
  49178. /**
  49179. * @function UpdateDatasetParameters.prototype.destroy
  49180. * @description 释放资源,将引用资源的属性置空。
  49181. */
  49182. destroy() {
  49183. var me = this;
  49184. me.datasourceName = null;
  49185. me.datasetName = null;
  49186. me.isFileCache = null;
  49187. me.prjCoordSys = null;
  49188. me.charset = null;
  49189. me.palette = null;
  49190. me.noValue = null;
  49191. }
  49192. }
  49193. ;// CONCATENATED MODULE: ./src/mapboxgl/services/DatasetService.js
  49194. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49195. * This program are made available under the terms of the Apache License, Version 2.0
  49196. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49197. /**
  49198. * @class DatasetService
  49199. * @category iServer Data Dataset
  49200. * @classdesc 数据集信息服务类。
  49201. * @modulecategory Services
  49202. * @param {string} url - 服务地址。
  49203. * @param {Object} options - 参数。
  49204. * @param {string} [options.proxy] - 服务代理地址。
  49205. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  49206. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  49207. * @param {Object} [options.headers] - 请求头。
  49208. * @extends {ServiceBase}
  49209. * @usage
  49210. */
  49211. class DatasetService extends ServiceBase {
  49212. constructor(url, options) {
  49213. super(url, options);
  49214. this._datasetService = new DatasetService_DatasetService(this.url, {
  49215. proxy: this.options.proxy,
  49216. withCredentials: this.options.withCredentials,
  49217. crossOrigin: this.options.crossOrigin,
  49218. headers: this.options.headers
  49219. });
  49220. }
  49221. /**
  49222. * @function DatasetService.prototype.getDatasets
  49223. * @description 数据集查询服务。
  49224. * @example
  49225. * new DatasetService(url).getDatasets(datasourceName,function(result){
  49226. * //doSomething
  49227. * });
  49228. * @param {string} datasourceName - 数据源名称。
  49229. * @param {RequestCallback} callback - 回调函数。
  49230. */
  49231. getDatasets(datasourceName, callback) {
  49232. if (!datasourceName) {
  49233. return;
  49234. }
  49235. this._datasetService.getDatasetsService(datasourceName, callback);
  49236. }
  49237. /**
  49238. * @function DatasetService.prototype.getDataset
  49239. * @description 数据集查询服务。
  49240. * @example
  49241. * new DatasetService(url).getDataset(datasourceName, datasetName, function(result){
  49242. * //doSomething
  49243. * });
  49244. * @param {string} datasourceName - 数据源名称。
  49245. * @param {string} datasetName - 数据集名称。
  49246. * @param {RequestCallback} callback - 回调函数。
  49247. */
  49248. getDataset(datasourceName, datasetName, callback) {
  49249. if (!datasourceName || !datasetName) {
  49250. return;
  49251. }
  49252. this._datasetService.getDatasetService(datasourceName, datasetName, callback);
  49253. }
  49254. /**
  49255. * @function DatasetService.prototype.setDataset
  49256. * @description 数据集信息设置服务。可实现修改已存在数据集,新增不存在数据集。
  49257. * @example
  49258. * new DatasetService(url).setDataset(params, function(result){
  49259. * //doSomething
  49260. * });
  49261. * @param {CreateDatasetParameters|UpdateDatasetParameters} params - 数据集创建参数类或数据集信息更改参数类。
  49262. * @param {RequestCallback} callback - 回调函数。
  49263. */
  49264. setDataset(params, callback) {
  49265. if(!(params instanceof CreateDatasetParameters) && !(params instanceof UpdateDatasetParameters)){
  49266. return;
  49267. }else if (params instanceof CreateDatasetParameters) {
  49268. var datasetParams = {
  49269. "datasetType": params.datasetType,
  49270. "datasetName": params.datasetName,
  49271. "datasourceName": params.datasourceName
  49272. }
  49273. }else if(params instanceof UpdateDatasetParameters){
  49274. datasetParams = {
  49275. "datasetName": params.datasetName,
  49276. "datasourceName": params.datasourceName,
  49277. "isFileCache": params.isFileCache,
  49278. "description": params.description,
  49279. "prjCoordSys": params.prjCoordSys,
  49280. "charset": params.charset
  49281. }
  49282. }
  49283. this._datasetService.setDatasetService(datasetParams, callback);
  49284. }
  49285. /**
  49286. * @function DatasetService.prototype.deleteDataset
  49287. * @description 指定数据源下的数据集删除服务。
  49288. * @example
  49289. * new DatasetService(url).deleteDataset(datasourceName, datasetName, function(result){
  49290. * //doSomething
  49291. * });
  49292. * @param {string} datasourceName - 数据源名称。
  49293. * @param {string} datasetName - 数据集名称。
  49294. * @param {RequestCallback} callback - 回调函数。
  49295. */
  49296. deleteDataset(datasourceName, datasetName, callback) {
  49297. this._datasetService.deleteDatasetService(datasourceName, datasetName, callback);
  49298. }
  49299. }
  49300. ;// CONCATENATED MODULE: ./src/common/iServer/SetDatasourceParameters.js
  49301. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49302. * This program are made available under the terms of the Apache License, Version 2.0
  49303. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49304. /**
  49305. * @class SetDatasourceParameters
  49306. * @deprecatedclass SuperMap.SetDatasourceParameters
  49307. * @category iServer Data Datasource
  49308. * @classdesc 设置数据源信息参数类。
  49309. * @param {Object} options - 参数。
  49310. * @param {string} options.datasourceName - 数据源名称。
  49311. * @param {string} options.description - 数据源描述信息。
  49312. * @param {string} options.coordUnit - 坐标单位。
  49313. * @param {string} options.distanceUnit - 距离单位。
  49314. * @usage
  49315. */
  49316. class SetDatasourceParameters {
  49317. constructor(options) {
  49318. if (!options) {
  49319. return;
  49320. }
  49321. /**
  49322. * @member {string} SetDatasourceParameters.prototype.datasourceName
  49323. * @description 数据源名称。
  49324. */
  49325. this.datasourceName = null;
  49326. /**
  49327. * @member {string} SetDatasourceParameters.prototype.description
  49328. * @description 数据源描述信息。
  49329. */
  49330. this.description = null;
  49331. /**
  49332. * @member {string} SetDatasourceParameters.prototype.coordUnit
  49333. * @description 坐标单位。
  49334. */
  49335. this.coordUnit = null;
  49336. /**
  49337. * @member {string} SetDatasourceParameters.prototype.distanceUnit
  49338. * @description 距离单位。
  49339. */
  49340. this.distanceUnit = null;
  49341. if (options) {
  49342. Util_Util.extend(this, options);
  49343. }
  49344. this.CLASS_NAME = "SuperMap.SetDatasourceParameters";
  49345. }
  49346. /**
  49347. * @function SetDatasourceParameters.prototype.destroy
  49348. * @description 释放资源,将引用资源的属性置空。
  49349. */
  49350. destroy() {
  49351. var me = this;
  49352. me.datasourceName = null;
  49353. me.description = null;
  49354. me.coordUnit = null;
  49355. me.distanceUnit = null;
  49356. }
  49357. }
  49358. ;// CONCATENATED MODULE: ./src/common/iServer/DatasourceService.js
  49359. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49360. * This program are made available under the terms of the Apache License, Version 2.0
  49361. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49362. /**
  49363. * @class DatasourceService
  49364. * @deprecatedclass SuperMap.DatasourceService
  49365. * @category iServer Data Datasource
  49366. * @classdesc 数据源查询服务类。
  49367. * @param {string} url - 服务地址。如访问World Data服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  49368. * @param {Object} options - 参数。
  49369. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  49370. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  49371. * @param {string} options.datasource - 要查询的数据集所在的数据源名称。
  49372. * @param {string} options.dataset - 要查询的数据集名称。
  49373. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  49374. * @param {Object} [options.headers] - 请求头。
  49375. * @extends {CommonServiceBase}
  49376. * @usage
  49377. */
  49378. class DatasourceService_DatasourceService extends CommonServiceBase {
  49379. constructor(url, options) {
  49380. super(url, options);
  49381. if (options) {
  49382. Util_Util.extend(this, options);
  49383. }
  49384. this.eventCount = 0;
  49385. this.CLASS_NAME = "SuperMap.DatasourceService";
  49386. }
  49387. /**
  49388. * @function DatasourceService.prototype.destroy
  49389. * @override
  49390. */
  49391. destroy() {
  49392. this.eventCount = 0;
  49393. super.destroy();
  49394. }
  49395. /**
  49396. * @function DatasourceService.prototype.getDatasourceService
  49397. * @description 获取指定数据源信息。
  49398. */
  49399. getDatasourceService(datasourceName, callback) {
  49400. let url = Util_Util.urlPathAppend(this.url,`datasources/name/${datasourceName}`);
  49401. this.processAsync(url, "GET", callback);
  49402. }
  49403. /**
  49404. * @function DatasourceService.prototype.getDatasourcesService
  49405. * @description 获取所有数据源信息。
  49406. */
  49407. getDatasourcesService(callback) {
  49408. let url = Util_Util.urlPathAppend(this.url,`datasources`);
  49409. this.processAsync(url, "GET", callback);
  49410. }
  49411. /**
  49412. * @function DatasourceService.prototype.setDatasourceService
  49413. * @description 更新数据源信息。
  49414. */
  49415. setDatasourceService(params, callback) {
  49416. if (!params) {
  49417. return;
  49418. }
  49419. const url = Util_Util.urlPathAppend(this.url,`datasources/name/${params.datasourceName}`);
  49420. this.processAsync(url, "PUT", callback, params);
  49421. }
  49422. processAsync(url, method, callback, params) {
  49423. let eventId = ++this.eventCount;
  49424. let eventListeners = {
  49425. scope: this,
  49426. processCompleted: function(result) {
  49427. if (eventId === result.result.eventId && callback) {
  49428. delete result.result.eventId;
  49429. callback(result);
  49430. this.events && this.events.un(eventListeners);
  49431. return false;
  49432. }
  49433. },
  49434. processFailed: function(result) {
  49435. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  49436. callback(result);
  49437. this.events && this.events.un(eventListeners);
  49438. return false;
  49439. }
  49440. }
  49441. }
  49442. this.events.on(eventListeners);
  49443. var me = this;
  49444. let requestConfig = {
  49445. url,
  49446. method,
  49447. scope: me,
  49448. success(result, options) {
  49449. result.eventId = eventId;
  49450. this.serviceProcessCompleted(result, options);
  49451. },
  49452. failure(result, options) {
  49453. if (result.error) {
  49454. result.error.eventId = eventId;
  49455. }
  49456. result.eventId = eventId;
  49457. this.serviceProcessFailed(result, options);
  49458. }
  49459. }
  49460. params && (requestConfig.data = Util_Util.toJSON(params));
  49461. me.request(requestConfig);
  49462. }
  49463. }
  49464. ;// CONCATENATED MODULE: ./src/mapboxgl/services/DatasourceService.js
  49465. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49466. * This program are made available under the terms of the Apache License, Version 2.0
  49467. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49468. /**
  49469. * @class DatasourceService
  49470. * @category iServer Data Datasource
  49471. * @classdesc 数据源服务类。
  49472. * @modulecategory Services
  49473. * @param {string} url - 服务地址。
  49474. * @param {Object} options - 参数。
  49475. * @param {string} [options.proxy] - 服务代理地址。
  49476. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  49477. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  49478. * @param {Object} [options.headers] - 请求头。
  49479. * @extends {ServiceBase}
  49480. * @usage
  49481. */
  49482. class DatasourceService extends ServiceBase {
  49483. constructor(url, options) {
  49484. super(url, options);
  49485. this._datasourceService = new DatasourceService_DatasourceService(this.url, {
  49486. proxy: this.proxy,
  49487. withCredentials: this.withCredentials,
  49488. crossOrigin: this.crossOrigin,
  49489. headers: this.headers
  49490. });
  49491. }
  49492. /**
  49493. * @function DatasourceService.prototype.getDatasources
  49494. * @description 数据源集查询服务。
  49495. * @example
  49496. * new DatasourceService(url).getDatasources(function(result){
  49497. * //doSomething
  49498. * });
  49499. * @param {RequestCallback} callback - 回调函数。
  49500. */
  49501. getDatasources(callback) {
  49502. this._datasourceService.getDatasourcesService(callback);
  49503. }
  49504. /**
  49505. * @function DatasourceService.prototype.getDatasource
  49506. * @description 数据源信息查询服务。
  49507. * @example
  49508. * new DatasourceService(url).getDatasource(datasourceName,function(result){
  49509. * //doSomething
  49510. * });
  49511. * @param {string} datasourceName - 数据源名称。
  49512. * @param {RequestCallback} callback 回调函数。
  49513. */
  49514. getDatasource(datasourceName, callback) {
  49515. if (!datasourceName) {
  49516. return;
  49517. }
  49518. this._datasourceService.getDatasourceService(datasourceName, callback);
  49519. }
  49520. /**
  49521. * @function DatasourceService.prototype.setDatasource
  49522. * @description 数据源信息设置服务。可实现更改当前数据源信息。
  49523. * @example
  49524. * new DatasourceService(url).setDatasource(params, function(result){
  49525. * //doSomething
  49526. * });
  49527. * @param {SetDatasourceParameters} params - 数据源信息查询参数类。
  49528. * @param {RequestCallback} callback - 回调函数。
  49529. */
  49530. setDatasource(params, callback) {
  49531. if (!(params instanceof SetDatasourceParameters)) {
  49532. return;
  49533. }
  49534. const datasourceParams = {
  49535. description: params.description ,
  49536. coordUnit: params.coordUnit,
  49537. distanceUnit: params.distanceUnit,
  49538. datasourceName: params.datasourceName
  49539. };
  49540. this._datasourceService.setDatasourceService(datasourceParams, callback);
  49541. }
  49542. }
  49543. ;// CONCATENATED MODULE: ./src/common/iServer/EditFeaturesParameters.js
  49544. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49545. * This program are made available under the terms of the Apache License, Version 2.0
  49546. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49547. /**
  49548. * @class EditFeaturesParameters
  49549. * @deprecatedclass SuperMap.EditFeaturesParameters
  49550. * @category iServer Data Feature
  49551. * @classdesc 数据集添加、修改、删除参数类。
  49552. * @param {Object} options - 参数。
  49553. * @param {Array.<FeatureVector|GeoJSONObject|ol.Feature>} options.features - 当前需要创建或者是修改的要素集。
  49554. * @param {boolean} [options.returnContent=false] - 是否返回要素内容。如果为true则返回创建要素的 ID 数组,否则返回 featureResult 资源的 URI。
  49555. * @param {EditType} [options.editType=EditType.ADD] - POST 动作类型 (ADD、UPDATE、DELETE)。
  49556. * @param {Array.<string|number>} [options.IDs] - 删除要素时的要素的 ID 数组。
  49557. * @usage
  49558. */
  49559. class EditFeaturesParameters {
  49560. constructor(options) {
  49561. /**
  49562. * @member {string} EditFeaturesParameters.prototype.dataSourceName
  49563. * @description 当前需要创建或者是修改的要素的数据源。
  49564. */
  49565. this.dataSourceName = null;
  49566. /**
  49567. * @member {string} EditFeaturesParameters.prototype.dataSetName
  49568. * @description 当前需要创建或者是修改的要素的数据集。
  49569. */
  49570. this.dataSetName = null;
  49571. /**
  49572. * @member {Array.<FeatureVector|GeoJSONObject|ol.Feature>} EditFeaturesParameters.prototype.features
  49573. * @description 当前需要创建或者是修改的要素集。
  49574. */
  49575. this.features = null;
  49576. /**
  49577. * @member {EditType} [EditFeaturesParameters.prototype.editType=EditType.ADD]
  49578. * @description 要素集更新类型 (add、update、delete)。
  49579. */
  49580. this.editType = EditType.ADD;
  49581. /**
  49582. * @member {Array.<string|number>} [EditFeaturesParameters.prototype.IDs]
  49583. * @description 执行删除时要素集 ID 集合。
  49584. */
  49585. this.IDs = null;
  49586. /**
  49587. * @member {boolean} [EditFeaturesParameters.prototype.returnContent=false]
  49588. * @description 要素添加时,isUseBatch 不传或传为 false 的情况下有效。
  49589. * true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
  49590. */
  49591. this.returnContent = false;
  49592. /**
  49593. * @member {boolean} [EditFeaturesParameters.prototype.isUseBatch=false]
  49594. * @description 是否使用批量添加要素功能,要素添加时有效。批量添加能够提高要素编辑效率。true 表示批量添加;false 表示不使用批量添加。
  49595. */
  49596. this.isUseBatch = false;
  49597. Util_Util.extend(this, options);
  49598. this.CLASS_NAME = "SuperMap.EditFeaturesParameters";
  49599. }
  49600. /**
  49601. * @function EditFeaturesParameters.prototype.destroy
  49602. * @description 释放资源,将引用资源的属性置空。
  49603. */
  49604. destroy() {
  49605. var me = this;
  49606. me.dataSourceName = null;
  49607. me.dataSetName = null;
  49608. me.features = null;
  49609. me.editType = null;
  49610. me.IDs = null;
  49611. me.returnContent = null;
  49612. }
  49613. /**
  49614. * @function EditFeaturesParameters.prototype.toJsonParameters
  49615. * @description 将 EditFeaturesParameters 对象参数转换为 JSON 字符串。
  49616. * @param {EditFeaturesParameters} params - 地物编辑参数。
  49617. * @returns {string} JSON 字符串。
  49618. */
  49619. static toJsonParameters(params) {
  49620. var feature,
  49621. len,
  49622. features,
  49623. editType = params.editType;
  49624. if (editType === EditType.DELETE) {
  49625. if (params.IDs === null) {
  49626. return;
  49627. }
  49628. features = {ids: params.IDs};
  49629. } else {
  49630. features = [];
  49631. if (params.features) {
  49632. len = params.features.length;
  49633. for (var i = 0; i < len; i++) {
  49634. feature = params.features[i];
  49635. feature.geometry = ServerGeometry.fromGeometry(feature.geometry);
  49636. features.push(feature);
  49637. }
  49638. }
  49639. }
  49640. return Util_Util.toJSON(features);
  49641. }
  49642. }
  49643. ;// CONCATENATED MODULE: ./src/common/iServer/EditFeaturesService.js
  49644. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49645. * This program are made available under the terms of the Apache License, Version 2.0
  49646. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49647. /**
  49648. * @class EditFeaturesService
  49649. * @deprecatedclass SuperMap.EditFeaturesService
  49650. * @category iServer Data Feature
  49651. * @classdesc 数据服务中数据集添加、更新、删除服务类。
  49652. * @extends {CommonServiceBase}
  49653. * @param {string} url - 服务端的数据服务资源地址。请求数据服务中数据集编辑服务,URL 应为:</br>
  49654. * http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/datasources/name/{数据源名}/datasets/name/{数据集名} 。</br>
  49655. * 例如:http://localhost:8090/iserver/services/data-jingjin/rest/data/datasources/name/Jingjin/datasets/name/Landuse_R
  49656. * @param {Object} options - 参数。
  49657. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  49658. * @param {DataFormat} [format] -查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式。参数格式为"ISERVER","GEOJSON"。
  49659. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  49660. * @param {Object} [options.headers] - 请求头。
  49661. * @example
  49662. * var myService = new EditFeaturesService(url, {eventListeners: {
  49663. * "processCompleted": editFeatureCompleted,
  49664. * "processFailed": editFeatureError
  49665. * }
  49666. * };
  49667. * @usage
  49668. */
  49669. class EditFeaturesService extends CommonServiceBase {
  49670. constructor(url, options) {
  49671. super(url, options);
  49672. /**
  49673. * @member {boolean} [EditFeaturesService.prototype.returnContent=false]
  49674. * @description要素添加时,isUseBatch 不传或传为 false 的情况下有效。true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
  49675. */
  49676. this.returnContent = false;
  49677. /**
  49678. * @member {boolean} [EditFeaturesService.prototype.isUseBatch=false]
  49679. * @description 是否使用批量添加要素功能,要素添加时有效。
  49680. * 批量添加能够提高要素编辑效率。
  49681. * true 表示批量添加;false 表示不使用批量添加。
  49682. */
  49683. this.isUseBatch = false;
  49684. if (options) {
  49685. Util_Util.extend(this, options);
  49686. }
  49687. this.url = Util_Util.urlPathAppend(this.url, 'features');
  49688. this.CLASS_NAME = "SuperMap.EditFeaturesService";
  49689. }
  49690. /**
  49691. * @function EditFeaturesService.prototype.destroy
  49692. * @override
  49693. */
  49694. destroy() {
  49695. super.destroy();
  49696. var me = this;
  49697. me.returnContent = null;
  49698. me.isUseBatch = null;
  49699. me.fromIndex = null;
  49700. me.toIndex = null;
  49701. }
  49702. /**
  49703. * @function EditFeaturesService.prototype.processAsync
  49704. * @description 负责将客户端的更新参数传递到服务端。
  49705. * @param {EditFeaturesParameters} params - 编辑要素参数。
  49706. */
  49707. processAsync(params) {
  49708. if (!(params instanceof EditFeaturesParameters)) {
  49709. return;
  49710. }
  49711. var me = this,
  49712. method = "POST",
  49713. ids = "",
  49714. editType = params.editType,
  49715. jsonParameters = null;
  49716. me.returnContent = params.returnContent;
  49717. me.isUseBatch = params.isUseBatch;
  49718. jsonParameters = EditFeaturesParameters.toJsonParameters(params);
  49719. if (editType === EditType.DELETE) {
  49720. ids = Util_Util.toJSON(params.IDs);
  49721. jsonParameters = ids;
  49722. var urlWithIds = Util_Util.urlAppend(me.url, Util_Util.getParameterString({ids}))
  49723. if(FetchRequest.urlIsLong(urlWithIds)) {
  49724. me.url = Util_Util.urlAppend(me.url, Util_Util.getParameterString({_method: 'DELETE'}));
  49725. method = "POST";
  49726. } else{
  49727. me.url = urlWithIds;
  49728. method = "DELETE";
  49729. }
  49730. } else if (editType === EditType.UPDATE) {
  49731. method = "PUT";
  49732. } else {
  49733. if (me.isUseBatch) {
  49734. me.url = Util_Util.urlAppend(me.url, `isUseBatch=${me.isUseBatch}`);
  49735. me.returnContent = false;
  49736. }
  49737. if (me.returnContent) {
  49738. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  49739. method = "POST";
  49740. }
  49741. }
  49742. me.request({
  49743. method: method,
  49744. data: jsonParameters,
  49745. scope: me,
  49746. success: me.serviceProcessCompleted,
  49747. failure: me.serviceProcessFailed
  49748. });
  49749. }
  49750. }
  49751. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesServiceBase.js
  49752. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49753. * This program are made available under the terms of the Apache License, Version 2.0
  49754. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49755. /**
  49756. * @class GetFeaturesServiceBase
  49757. * @deprecatedclass SuperMap.GetFeaturesServiceBase
  49758. * @category iServer Data FeatureResults
  49759. * @classdesc 数据服务中数据集查询服务基类。获取结果数据类型为 Object。包含 result 属性,result 的数据格式根据 format 参数决定为 GeoJSON 或者 iServerJSON。
  49760. * @extends CommonServiceBase
  49761. * @param {string} url - 服务地址。请求数据服务中数据集查询服务,
  49762. * URL应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/
  49763. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  49764. * @param {Object} options - 参数。
  49765. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  49766. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  49767. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  49768. * @param {Object} [options.headers] - 请求头。
  49769. * @example
  49770. * var myService = new GetFeaturesServiceBase(url, {
  49771. * eventListeners: {
  49772. * "processCompleted": getFeatureCompleted,
  49773. * "processFailed": getFeatureError
  49774. * }
  49775. * });
  49776. * @usage
  49777. */
  49778. class GetFeaturesServiceBase extends CommonServiceBase {
  49779. constructor(url, options) {
  49780. super(url, options);
  49781. options = options || {};
  49782. /**
  49783. * @member {boolean} [GetFeaturesServiceBase.prototype.returnContent=true]
  49784. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  49785. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  49786. * 如果为 false,则返回的是查询结果资源的 URI。
  49787. */
  49788. this.returnContent = true;
  49789. /**
  49790. * @member {number} [GetFeaturesServiceBase.prototype.fromIndex=0]
  49791. * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
  49792. */
  49793. this.fromIndex = 0;
  49794. /**
  49795. * @member {number} [GetFeaturesServiceBase.prototype.toIndex=19]
  49796. * @description 查询结果的最大索引号。
  49797. * 如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
  49798. */
  49799. this.toIndex = 19;
  49800. /**
  49801. * @member {number} [GetFeaturesServiceBase.prototype.hasGeometry=true]
  49802. * @description 返回结果是否包含Geometry。
  49803. */
  49804. this.hasGeometry = true;
  49805. /**
  49806. * @member {number} [GetFeaturesServiceBase.prototype.maxFeatures=1000]
  49807. * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
  49808. */
  49809. this.maxFeatures = null;
  49810. /**
  49811. * @member {string} [GetFeaturesServiceBase.prototype.format=DataFormat.GEOJSON]
  49812. * @description 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。
  49813. * 参数格式为 "ISERVER","GEOJSON","FGB"。
  49814. */
  49815. this.format = DataFormat.GEOJSON;
  49816. Util_Util.extend(this, options);
  49817. this.url = Util_Util.urlPathAppend(this.url, 'featureResults');
  49818. this.CLASS_NAME = "SuperMap.GetFeaturesServiceBase";
  49819. }
  49820. /**
  49821. * @function GetFeaturesServiceBase.prototype.destroy
  49822. * @description 释放资源,将引用资源的属性置空。
  49823. */
  49824. destroy() {
  49825. super.destroy();
  49826. var me = this;
  49827. me.returnContent = null;
  49828. me.fromIndex = null;
  49829. me.toIndex = null;
  49830. me.maxFeatures = null;
  49831. me.format = null;
  49832. me.hasGeometry = null;
  49833. }
  49834. /**
  49835. * @function GetFeaturesServiceBase.prototype.processAsync
  49836. * @description 将客户端的查询参数传递到服务端。
  49837. * @param {Object} params - 查询参数。
  49838. */
  49839. processAsync(params) {
  49840. if (!params) {
  49841. return;
  49842. }
  49843. var me = this,
  49844. jsonParameters = null,
  49845. firstPara = true;
  49846. me.returnContent = params.returnContent;
  49847. me.fromIndex = params.fromIndex;
  49848. me.toIndex = params.toIndex;
  49849. me.maxFeatures = params.maxFeatures;
  49850. me.hasGeometry = params.hasGeometry;
  49851. if (me.returnContent) {
  49852. firstPara = false;
  49853. }
  49854. var isValidNumber = me.fromIndex != null && me.toIndex != null && !isNaN(me.fromIndex) && !isNaN(me.toIndex);
  49855. if (isValidNumber && me.fromIndex >= 0 && me.toIndex >= 0 && !firstPara) {
  49856. me.url = Util_Util.urlAppend(me.url, `fromIndex=${me.fromIndex}&toIndex=${me.toIndex}`);
  49857. }
  49858. if (params.returnCountOnly) {
  49859. me.url = Util_Util.urlAppend(me.url, "&returnCountOnly=" + params.returnContent)
  49860. }
  49861. jsonParameters = me.getJsonParameters(params);
  49862. me.request({
  49863. method: "POST",
  49864. data: jsonParameters,
  49865. scope: me,
  49866. success: me.serviceProcessCompleted,
  49867. failure: me.serviceProcessFailed
  49868. });
  49869. }
  49870. /**
  49871. * @function GetFeaturesServiceBase.prototype.getFeatureComplete
  49872. * @description 查询完成,执行此方法。
  49873. * @param {Object} result - 服务器返回的结果对象。
  49874. */
  49875. serviceProcessCompleted(result, options) {
  49876. var me = this;
  49877. result = Util_Util.transformResult(result);
  49878. if (me.format === DataFormat.GEOJSON && result.features) {
  49879. var geoJSONFormat = new GeoJSON();
  49880. result.features = geoJSONFormat.toGeoJSON(result.features);
  49881. }
  49882. me.events.triggerEvent("processCompleted", {result: result, options});
  49883. }
  49884. dataFormat() {
  49885. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  49886. }
  49887. }
  49888. ;// CONCATENATED MODULE: ./src/common/iServer/FilterParameter.js
  49889. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49890. * This program are made available under the terms of the Apache License, Version 2.0
  49891. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49892. /**
  49893. * @class FilterParameter
  49894. * @deprecatedclass SuperMap.FilterParameter
  49895. * @category iServer Data FeatureResults
  49896. * @classdesc 查询过滤条件参数类。该类用于设置查询数据集的查询过滤参数。
  49897. * @param {Object} options - 参数。
  49898. * @param {string} options.attributeFilter - 属性过滤条件。
  49899. * @param {string} options.name - 查询数据集名称或者图层名称。
  49900. * @param {Array.<JoinItem>} [options.joinItems] - 与外部表的连接信息 JoinItem 数组。
  49901. * @param {Array.<LinkItem>} [options.linkItems] - 与外部表的关联信息 LinkItem 数组。
  49902. * @param {Array.<string>} [options.ids] - 查询 id 数组,即属性表中的 SmID 值。
  49903. * @param {string} [options.orderBy] - 查询排序的字段,orderBy 的字段须为数值型的。
  49904. * @param {string} [options.groupBy] - 查询分组条件的字段。
  49905. * @param {Array.<string>} [options.fields] - 查询字段数组。
  49906. * @usage
  49907. */
  49908. class FilterParameter {
  49909. constructor(options) {
  49910. /**
  49911. * @member {string} FilterParameter.prototype.attributeFilter
  49912. * @description 属性过滤条件。
  49913. * 相当于 SQL 语句中的 WHERE 子句,其格式为:WHERE <条件表达式>,
  49914. * attributeFilter 就是其中的“条件表达式”。
  49915. * 该字段的用法为 attributeFilter = "过滤条件"。
  49916. * 例如,要查询字段 fieldValue 小于100的记录,设置 attributeFilter = "fieldValue < 100";
  49917. * 要查询字段 name 的值为“酒店”的记录,设置 attributeFilter = "name like '%酒店%'",等等。
  49918. */
  49919. this.attributeFilter = null;
  49920. /**
  49921. * @member {string} FilterParameter.prototype.name
  49922. * @description 查询数据集名称或者图层名称,根据实际的查询对象而定。
  49923. * 一般情况下该字段为数据集名称,但在进行与地图相关功能的操作时,
  49924. * 需要设置为图层名称(图层名称格式:数据集名称@数据源别名)。
  49925. * 因为一个地图的图层可能是来自于不同数据源的数据集,
  49926. * 而不同的数据源中可能存在同名的数据集,
  49927. * 使用数据集名称不能唯一的确定数据集,
  49928. * 所以在进行与地图相关功能的操作时,该值需要设置为图层名称。
  49929. */
  49930. this.name = null;
  49931. /**
  49932. * @member {Array.<JoinItem>} [FilterParameter.prototype.joinItems]
  49933. * @description 与外部表的连接信息 JoinItem 数组。
  49934. */
  49935. this.joinItems = null;
  49936. /**
  49937. * @member {Array.<LinkItem>} [FilterParameter.prototype.linkItems]
  49938. * @description 与外部表的关联信息 LinkItem 数组。
  49939. */
  49940. this.linkItems = null;
  49941. /**
  49942. * @member {Array.<string>} [FilterParameter.prototype.ids]
  49943. * @description 查询 id 数组,即属性表中的 SmID 值。
  49944. */
  49945. this.ids = null;
  49946. /**
  49947. * @member {string} [FilterParameter.prototype.orderBy]
  49948. * @description 查询排序的字段,orderBy的字段须为数值型的。
  49949. * 相当于 SQL 语句中的 ORDER BY 子句,其格式为:ORDER BY <列名>,
  49950. * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
  49951. * 对单个字段排序时,该字段的用法为 orderBy = "字段名";
  49952. * 对多个字段排序时,字段之间以英文逗号进行分割,用法为 orderBy = "字段名1, 字段名2"。
  49953. * 例如,现有一个国家数据集,它有两个字段分别为“SmArea”和“pop_1994”,
  49954. * 分别表示国家的面积和1994年的各国人口数量。
  49955. * 如果要按照各国人口数量对记录进行排序,则 orderBy = "pop_1994";
  49956. * 如果要以面积和人口进行排序,则 orderBy = "SmArea, pop_1994"。
  49957. */
  49958. this.orderBy = null;
  49959. /**
  49960. * @member {string} [FilterParameter.prototype.groupBy]
  49961. * @description 查询分组条件的字段。
  49962. * 相当于 SQL 语句中的 GROUP BY 子句,其格式为:GROUP BY <列名>,
  49963. * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
  49964. * 对单个字段分组时,该字段的用法为 groupBy = "字段名";
  49965. * 对多个字段分组时,字段之间以英文逗号进行分割,用法为 groupBy = "字段名1, 字段名2"。
  49966. * 例如,现有一个全球城市数据集,该数据集有两个字段分别为“Continent”和“Country”,
  49967. * 分别表示某个城市所属的洲和国家。
  49968. * 如果要按照国家对全球的城市进行分组,可以设置 groupBy = "Country";
  49969. * 如果以洲和国家对城市进行分组,设置 groupBy = "Continent, Country"。
  49970. */
  49971. this.groupBy = null;
  49972. /**
  49973. * @member {Array.<string>} [FilterParameter.prototype.fields]
  49974. * @description 查询字段数组,如果不设置则使用系统返回的所有字段。
  49975. */
  49976. this.fields = null;
  49977. if (options) {
  49978. Util_Util.extend(this, options);
  49979. }
  49980. this.CLASS_NAME = "SuperMap.FilterParameter";
  49981. }
  49982. /**
  49983. * @function FilterParameter.prototype.destroy
  49984. * @description 释放资源,将引用资源的属性置空。
  49985. */
  49986. destroy() {
  49987. var me = this;
  49988. me.attributeFilter = null;
  49989. me.name = null;
  49990. if (me.joinItems) {
  49991. for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
  49992. joinItems[i].destroy();
  49993. }
  49994. me.joinItems = null;
  49995. }
  49996. if (me.linkItems) {
  49997. for (let i = 0, linkItems = me.linkItems, len = linkItems.length; i < len; i++) {
  49998. linkItems[i].destroy();
  49999. }
  50000. me.linkItems = null;
  50001. }
  50002. me.ids = null;
  50003. me.orderBy = null;
  50004. me.groupBy = null;
  50005. me.fields = null;
  50006. }
  50007. }
  50008. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesParametersBase.js
  50009. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50010. * This program are made available under the terms of the Apache License, Version 2.0
  50011. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50012. /**
  50013. * @class GetFeaturesParametersBase
  50014. * @deprecatedclass SuperMap.GetFeaturesParametersBase
  50015. * @category iServer Data FeatureResults
  50016. * @classdesc 要素查询参数基类。
  50017. * @param {Object} options - 参数。
  50018. * @param {Array.<string>} options.datasetNames - 数据集名称列表。
  50019. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  50020. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  50021. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  50022. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  50023. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  50024. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  50025. * @usage
  50026. */
  50027. class GetFeaturesParametersBase {
  50028. constructor(options) {
  50029. /**
  50030. * @member {Array.<string>} GetFeaturesParametersBase.prototype.datasetName
  50031. * @description 数据集集合中的数据集名称列表。
  50032. */
  50033. this.datasetNames = null;
  50034. /**
  50035. * @member {string} GetFeaturesParametersBase.prototype.targetEpsgCode
  50036. * @description 动态投影的目标坐标系对应的 EPSG Code,使用时需设置 returnContent 参数为 true。
  50037. */
  50038. this.targetEpsgCode = null;
  50039. /**
  50040. * @member {Object} GetFeaturesParametersBase.prototype.targetPrj
  50041. * @description 动态投影的目标坐标系。使用时需设置 returnContent 参数为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  50042. */
  50043. this.targetPrj = null;
  50044. /**
  50045. * @member {boolean} [GetFeaturesParametersBase.prototype.returnContent=true]
  50046. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  50047. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  50048. * 如果为 false,则返回的是查询结果资源的 URI。
  50049. */
  50050. this.returnContent = true;
  50051. /**
  50052. * @member {number} [GetFeaturesParametersBase.prototype.fromIndex=0]
  50053. * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
  50054. */
  50055. this.fromIndex = 0;
  50056. /**
  50057. * @member {number} [GetFeaturesParametersBase.prototype.toIndex=19]
  50058. * @description 查询结果的最大索引号。如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
  50059. */
  50060. this.toIndex = 19;
  50061. /**
  50062. * @member {boolean} [GetFeaturesParametersBase.prototype.returnCountOnly=false]
  50063. * @description 只返回查询结果的总数。
  50064. */
  50065. this.returnCountOnly = false;
  50066. /**
  50067. * @member {number} [GetFeaturesParametersBase.prototype.maxFeatures=1000]
  50068. * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
  50069. */
  50070. this.maxFeatures = null;
  50071. /**
  50072. * @member {number} [GetFeaturesParametersBase.prototype.hasGeometry=true]
  50073. * @description 返回结果是否包含Geometry。
  50074. */
  50075. this.hasGeometry = true;
  50076. /**
  50077. * @member {MetricsAggParameter|GeoHashGridAggParameter} GetFeaturesParametersBase.prototype.aggregations
  50078. * @description 聚合查询参数,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  50079. */
  50080. this.aggregations = null;
  50081. Util_Util.extend(this, options);
  50082. this.CLASS_NAME = 'SuperMap.GetFeaturesParametersBase';
  50083. }
  50084. /**
  50085. *
  50086. * @function GetFeaturesParametersBase.prototype.destroy
  50087. * @description 释放资源,将引用资源的属性置空。
  50088. */
  50089. destroy() {
  50090. var me = this;
  50091. me.datasetNames = null;
  50092. me.returnContent = null;
  50093. me.fromIndex = null;
  50094. me.toIndex = null;
  50095. me.hasGeometry = null;
  50096. me.maxFeatures = null;
  50097. me.targetEpsgCode = null;
  50098. me.targetPrj = null;
  50099. if (me.aggregation) {
  50100. me.aggregation = null;
  50101. }
  50102. }
  50103. }
  50104. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsParameters.js
  50105. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50106. * This program are made available under the terms of the Apache License, Version 2.0
  50107. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50108. /**
  50109. * @class GetFeaturesByIDsParameters
  50110. * @deprecatedclass SuperMap.GetFeaturesByIDsParameters
  50111. * @category iServer Data FeatureResults
  50112. * @classdesc ID 查询参数类。
  50113. * @param {Object} options - 参数。
  50114. * @param {Array.<number>} options.IDs - 指定查询的元素 ID 信息。
  50115. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  50116. * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
  50117. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  50118. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  50119. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  50120. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  50121. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  50122. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  50123. * @extends {GetFeaturesParametersBase}
  50124. * @usage
  50125. */
  50126. class GetFeaturesByIDsParameters extends GetFeaturesParametersBase {
  50127. constructor(options) {
  50128. super(options);
  50129. /**
  50130. * @member {string} GetFeaturesByIDsParameters.prototype.getFeatureMode
  50131. * @description 数据集查询模式。
  50132. */
  50133. this.getFeatureMode = 'ID';
  50134. /**
  50135. * @member {Array.<number>} GetFeaturesByIDsParameters.prototype.IDs
  50136. * @description 所要查询指定的元素 ID 信息。
  50137. */
  50138. this.IDs = null;
  50139. /**
  50140. * @member {Array.<string>} GetFeaturesByIDsParameters.prototype.fields
  50141. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  50142. */
  50143. this.fields = null;
  50144. Util_Util.extend(this, options);
  50145. this.CLASS_NAME = 'SuperMap.GetFeaturesByIDsParameters';
  50146. }
  50147. /**
  50148. * @function GetFeaturesByIDsParameters.prototype.destroy
  50149. * @override
  50150. */
  50151. destroy() {
  50152. super.destroy();
  50153. var me = this;
  50154. me.IDs = null;
  50155. me.getFeatureMode = null;
  50156. if (me.fields) {
  50157. while (me.fields.length > 0) {
  50158. me.fields.pop();
  50159. }
  50160. me.fields = null;
  50161. }
  50162. }
  50163. /**
  50164. * @function GetFeaturesByIDsParameters.toJsonParameters
  50165. * @description 将 GetFeaturesByIDsParameters 对象转换为 JSON 字符串。
  50166. * @param {GetFeaturesByIDsParameters} params - ID 查询参数对象。
  50167. * @returns {string} 转化后的 JSON 字符串。
  50168. */
  50169. static toJsonParameters(params) {
  50170. var parasByIDs, filterParameter;
  50171. parasByIDs = {
  50172. datasetNames: params.datasetNames,
  50173. getFeatureMode: 'ID',
  50174. ids: params.IDs
  50175. };
  50176. if (params.fields) {
  50177. filterParameter = new FilterParameter();
  50178. filterParameter.name = params.datasetNames;
  50179. filterParameter.fields = params.fields;
  50180. parasByIDs.queryParameter = filterParameter;
  50181. }
  50182. if (params.targetEpsgCode) {
  50183. parasByIDs.targetEpsgCode = params.targetEpsgCode;
  50184. }
  50185. if (typeof params.hasGeometry === 'boolean') {
  50186. parasByIDs.hasGeometry = params.hasGeometry;
  50187. }
  50188. if (!params.targetEpsgCode && params.targetPrj) {
  50189. parasByIDs.targetPrj = params.targetPrj;
  50190. }
  50191. if (params.aggregations) {
  50192. parasByIDs.aggregations = params.aggregations;
  50193. }
  50194. return Util_Util.toJSON(parasByIDs);
  50195. }
  50196. }
  50197. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsService.js
  50198. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50199. * This program are made available under the terms of the Apache License, Version 2.0
  50200. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50201. /**
  50202. * @class GetFeaturesByIDsService
  50203. * @deprecatedclass SuperMap.GetFeaturesByIDsService
  50204. * @category iServer Data FeatureResults
  50205. * @classdesc 数据集ID查询服务类。在数据集集合中查找指定 ID 号对应的空间地物要素。
  50206. * @param {string} url - 服务地址。请求数据服务中数据集查询服务。
  50207. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
  50208. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  50209. * @param {Object} options - 参数。
  50210. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  50211. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  50212. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  50213. * @param {Object} [options.headers] - 请求头。
  50214. * @extends {GetFeaturesServiceBase}
  50215. * @example
  50216. * var myGetFeaturesByIDsService = new GetFeaturesByIDsService(url, {
  50217. * eventListeners: {
  50218. * "processCompleted": getFeatureCompleted,
  50219. * "processFailed": getFeatureError
  50220. * }
  50221. * });
  50222. * function getFeatureCompleted(object){//todo};
  50223. * function getFeatureError(object){//todo}
  50224. * @usage
  50225. */
  50226. class GetFeaturesByIDsService extends GetFeaturesServiceBase {
  50227. constructor(url, options) {
  50228. super(url, options);
  50229. this.CLASS_NAME = "SuperMap.GetFeaturesByIDsService";
  50230. }
  50231. /**
  50232. * @function GetFeaturesByIDsService.prototype.destroy
  50233. * @override
  50234. */
  50235. destroy() {
  50236. super.destroy();
  50237. }
  50238. /**
  50239. * @function GetFeaturesByIDsService.prototype.getJsonParameters
  50240. * @description 将查询参数转化为 JSON 字符串。
  50241. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  50242. * @param {GetFeaturesByIDsParameters} params - ID查询参数类。
  50243. * @returns {string} 转化后的 JSON 字符串。
  50244. */
  50245. getJsonParameters(params) {
  50246. return GetFeaturesByIDsParameters.toJsonParameters(params);
  50247. }
  50248. }
  50249. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLParameters.js
  50250. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50251. * This program are made available under the terms of the Apache License, Version 2.0
  50252. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50253. /**
  50254. * @class GetFeaturesBySQLParameters
  50255. * @deprecatedclass SuperMap.GetFeaturesBySQLParameters
  50256. * @category iServer Data FeatureResults
  50257. * @classdesc 数据集 SQL 查询参数类。
  50258. * @param {Object} options - 参数。
  50259. * @param {FilterParameter} options.queryParameter - 查询过滤条件参数。
  50260. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  50261. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  50262. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  50263. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  50264. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  50265. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  50266. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  50267. * @extends {GetFeaturesParametersBase}
  50268. * @usage
  50269. */
  50270. class GetFeaturesBySQLParameters extends GetFeaturesParametersBase {
  50271. constructor(options) {
  50272. super(options);
  50273. /**
  50274. * @member {string} GetFeaturesBySQLParameters.prototype.getFeatureMode
  50275. * @description 数据集查询模式。
  50276. */
  50277. this.getFeatureMode = 'SQL';
  50278. /**
  50279. * @member {FilterParameter} GetFeaturesBySQLParameters.prototype.queryParameter
  50280. * @description 查询过滤条件参数类。
  50281. */
  50282. this.queryParameter = null;
  50283. Util_Util.extend(this, options);
  50284. this.CLASS_NAME = 'SuperMap.GetFeaturesBySQLParameters';
  50285. }
  50286. /**
  50287. * @function GetFeaturesBySQLParameters.prototype.destroy
  50288. * @override
  50289. */
  50290. destroy() {
  50291. super.destroy();
  50292. var me = this;
  50293. me.getFeatureMode = null;
  50294. if (me.queryParameter) {
  50295. me.queryParameter.destroy();
  50296. me.queryParameter = null;
  50297. }
  50298. }
  50299. /**
  50300. * @function GetFeaturesBySQLParameters.prototype.toJsonParameters
  50301. * @description 将 GetFeaturesBySQLParameters 对象转换为 JSON 字符串。
  50302. * @param {GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数对象。
  50303. * @returns {string} 转化后的 JSON 字符串。
  50304. */
  50305. static toJsonParameters(params) {
  50306. var paramsBySql = {
  50307. datasetNames: params.datasetNames,
  50308. getFeatureMode: 'SQL',
  50309. queryParameter: params.queryParameter
  50310. };
  50311. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  50312. paramsBySql.maxFeatures = params.maxFeatures;
  50313. }
  50314. if (typeof params.hasGeometry === 'boolean') {
  50315. paramsBySql.hasGeometry = params.hasGeometry;
  50316. }
  50317. if (params.aggregations) {
  50318. paramsBySql.aggregations = params.aggregations;
  50319. }
  50320. if (params.targetEpsgCode) {
  50321. paramsBySql.targetEpsgCode = params.targetEpsgCode;
  50322. }
  50323. if (!params.targetEpsgCode && params.targetPrj) {
  50324. paramsBySql.targetPrj = params.targetPrj;
  50325. }
  50326. if (params.aggregations) {
  50327. paramsBySql.aggregations = params.aggregations;
  50328. }
  50329. return Util_Util.toJSON(paramsBySql);
  50330. }
  50331. }
  50332. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLService.js
  50333. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50334. * This program are made available under the terms of the Apache License, Version 2.0
  50335. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50336. /**
  50337. * @class GetFeaturesBySQLService
  50338. * @deprecatedclass SuperMap.GetFeaturesBySQLService
  50339. * @constructs GetFeaturesBySQLService
  50340. * @category iServer Data FeatureResults
  50341. * @classdesc 数据服务中数据集 SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
  50342. * @param {string} url - 服务地址。请求数据服务中数据集查询服务,
  50343. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
  50344. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  50345. * @param {Object} options - 参数。
  50346. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  50347. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  50348. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  50349. * @param {Object} [options.headers] - 请求头。
  50350. * @extends {GetFeaturesServiceBase}
  50351. * @example
  50352. * var myGetFeaturesBySQLService = new GetFeaturesBySQLService(url, {
  50353. * eventListeners: {
  50354. * "processCompleted": GetFeaturesCompleted,
  50355. * "processFailed": GetFeaturesError
  50356. * }
  50357. * });
  50358. * function getFeaturesCompleted(object){//todo};
  50359. * function getFeaturesError(object){//todo};
  50360. * @usage
  50361. */
  50362. class GetFeaturesBySQLService extends GetFeaturesServiceBase {
  50363. constructor(url, options) {
  50364. super(url, options);
  50365. this.CLASS_NAME = "SuperMap.GetFeaturesBySQLService";
  50366. }
  50367. /**
  50368. * @function GetFeaturesBySQLService.prototype.destroy
  50369. * @override
  50370. */
  50371. destroy() {
  50372. super.destroy();
  50373. }
  50374. /*
  50375. * @function GetFeaturesBySQLService.prototype.getJsonParameters
  50376. * @description 将查询参数转化为 JSON 字符串。
  50377. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  50378. * @param {GetFeaturesBySQLParameters} params - 数据集SQL查询参数类。
  50379. * @returns {string} 转化后的 JSON 字符串。
  50380. */
  50381. getJsonParameters(params) {
  50382. return GetFeaturesBySQLParameters.toJsonParameters(params);
  50383. }
  50384. }
  50385. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsParameters.js
  50386. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50387. * This program are made available under the terms of the Apache License, Version 2.0
  50388. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50389. /**
  50390. * @class GetFeaturesByBoundsParameters
  50391. * @deprecatedclass SuperMap.GetFeaturesByBoundsParameters
  50392. * @category iServer Data FeatureResults
  50393. * @classdesc 数据集范围查询参数类,该类用于设置数据集范围查询的相关参数。
  50394. * @param {Object} options - 参数。
  50395. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 查询的范围对象。
  50396. * @param {Array.<string>} options.datasetNames - 数据集名称列表。
  50397. * @param {string} [options.attributeFilter] - 范围查询属性过滤条件。
  50398. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  50399. * @param {SpatialQueryMode} [options.spatialQueryMode=SpatialQueryMode.CONTAIN] - 空间查询模式常量。
  50400. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  50401. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  50402. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  50403. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  50404. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  50405. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  50406. * @extends {GetFeaturesParametersBase}
  50407. * @usage
  50408. */
  50409. class GetFeaturesByBoundsParameters extends GetFeaturesParametersBase {
  50410. constructor(options) {
  50411. super(options);
  50412. /**
  50413. * @member {string} GetFeaturesByBoundsParameters.prototype.getFeatureMode
  50414. * @description 数据集查询模式。范围查询有 "BOUNDS","BOUNDS_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 BOUNDS_ATTRIBUTEFILTER 访问服务。
  50415. */
  50416. this.getFeatureMode = GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS;
  50417. /**
  50418. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} GetFeaturesByBoundsParameters.prototype.bounds
  50419. * @description 用于查询的范围对象。
  50420. *
  50421. */
  50422. this.bounds = null;
  50423. /**
  50424. * @member {Array.<string>} GetFeaturesByBoundsParameters.prototype.fields
  50425. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  50426. */
  50427. this.fields = null;
  50428. /**
  50429. * @member {string} GetFeaturesByBoundsParameters.prototype.attributeFilter
  50430. * @description 范围查询属性过滤条件。
  50431. */
  50432. this.attributeFilter = null;
  50433. /**
  50434. * @member {SpatialQueryMode} [GetFeaturesByBoundsParameters.prototype.spatialQueryMode=SpatialQueryMode.CONTAIN]
  50435. * @description 空间查询模式常量。
  50436. */
  50437. this.spatialQueryMode = SpatialQueryMode.CONTAIN;
  50438. Util_Util.extend(this, options);
  50439. this.CLASS_NAME = 'SuperMap.GetFeaturesByBoundsParameters';
  50440. }
  50441. /**
  50442. * @function GetFeaturesByBoundsParameters.prototype.destroy
  50443. * @override
  50444. */
  50445. destroy() {
  50446. super.destroy();
  50447. var me = this;
  50448. if (me.bounds) {
  50449. me.bounds.destroy();
  50450. me.bounds = null;
  50451. }
  50452. if (me.fields) {
  50453. while (me.fields.length > 0) {
  50454. me.fields.pop();
  50455. }
  50456. me.fields = null;
  50457. }
  50458. me.attributeFilter = null;
  50459. me.spatialQueryMode = null;
  50460. me.getFeatureMode = null;
  50461. }
  50462. /**
  50463. * @function GetFeaturesByBoundsParameters.toJsonParameters
  50464. * @description 将 {@link GetFeaturesByBoundsParameters} 对象参数转换为 JSON 字符串。
  50465. * @param {GetFeaturesByBoundsParameters} params - 范围查询参数。
  50466. * @returns {string} 转化后的 JSON 字符串。
  50467. *
  50468. */
  50469. static toJsonParameters(params) {
  50470. var filterParameter, bounds, parasByBounds;
  50471. bounds = {
  50472. leftBottom: { x: params.bounds.left, y: params.bounds.bottom },
  50473. rightTop: { x: params.bounds.right, y: params.bounds.top }
  50474. };
  50475. parasByBounds = {
  50476. datasetNames: params.datasetNames,
  50477. getFeatureMode: GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS,
  50478. bounds: bounds,
  50479. spatialQueryMode: params.spatialQueryMode
  50480. };
  50481. if (params.fields) {
  50482. filterParameter = new FilterParameter();
  50483. filterParameter.name = params.datasetNames;
  50484. filterParameter.fields = params.fields;
  50485. parasByBounds.queryParameter = filterParameter;
  50486. }
  50487. if (params.attributeFilter) {
  50488. parasByBounds.attributeFilter = params.attributeFilter;
  50489. parasByBounds.getFeatureMode = GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS_ATTRIBUTEFILTER;
  50490. }
  50491. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  50492. parasByBounds.maxFeatures = params.maxFeatures;
  50493. }
  50494. if (typeof params.hasGeometry === 'boolean') {
  50495. parasByBounds.hasGeometry = params.hasGeometry;
  50496. }
  50497. if (params.targetEpsgCode) {
  50498. parasByBounds.targetEpsgCode = params.targetEpsgCode;
  50499. }
  50500. if (!params.targetEpsgCode && params.targetPrj) {
  50501. parasByBounds.targetPrj = params.targetPrj;
  50502. }
  50503. if (params.aggregations) {
  50504. parasByBounds.aggregations = params.aggregations;
  50505. }
  50506. return Util_Util.toJSON(parasByBounds);
  50507. }
  50508. }
  50509. GetFeaturesByBoundsParameters.getFeatureMode = {
  50510. BOUNDS: 'BOUNDS',
  50511. BOUNDS_ATTRIBUTEFILTER: 'BOUNDS_ATTRIBUTEFILTER'
  50512. };
  50513. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsService.js
  50514. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50515. * This program are made available under the terms of the Apache License, Version 2.0
  50516. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50517. /**
  50518. * @class GetFeaturesByBoundsService
  50519. * @deprecatedclass SuperMap.GetFeaturesByBoundsService
  50520. * @category iServer Data FeatureResults
  50521. * @classdesc 数据集范围查询服务类,查询与指定范围对象符合一定空间关系的矢量要素。
  50522. * @description 数据集范围查询服务类构造函数。
  50523. * @extends {GetFeaturesServiceBase}
  50524. * @param {string} url - 服务地址。请求数据服务中数据集查询服务,URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
  50525. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  50526. * @param {Object} options - 参数。
  50527. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  50528. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  50529. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  50530. * @param {Object} [options.headers] - 请求头。
  50531. * @example
  50532. * var myGetFeaturesByBoundsService = new SuperMa.GetFeaturesByBoundsService(url, {
  50533. * eventListeners: {
  50534. * "processCompleted": getFeatureCompleted,
  50535. * "processFailed": getFeatureError
  50536. * }
  50537. * });
  50538. * function getFeatureCompleted(object){//todo};
  50539. * function getFeatureError(object){//todo}
  50540. * @usage
  50541. */
  50542. class GetFeaturesByBoundsService extends GetFeaturesServiceBase {
  50543. constructor(url, options) {
  50544. super(url, options);
  50545. this.CLASS_NAME = "SuperMap.GetFeaturesByBoundsService";
  50546. }
  50547. /**
  50548. * @function GetFeaturesByBoundsService.prototype.destroy
  50549. * @override
  50550. */
  50551. destroy() {
  50552. super.destroy();
  50553. }
  50554. /**
  50555. * @function GetFeaturesByBoundsService.prototype.getJsonParameters
  50556. * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry,Bounds等)。
  50557. * @param params {GetFeaturesByBoundsParameters}
  50558. * @returns {string} 转化后的 JSON 字符串。
  50559. *
  50560. */
  50561. getJsonParameters(params) {
  50562. return GetFeaturesByBoundsParameters.toJsonParameters(params);
  50563. }
  50564. }
  50565. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferParameters.js
  50566. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50567. * This program are made available under the terms of the Apache License, Version 2.0
  50568. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50569. /**
  50570. * @class GetFeaturesByBufferParameters
  50571. * @deprecatedclass SuperMap.GetFeaturesByBufferParameters
  50572. * @category iServer Data FeatureResults
  50573. * @classdesc 数据集缓冲区查询参数类。
  50574. * @param {Object} options - 参数。
  50575. * @param {number} options.bufferDistance - buffer 距离,单位与所查询图层对应的数据集单位相同。
  50576. * @param {GeoJSONObject} options.geometry - 空间查询条件。
  50577. * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
  50578. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  50579. * @param {string} [options.attributeFilter] - 属性查询条件。
  50580. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  50581. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  50582. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  50583. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  50584. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  50585. * @extends {GetFeaturesParametersBase}
  50586. * @usage
  50587. */
  50588. class GetFeaturesByBufferParameters extends GetFeaturesParametersBase {
  50589. constructor(options) {
  50590. super(options);
  50591. /**
  50592. * @member {number} GetFeaturesByBufferParameters.prototype.bufferDistance
  50593. * @description buffer 距离,单位与所查询图层对应的数据集单位相同。
  50594. */
  50595. this.bufferDistance = null;
  50596. /**
  50597. * @member {string} GetFeaturesByBufferParameters.prototype.attributeFilter
  50598. * @description 属性查询条件。
  50599. */
  50600. this.attributeFilter = null;
  50601. /**
  50602. * @member {GeoJSONObject} GetFeaturesByBufferParameters.prototype.geometry
  50603. * @description 空间查询条件。<br>
  50604. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLat}|{@link mapboxgl.Point}|{@link GeoJSONObject}。</br>
  50605. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。</br>
  50606. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
  50607. */
  50608. this.geometry = null;
  50609. /**
  50610. * @member {Array.<string>} GetFeaturesByBufferParameters.prototype.fields
  50611. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  50612. */
  50613. this.fields = null;
  50614. Util_Util.extend(this, options);
  50615. this.CLASS_NAME = 'SuperMap.GetFeaturesByBufferParameters';
  50616. }
  50617. /**
  50618. * @function GetFeaturesByBufferParameters.prototype.destroy
  50619. * @override
  50620. */
  50621. destroy() {
  50622. super.destroy();
  50623. var me = this;
  50624. me.bufferDistance = null;
  50625. me.attributeFilter = null;
  50626. if (me.fields) {
  50627. while (me.fields.length > 0) {
  50628. me.fields.pop();
  50629. }
  50630. me.fields = null;
  50631. }
  50632. if (me.geometry) {
  50633. me.geometry.destroy();
  50634. me.geometry = null;
  50635. }
  50636. }
  50637. /**
  50638. * @function GetFeaturesByBufferParameters.toJsonParameters
  50639. * @description 将 GetFeaturesByBufferParameters 对象转换为 JSON 字符串。
  50640. * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数对象。
  50641. * @returns {string} 转化后的 JSON 字符串。
  50642. */
  50643. static toJsonParameters(params) {
  50644. var filterParameter, paramsByBuffer, geometry;
  50645. geometry = ServerGeometry.fromGeometry(params.geometry);
  50646. paramsByBuffer = {
  50647. datasetNames: params.datasetNames,
  50648. getFeatureMode: 'BUFFER',
  50649. bufferDistance: params.bufferDistance,
  50650. geometry: geometry
  50651. };
  50652. if (params.fields) {
  50653. filterParameter = new FilterParameter();
  50654. filterParameter.name = params.datasetNames;
  50655. filterParameter.fields = params.fields;
  50656. paramsByBuffer.queryParameter = filterParameter;
  50657. }
  50658. if (params.attributeFilter) {
  50659. paramsByBuffer.attributeFilter = params.attributeFilter;
  50660. paramsByBuffer.getFeatureMode = 'BUFFER_ATTRIBUTEFILTER';
  50661. }
  50662. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  50663. paramsByBuffer.maxFeatures = params.maxFeatures;
  50664. }
  50665. if (typeof params.hasGeometry === 'boolean') {
  50666. paramsByBuffer.hasGeometry = params.hasGeometry;
  50667. }
  50668. if (params.targetEpsgCode) {
  50669. paramsByBuffer.targetEpsgCode = params.targetEpsgCode;
  50670. }
  50671. if (!params.targetEpsgCode && params.targetPrj) {
  50672. paramsByBuffer.targetPrj = params.targetPrj;
  50673. }
  50674. return Util_Util.toJSON(paramsByBuffer);
  50675. }
  50676. }
  50677. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferService.js
  50678. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50679. * This program are made available under the terms of the Apache License, Version 2.0
  50680. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50681. /**
  50682. * @class GetFeaturesByBufferService
  50683. * @deprecatedclass SuperMap.GetFeaturesByBufferService
  50684. * @category iServer Data FeatureResults
  50685. * @classdesc 数据服务中数据集缓冲区查询服务类。
  50686. * @param {string} url - 服务地址。请求数据服务中数据集查询服务,
  50687. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
  50688. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  50689. * @param {Object} options - 参数。
  50690. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  50691. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  50692. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  50693. * @param {Object} [options.headers] - 请求头。
  50694. * @extends {GetFeaturesServiceBase}
  50695. * @example
  50696. * var myGetFeaturesByBufferService = new GetFeaturesByBufferService(url, {
  50697. * eventListeners: {
  50698. * "processCompleted": GetFeaturesCompleted,
  50699. * "processFailed": GetFeaturesError
  50700. * }
  50701. * });
  50702. * function GetFeaturesCompleted(object){//todo};
  50703. * function GetFeaturesError(object){//todo};
  50704. * @usage
  50705. */
  50706. class GetFeaturesByBufferService extends GetFeaturesServiceBase {
  50707. constructor(url, options) {
  50708. super(url, options);
  50709. this.CLASS_NAME = "SuperMap.GetFeaturesByBufferService";
  50710. }
  50711. /**
  50712. * @function GetFeaturesByBufferService.prototype.destroy
  50713. * @override
  50714. */
  50715. destroy() {
  50716. super.destroy();
  50717. }
  50718. /**
  50719. * @function GetFeaturesByBufferService.prototype.getJsonParameters
  50720. * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(IDs, SQL, Buffer, Geometry等)。
  50721. * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
  50722. * @returns {Object} 转化后的 JSON 字符串。
  50723. */
  50724. getJsonParameters(params) {
  50725. if (!(params instanceof GetFeaturesByBufferParameters)) {
  50726. return;
  50727. }
  50728. return GetFeaturesByBufferParameters.toJsonParameters(params);
  50729. }
  50730. }
  50731. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryParameters.js
  50732. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50733. * This program are made available under the terms of the Apache License, Version 2.0
  50734. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50735. /**
  50736. * @class GetFeaturesByGeometryParameters
  50737. * @deprecatedclass SuperMap.GetFeaturesByGeometryParameters
  50738. * @category iServer Data FeatureResults
  50739. * @classdesc 数据集几何查询参数类。该类用于设置数据集几何查询的相关参数。
  50740. * @param {Object} options - 参数。
  50741. * @param {GeoJSONObject} options.geometry - 查询的几何对象。
  50742. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  50743. * @param {string} [options.attributeFilter] - 几何查询属性过滤条件。
  50744. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  50745. * @param {SpatialQueryMode} [options.spatialQueryMode=SpatialQueryMode.CONTAIN] - 空间查询模式常量。
  50746. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  50747. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  50748. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  50749. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  50750. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  50751. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  50752. * @extends {GetFeaturesParametersBase}
  50753. * @usage
  50754. */
  50755. class GetFeaturesByGeometryParameters extends GetFeaturesParametersBase {
  50756. constructor(options) {
  50757. super(options);
  50758. /**
  50759. * @member {string} GetFeaturesByGeometryParameters.prototype.getFeatureMode
  50760. * @description 数据集查询模式。几何查询有 "SPATIAL","SPATIAL_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 SPATIAL_ATTRIBUTEFILTER 访问服务。
  50761. */
  50762. this.getFeatureMode = 'SPATIAL';
  50763. /**
  50764. * @member {GeoJSONObject} GetFeaturesByGeometryParameters.prototype.geometry
  50765. * @description 用于查询的几何对象。 </br>
  50766. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLat}|{@link mapboxgl.Point}|{@link GeoJSONObject}。</br>
  50767. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。</br>
  50768. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
  50769. */
  50770. this.geometry = null;
  50771. /**
  50772. * @member {Array.<string>} GetFeaturesByGeometryParameters.prototype.fields
  50773. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  50774. */
  50775. this.fields = null;
  50776. /**
  50777. * @member {string} GetFeaturesByGeometryParameters.prototype.attributeFilter
  50778. * @description 几何查询属性过滤条件。
  50779. */
  50780. this.attributeFilter = null;
  50781. /**
  50782. * @member {SpatialQueryMode} [GetFeaturesByGeometryParameters.prototype.spatialQueryMode=SpatialQueryMode.CONTAIN]
  50783. * @description 空间查询模式常量。
  50784. */
  50785. this.spatialQueryMode = SpatialQueryMode.CONTAIN;
  50786. Util_Util.extend(this, options);
  50787. this.CLASS_NAME = 'SuperMap.GetFeaturesByGeometryParameters';
  50788. }
  50789. /**
  50790. * @function GetFeaturesByGeometryParameters.prototype.destroy
  50791. * @description 释放资源,将引用资源的属性置空。
  50792. */
  50793. destroy() {
  50794. super.destroy();
  50795. var me = this;
  50796. if (me.geometry) {
  50797. me.geometry.destroy();
  50798. me.geometry = null;
  50799. }
  50800. if (me.fields) {
  50801. while (me.fields.length > 0) {
  50802. me.fields.pop();
  50803. }
  50804. me.fields = null;
  50805. }
  50806. me.attributeFilter = null;
  50807. me.spatialQueryMode = null;
  50808. me.getFeatureMode = null;
  50809. }
  50810. /**
  50811. * @function GetFeaturesByGeometryParameters.toJsonParameters
  50812. * @description 将 GetFeaturesByGeometryParameters 对象参数转换为 JSON 字符串。
  50813. * @param {GetFeaturesByGeometryParameters} params - 查询参数对象。
  50814. * @returns {string} 转化后的 JSON 字符串。
  50815. */
  50816. static toJsonParameters(params) {
  50817. var filterParameter, geometry, parasByGeometry;
  50818. geometry = ServerGeometry.fromGeometry(params.geometry);
  50819. parasByGeometry = {
  50820. datasetNames: params.datasetNames,
  50821. getFeatureMode: 'SPATIAL',
  50822. geometry: geometry,
  50823. spatialQueryMode: params.spatialQueryMode
  50824. };
  50825. if (params.fields) {
  50826. filterParameter = new FilterParameter();
  50827. filterParameter.name = params.datasetNames;
  50828. filterParameter.fields = params.fields;
  50829. parasByGeometry.queryParameter = filterParameter;
  50830. }
  50831. if (params.attributeFilter) {
  50832. parasByGeometry.attributeFilter = params.attributeFilter;
  50833. parasByGeometry.getFeatureMode = 'SPATIAL_ATTRIBUTEFILTER';
  50834. }
  50835. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  50836. parasByGeometry.maxFeatures = params.maxFeatures;
  50837. }
  50838. if (typeof params.hasGeometry === 'boolean') {
  50839. parasByGeometry.hasGeometry = params.hasGeometry;
  50840. }
  50841. if (params.targetEpsgCode) {
  50842. parasByGeometry.targetEpsgCode = params.targetEpsgCode;
  50843. }
  50844. if (!params.targetEpsgCode && params.targetPrj) {
  50845. parasByGeometry.targetPrj = params.targetPrj;
  50846. }
  50847. if (params.aggregations) {
  50848. parasByGeometry.aggregations = params.aggregations;
  50849. }
  50850. return Util_Util.toJSON(parasByGeometry);
  50851. }
  50852. }
  50853. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryService.js
  50854. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50855. * This program are made available under the terms of the Apache License, Version 2.0
  50856. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50857. /**
  50858. * @class GetFeaturesByGeometryService
  50859. * @deprecatedclass SuperMap.GetFeaturesByGeometryService
  50860. * @category iServer Data FeatureResults
  50861. * @classdesc 数据集几何查询服务类,查询与指定几何对象符合一定空间关系的矢量要素。
  50862. * @param {string} url - 服务地址。请求数据服务中数据集查询服务。
  50863. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data;
  50864. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data"
  50865. * @param {Object} options - 参数。
  50866. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  50867. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  50868. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  50869. * @param {Object} [options.headers] - 请求头。
  50870. * @extends {GetFeaturesServiceBase}
  50871. * @example
  50872. * var myService = new GetFeaturesByGeometryService(url, {
  50873. * eventListeners: {
  50874. * "processCompleted": getFeatureCompleted,
  50875. * "processFailed": getFeatureError
  50876. * }
  50877. * });
  50878. * function getFeatureCompleted(object){//todo};
  50879. * function getFeatureError(object){//todo}
  50880. * @usage
  50881. */
  50882. class GetFeaturesByGeometryService extends GetFeaturesServiceBase {
  50883. constructor(url, options) {
  50884. super(url, options);
  50885. this.CLASS_NAME = "SuperMap.GetFeaturesByGeometryService";
  50886. }
  50887. /**
  50888. * @function GetFeaturesByGeometryService.prototype.destroy
  50889. * @override
  50890. */
  50891. destroy() {
  50892. super.destroy();
  50893. }
  50894. /**
  50895. * @function GetFeaturesByGeometryService.prototype.getJsonParameters
  50896. * @param {GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
  50897. * @description 将查询参数转化为 JSON 字符串。
  50898. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  50899. * @returns {Object} 转化后的 JSON 字符串。
  50900. */
  50901. getJsonParameters(params) {
  50902. return GetFeaturesByGeometryParameters.toJsonParameters(params);
  50903. }
  50904. }
  50905. ;// CONCATENATED MODULE: ./src/common/iServer/FeatureService.js
  50906. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50907. * This program are made available under the terms of the Apache License, Version 2.0
  50908. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50909. /**
  50910. * @class FeatureService
  50911. * @constructs FeatureService
  50912. * @category iServer Data Feature
  50913. * @classdesc 数据集类。提供:ID 查询,范围查询,SQL查询,几何查询,bounds 查询,缓冲区查询,地物编辑。
  50914. * @example
  50915. * new FeatureService(url).getFeaturesByIDs(param,function(result){
  50916. * //doSomething
  50917. * })
  50918. * @param {string} url - 服务地址。
  50919. * @param {Object} options - 参数。
  50920. * @param {string} [options.proxy] - 服务代理地址。
  50921. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  50922. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  50923. * @param {Object} [options.headers] - 请求头。
  50924. * @extends {ServiceBase}
  50925. * @usage
  50926. */
  50927. class FeatureService_FeatureService {
  50928. constructor(url, options) {
  50929. this.url = url;
  50930. this.options = options || {};
  50931. }
  50932. /**
  50933. * @function FeatureService.prototype.getFeaturesByIDs
  50934. * @description 数据集 ID 查询服务。
  50935. * @param {GetFeaturesByIDsParameters} params - ID查询参数类。
  50936. * @param {RequestCallback} callback - 回调函数。
  50937. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  50938. */
  50939. getFeaturesByIDs(params, callback, resultFormat) {
  50940. var me = this;
  50941. var getFeaturesByIDsService = new GetFeaturesByIDsService(me.url, {
  50942. proxy: me.options.proxy,
  50943. withCredentials: me.options.withCredentials,
  50944. crossOrigin: me.options.crossOrigin,
  50945. headers: me.options.headers,
  50946. eventListeners: {
  50947. processCompleted: callback,
  50948. processFailed: callback
  50949. },
  50950. format: resultFormat
  50951. });
  50952. getFeaturesByIDsService.processAsync(params);
  50953. }
  50954. /**
  50955. * @function FeatureService.prototype.getFeaturesByBounds
  50956. * @description 数据集 Bounds 查询服务。
  50957. * @param {GetFeaturesByBoundsParameters} params - 数据集范围查询参数类。
  50958. * @param {RequestCallback} callback - 回调函数。
  50959. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  50960. */
  50961. getFeaturesByBounds(params, callback, resultFormat) {
  50962. var me = this;
  50963. var getFeaturesByBoundsService = new GetFeaturesByBoundsService(me.url, {
  50964. proxy: me.options.proxy,
  50965. withCredentials: me.options.withCredentials,
  50966. crossOrigin: me.options.crossOrigin,
  50967. headers: me.options.headers,
  50968. eventListeners: {
  50969. processCompleted: callback,
  50970. processFailed: callback
  50971. },
  50972. format: me._processFormat(resultFormat)
  50973. });
  50974. getFeaturesByBoundsService.processAsync(params);
  50975. }
  50976. /**
  50977. * @function FeatureService.prototype.getFeaturesByBuffer
  50978. * @description 数据集 Buffer 查询服务。
  50979. * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
  50980. * @param {RequestCallback} callback - 回调函数。
  50981. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  50982. */
  50983. getFeaturesByBuffer(params, callback, resultFormat) {
  50984. var me = this;
  50985. var getFeatureService = new GetFeaturesByBufferService(me.url, {
  50986. proxy: me.options.proxy,
  50987. withCredentials: me.options.withCredentials,
  50988. crossOrigin: me.options.crossOrigin,
  50989. headers: me.options.headers,
  50990. eventListeners: {
  50991. processCompleted: callback,
  50992. processFailed: callback
  50993. },
  50994. format: me._processFormat(resultFormat)
  50995. });
  50996. getFeatureService.processAsync(params);
  50997. }
  50998. /**
  50999. * @function FeatureService.prototype.getFeaturesBySQL
  51000. * @description 数据集 SQL 查询服务。
  51001. * @param {GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数类。
  51002. * @param {RequestCallback} callback - 回调函数。
  51003. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  51004. */
  51005. getFeaturesBySQL(params, callback, resultFormat) {
  51006. var me = this;
  51007. var getFeatureBySQLService = new GetFeaturesBySQLService(me.url, {
  51008. proxy: me.options.proxy,
  51009. withCredentials: me.options.withCredentials,
  51010. crossOrigin: me.options.crossOrigin,
  51011. headers: me.options.headers,
  51012. eventListeners: {
  51013. processCompleted: callback,
  51014. processFailed: callback
  51015. },
  51016. format: me._processFormat(resultFormat)
  51017. });
  51018. getFeatureBySQLService.processAsync(params);
  51019. }
  51020. /**
  51021. * @function FeatureService.prototype.getFeaturesByGeometry
  51022. * @description 数据集几何查询服务类。
  51023. * @param {GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
  51024. * @param {RequestCallback} callback - 回调函数。
  51025. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  51026. */
  51027. getFeaturesByGeometry(params, callback, resultFormat) {
  51028. var me = this;
  51029. var getFeaturesByGeometryService = new GetFeaturesByGeometryService(me.url, {
  51030. proxy: me.options.proxy,
  51031. withCredentials: me.options.withCredentials,
  51032. crossOrigin: me.options.crossOrigin,
  51033. headers: me.options.headers,
  51034. eventListeners: {
  51035. processCompleted: callback,
  51036. processFailed: callback
  51037. },
  51038. format: me._processFormat(resultFormat)
  51039. });
  51040. getFeaturesByGeometryService.processAsync(params);
  51041. }
  51042. /**
  51043. * @function FeatureService.prototype.editFeatures
  51044. * @description 地物编辑服务。
  51045. * @param {EditFeaturesParameters} params - 数据服务中数据集添加、修改、删除参数类。
  51046. * @param {RequestCallback} callback - 回调函数。
  51047. */
  51048. editFeatures(params, callback) {
  51049. if (!params || !params.dataSourceName || !params.dataSetName) {
  51050. return;
  51051. }
  51052. var me = this,
  51053. url = me.url,
  51054. dataSourceName = params.dataSourceName,
  51055. dataSetName = params.dataSetName;
  51056. url = Util_Util.urlPathAppend(url, "datasources/" + dataSourceName + "/datasets/" + dataSetName);
  51057. var editFeatureService = new EditFeaturesService(url, {
  51058. proxy: me.options.proxy,
  51059. withCredentials: me.options.withCredentials,
  51060. crossOrigin: me.options.crossOrigin,
  51061. headers: me.options.headers,
  51062. eventListeners: {
  51063. processCompleted: callback,
  51064. processFailed: callback
  51065. }
  51066. });
  51067. editFeatureService.processAsync(params);
  51068. }
  51069. _processFormat(resultFormat) {
  51070. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  51071. }
  51072. }
  51073. ;// CONCATENATED MODULE: ./src/mapboxgl/services/FeatureService.js
  51074. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51075. * This program are made available under the terms of the Apache License, Version 2.0
  51076. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51077. /**
  51078. * @class FeatureService
  51079. * @category iServer Data Feature
  51080. * @classdesc 要素数据集类。提供:ID 查询、范围查询、SQL 查询、几何查询、bounds 查询、缓冲区查询、地物编辑。
  51081. * @modulecategory Services
  51082. * @example
  51083. * new FeatureService(url)
  51084. * .getFeaturesByIDs(param,function(result){
  51085. * //doSomething
  51086. * })
  51087. * @extends {ServiceBase}
  51088. * @param {string} url - 服务地址。
  51089. * @param {Object} options -参数。
  51090. * @param {string} [options.proxy] - 服务代理地址。
  51091. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  51092. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  51093. * @param {Object} [options.headers] - 请求头。
  51094. * @usage
  51095. */
  51096. class FeatureService extends ServiceBase {
  51097. constructor(url, options) {
  51098. super(url, options);
  51099. this._featureService = new FeatureService_FeatureService(url, options);
  51100. }
  51101. /**
  51102. * @function FeatureService.prototype.getFeaturesByIDs
  51103. * @description 数据集 ID 查询服务。
  51104. * @param {GetFeaturesByIDsParameters} params - ID查询参数类。
  51105. * @param {RequestCallback} callback - 回调函数。
  51106. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  51107. */
  51108. getFeaturesByIDs(params, callback, resultFormat) {
  51109. params = this._processParams(params);
  51110. this._featureService.getFeaturesByIDs(params, callback, resultFormat);
  51111. }
  51112. /**
  51113. * @function FeatureService.prototype.getFeaturesByBounds
  51114. * @description 数据集 Bounds 查询服务。
  51115. * @param {GetFeaturesByBoundsParameters} params - 数据集范围查询参数类。
  51116. * @param {RequestCallback} callback - 回调函数。
  51117. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  51118. */
  51119. getFeaturesByBounds(params, callback, resultFormat) {
  51120. params = this._processParams(params);
  51121. this._featureService.getFeaturesByBounds(params, callback, resultFormat);
  51122. }
  51123. /**
  51124. * @function FeatureService.prototype.getFeaturesByBuffer
  51125. * @description 数据集 Buffer 查询服务。
  51126. * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
  51127. * @param {RequestCallback} callback 回调函数。
  51128. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  51129. */
  51130. getFeaturesByBuffer(params, callback, resultFormat) {
  51131. params = this._processParams(params);
  51132. this._featureService.getFeaturesByBuffer(params, callback, resultFormat);
  51133. }
  51134. /**
  51135. * @function FeatureService.prototype.getFeaturesBySQL
  51136. * @description 数据集 SQL 查询服务。
  51137. * @param {GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数类。
  51138. * @param {RequestCallback} callback 回调函数。
  51139. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  51140. */
  51141. getFeaturesBySQL(params, callback, resultFormat) {
  51142. params = this._processParams(params);
  51143. this._featureService.getFeaturesBySQL(params, callback, resultFormat);
  51144. }
  51145. /**
  51146. * @function FeatureService.prototype.getFeaturesByGeometry
  51147. * @description 数据集几何查询服务类。
  51148. * @param {GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
  51149. * @param {RequestCallback} callback - 回调函数。
  51150. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  51151. */
  51152. getFeaturesByGeometry(params, callback, resultFormat) {
  51153. params = this._processParams(params);
  51154. this._featureService.getFeaturesByGeometry(params, callback, resultFormat);
  51155. }
  51156. /**
  51157. * @function FeatureService.prototype.editFeatures
  51158. * @description 地物编辑服务。
  51159. * @param {EditFeaturesParameters} params - 数据集添加、修改、删除参数类。
  51160. * @param {RequestCallback} callback 回调函数。
  51161. */
  51162. editFeatures(params, callback) {
  51163. if (!params || !params.dataSourceName || !params.dataSetName) {
  51164. return;
  51165. }
  51166. var me = this,
  51167. url = me.url,
  51168. dataSourceName = params.dataSourceName,
  51169. dataSetName = params.dataSetName;
  51170. url = Util_Util.urlPathAppend(url, 'datasources/' + dataSourceName + '/datasets/' + dataSetName);
  51171. var editFeatureService = new EditFeaturesService(url, {
  51172. proxy: me.options.proxy,
  51173. withCredentials: me.options.withCredentials,
  51174. crossOrigin: me.options.crossOrigin,
  51175. headers: me.options.headers,
  51176. eventListeners: {
  51177. processCompleted: callback,
  51178. processFailed: callback
  51179. }
  51180. });
  51181. editFeatureService.processAsync(me._processParams(params));
  51182. }
  51183. /**
  51184. * @private
  51185. * @description 参数类型转换。
  51186. * @param {Object} params - 参数 。
  51187. * @returns {Object} params - 转换后的对接 SuperMap 服务的参数。
  51188. */
  51189. _processParams(params) {
  51190. if (!params) {
  51191. return {};
  51192. }
  51193. var me = this;
  51194. params.returnContent = params.returnContent == null ? true : params.returnContent;
  51195. params.fromIndex = params.fromIndex ? params.fromIndex : 0;
  51196. params.toIndex = params.toIndex === 0 ? 0 : params.toIndex ? params.toIndex : -1;
  51197. if (params.bounds) {
  51198. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  51199. }
  51200. if (params.editType) {
  51201. params.editType = params.editType.toLowerCase();
  51202. }
  51203. //mapboxgl geojson要素对象转 SuperMap Geometry 对象
  51204. if (params.geometry) {
  51205. if (params.geometry instanceof (external_mapboxgl_default()).LngLatBounds) {
  51206. params.geometry = core_Util_Util.toSuperMapPolygon(params.geometry);
  51207. params.geometry.SRID = 4326;
  51208. } else if (params.geometry instanceof (external_mapboxgl_default()).Point) {
  51209. params.geometry = new Point(params.geometry.x, params.geometry.y);
  51210. } else if (params.geometry instanceof (external_mapboxgl_default()).LngLat) {
  51211. params.geometry = new Point(params.geometry.lng, params.geometry.lat);
  51212. params.geometry.SRID = 4326;
  51213. } else if (!(params.geometry instanceof Geometry_Geometry)) {
  51214. params.geometry = core_Util_Util.toSuperMapGeometry(params.geometry);
  51215. }
  51216. }
  51217. //editFeature服务参数转换,传入单独得对象或对象数组
  51218. if (params.features) {
  51219. var features = [];
  51220. if (core_Util_Util.isArray(params.features)) {
  51221. params.features.map(function (feature) {
  51222. features.push(me._createServerFeature(feature));
  51223. return features;
  51224. });
  51225. } else {
  51226. features.push(me._createServerFeature(params.features));
  51227. }
  51228. params.features = features;
  51229. }
  51230. return params;
  51231. }
  51232. //geoFeature严格按照 mapboxgl geojson的结构
  51233. _createServerFeature(geoFeature) {
  51234. var feature = {},
  51235. fieldNames = [],
  51236. fieldValues = [];
  51237. var properties = geoFeature.properties;
  51238. for (var key in properties) {
  51239. fieldNames.push(key);
  51240. fieldValues.push(properties[key]);
  51241. }
  51242. feature.fieldNames = fieldNames;
  51243. feature.fieldValues = fieldValues;
  51244. if (geoFeature.id) {
  51245. feature.id = geoFeature.id;
  51246. }
  51247. feature.geometry = core_Util_Util.toSuperMapGeometry(geoFeature);
  51248. return feature;
  51249. }
  51250. }
  51251. ;// CONCATENATED MODULE: ./src/common/iServer/GetFieldsService.js
  51252. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51253. * This program are made available under the terms of the Apache License, Version 2.0
  51254. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51255. /**
  51256. * @class GetFieldsService
  51257. * @deprecatedclass SuperMap.GetFieldsService
  51258. * @category iServer Data Field
  51259. * @classdesc 字段查询服务,支持查询指定数据集的中所有属性字段(field)的集合。
  51260. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  51261. * @param {Object} options - 参数。
  51262. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  51263. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  51264. * @param {string}options.datasource - 数据源名称。
  51265. * @param {string}options.dataset - 数据集名称。
  51266. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  51267. * @param {Object} [options.headers] - 请求头。
  51268. * @extends {CommonServiceBase}
  51269. * @example
  51270. * var myService = new GetFieldsService(url, {eventListeners: {
  51271. * "processCompleted": getFieldsCompleted,
  51272. * "processFailed": getFieldsError
  51273. * },
  51274. * datasource: "World",
  51275. * dataset: "Countries"
  51276. * };
  51277. * @usage
  51278. */
  51279. class GetFieldsService extends CommonServiceBase {
  51280. constructor(url, options) {
  51281. super(url, options);
  51282. /**
  51283. * @member {string} GetFieldsService.prototype.datasource
  51284. * @description 要查询的数据集所在的数据源名称。
  51285. */
  51286. this.datasource = null;
  51287. /**
  51288. * @member {string} GetFieldsService.prototype.dataset
  51289. * @description 要查询的数据集名称。
  51290. */
  51291. this.dataset = null;
  51292. if (options) {
  51293. Util_Util.extend(this, options);
  51294. }
  51295. this.CLASS_NAME = "SuperMap.GetFieldsService";
  51296. }
  51297. /**
  51298. * @function GetFieldsService.prototype.destroy
  51299. * @override
  51300. */
  51301. destroy() {
  51302. super.destroy();
  51303. var me = this;
  51304. me.datasource = null;
  51305. me.dataset = null;
  51306. }
  51307. /**
  51308. * @function GetFieldsService.prototype.processAsync
  51309. * @description 执行服务,查询指定数据集的字段信息。
  51310. */
  51311. processAsync() {
  51312. var me = this;
  51313. me.url = Util_Util.urlPathAppend(me.url,`datasources/${me.datasource}/datasets/${me.dataset}/fields`);
  51314. me.request({
  51315. method: "GET",
  51316. data: null,
  51317. scope: me,
  51318. success: me.serviceProcessCompleted,
  51319. failure: me.serviceProcessFailed
  51320. });
  51321. }
  51322. }
  51323. ;// CONCATENATED MODULE: ./src/common/iServer/FieldParameters.js
  51324. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51325. * This program are made available under the terms of the Apache License, Version 2.0
  51326. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51327. /**
  51328. * @class FieldParameters
  51329. * @deprecatedclass SuperMap.FieldParameters
  51330. * @category iServer Data Field
  51331. * @classdesc 字段信息查询参数类。
  51332. * @param {Object} options - 参数。
  51333. * @param {string} options.datasource - 数据源名称。
  51334. * @param {string} options.dataset - 数据集名称。
  51335. * @usage
  51336. */
  51337. class FieldParameters {
  51338. constructor(options) {
  51339. /**
  51340. * @member {string} FieldParameters.prototype.datasource
  51341. * @description 要查询的数据集所在的数据源名称。
  51342. */
  51343. this.datasource = null;
  51344. /**
  51345. * @member {string} FieldParameters.prototype.dataset
  51346. * @description 要查询的数据集名称。
  51347. */
  51348. this.dataset = null;
  51349. if (options) {
  51350. Util_Util.extend(this, options);
  51351. }
  51352. this.CLASS_NAME = "SuperMap.FieldParameters";
  51353. }
  51354. /**
  51355. * @function FieldParameters.prototype.destroy
  51356. * @description 释放资源,将引用资源的属性置空。
  51357. */
  51358. destroy() {
  51359. var me = this;
  51360. me.datasource = null;
  51361. me.dataset = null;
  51362. }
  51363. }
  51364. ;// CONCATENATED MODULE: ./src/common/iServer/FieldStatisticsParameters.js
  51365. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51366. * This program are made available under the terms of the Apache License, Version 2.0
  51367. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51368. /**
  51369. * @class FieldStatisticsParameters
  51370. * @deprecatedclass SuperMap.FieldStatisticsParameters
  51371. * @category iServer Data Field
  51372. * @classdesc 字段统计信息查询参数类。
  51373. * @param {Object} options - 参数。
  51374. * @param {string} options.datasource - 数据源名称。
  51375. * @param {string} options.dataset - 数据集名称。
  51376. * @param {string} options.fieldName - 字段名。
  51377. * @param {(string.<StatisticMode>|Array.<string.<StatisticMode>>)} statisticMode - 字段统计方法类型。
  51378. * @extends {FieldParameters}
  51379. * @usage
  51380. */
  51381. class FieldStatisticsParameters extends FieldParameters {
  51382. constructor(options) {
  51383. super(options);
  51384. /**
  51385. * @member {string} FieldStatisticsParameters.prototype.fieldName
  51386. * @description 字段名。
  51387. */
  51388. this.fieldName = null;
  51389. /**
  51390. * @member {(string.<StatisticMode>|Array.<string.<StatisticMode>>)} FieldStatisticsParameters.prototype.statisticMode
  51391. * @description 字段统计方法类型。
  51392. */
  51393. this.statisticMode = null;
  51394. if (options) {
  51395. Util_Util.extend(this, options);
  51396. }
  51397. this.CLASS_NAME = "SuperMap.FieldStatisticsParameters";
  51398. }
  51399. /**
  51400. * @function FieldStatisticsParameters.prototype.destroy
  51401. * @description 释放资源,将引用资源的属性置空。
  51402. */
  51403. destroy() {
  51404. var me = this;
  51405. me.fieldName = null;
  51406. me.statisticMode = null;
  51407. }
  51408. }
  51409. ;// CONCATENATED MODULE: ./src/common/iServer/FieldStatisticService.js
  51410. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51411. * This program are made available under the terms of the Apache License, Version 2.0
  51412. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51413. /**
  51414. * @class FieldStatisticService
  51415. * @deprecatedclass SuperMap.FieldStatisticService
  51416. * @category iServer Data Field
  51417. * @classdesc 字段查询统计服务类。用来完成对指定数据集指定字段的查询统计分析,即求平均值,最大值等。
  51418. * @extends {CommonServiceBase}
  51419. * @param {string} url - 服务地址。如访问 World Map 服务,只需将 url 设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  51420. * @param {Object} options - 参数。
  51421. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  51422. * @param {DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  51423. * @param {string} options.datasource - 数据集所在的数据源名称。
  51424. * @param {string} options.dataset - 数据集名称。
  51425. * @param {string} options.field - 查询统计的目标字段名称。
  51426. * @param {StatisticMode} options.statisticMode - 字段查询统计的方法类型。
  51427. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  51428. * @param {Object} [options.headers] - 请求头。
  51429. * @example
  51430. * var myService = new FieldStatisticService(url, {eventListeners: {
  51431. * "processCompleted": fieldStatisticCompleted,
  51432. * "processFailed": fieldStatisticError
  51433. * },
  51434. * datasource: "World",
  51435. * dataset: "Countries",
  51436. * field: "SmID",
  51437. * statisticMode: StatisticMode.AVERAGE
  51438. * };
  51439. * @usage
  51440. */
  51441. class FieldStatisticService extends CommonServiceBase {
  51442. constructor(url, options) {
  51443. super(url, options);
  51444. /**
  51445. * @member {string} FieldStatisticService.prototype.datasource
  51446. * @description 数据集所在的数据源名称。
  51447. */
  51448. this.datasource = null;
  51449. /**
  51450. * @member {string} FieldStatisticService.prototype.dataset
  51451. * @description 数据集名称。
  51452. */
  51453. this.dataset = null;
  51454. /**
  51455. * @member {string} FieldStatisticService.prototype.field
  51456. * @description 查询统计的目标字段名称。
  51457. */
  51458. this.field = null;
  51459. /**
  51460. * @member {StatisticMode} FieldStatisticService.prototype.statisticMode
  51461. * @description 字段查询统计的方法类型。
  51462. */
  51463. this.statisticMode = null;
  51464. if (options) {
  51465. Util_Util.extend(this, options);
  51466. }
  51467. this.CLASS_NAME = "SuperMap.FieldStatisticService";
  51468. }
  51469. /**
  51470. * @function FieldStatisticService.prototype.destroy
  51471. * @override
  51472. */
  51473. destroy() {
  51474. super.destroy();
  51475. var me = this;
  51476. me.datasource = null;
  51477. me.dataset = null;
  51478. me.field = null;
  51479. me.statisticMode = null;
  51480. }
  51481. /**
  51482. * @function FieldStatisticService.prototype.processAsync
  51483. * @description 执行服务,进行指定字段的查询统计。
  51484. */
  51485. processAsync() {
  51486. var me = this,
  51487. fieldStatisticURL = "datasources/" + me.datasource + "/datasets/" + me.dataset + "/fields/" + me.field + "/" + me.statisticMode;
  51488. me.url = Util_Util.urlPathAppend(me.url, fieldStatisticURL);
  51489. me.request({
  51490. method: "GET",
  51491. data: null,
  51492. scope: me,
  51493. success: me.serviceProcessCompleted,
  51494. failure: me.serviceProcessFailed
  51495. });
  51496. }
  51497. }
  51498. ;// CONCATENATED MODULE: ./src/common/iServer/FieldService.js
  51499. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51500. * This program are made available under the terms of the Apache License, Version 2.0
  51501. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51502. /**
  51503. * @class FieldService
  51504. * @category iServer Data Field
  51505. * @classdesc 字段服务类。
  51506. * @example
  51507. * new FieldService(url).getFields(function(result){
  51508. * //doSomething
  51509. * });
  51510. * @param {string} url - 服务地址。
  51511. * @param {Object} options - 参数。
  51512. * @param {string} [options.proxy] - 服务代理地址。
  51513. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  51514. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  51515. * @param {Object} [options.headers] - 请求头。
  51516. * @extends {ServiceBase}
  51517. * @usage
  51518. */
  51519. class FieldService_FieldService {
  51520. constructor(url, options) {
  51521. this.url = url;
  51522. this.options = options || {};
  51523. }
  51524. /**
  51525. * @function FieldService.prototype.getFields
  51526. * @description 字段查询服务。
  51527. * @param {FieldParameters} params - 字段信息查询参数类。
  51528. * @param {RequestCallback} callback 回调函数。
  51529. */
  51530. getFields(params, callback) {
  51531. var me = this;
  51532. var getFieldsService = new GetFieldsService(me.url, {
  51533. proxy: me.options.proxy,
  51534. withCredentials: me.options.withCredentials,
  51535. crossOrigin: me.options.crossOrigin,
  51536. headers: me.options.headers,
  51537. eventListeners: {
  51538. scope: me,
  51539. processCompleted: callback,
  51540. processFailed: callback
  51541. },
  51542. datasource: params.datasource,
  51543. dataset: params.dataset
  51544. });
  51545. getFieldsService.processAsync();
  51546. }
  51547. /**
  51548. * @function FieldService.prototype.getFieldStatisticsInfo
  51549. * @description 字段统计服务。
  51550. * @param {FieldStatisticsParameters} params - 字段统计信息查询参数类。
  51551. * @param {RequestCallback} callback 回调函数。
  51552. */
  51553. getFieldStatisticsInfo(params, callback) {
  51554. if (!(params instanceof FieldStatisticsParameters)) {
  51555. return;
  51556. }
  51557. var me = this,
  51558. fieldName = params.fieldName,
  51559. modes = params.statisticMode;
  51560. if (modes && !Array.isArray(modes)) {
  51561. modes = [modes];
  51562. }
  51563. me.currentStatisticResult = {fieldName: fieldName};
  51564. me._statisticsCallback = callback;
  51565. //针对每种统计方式分别进行请求
  51566. modes.forEach(mode => {
  51567. me.currentStatisticResult[mode] = null;
  51568. me._fieldStatisticRequest(params.datasource, params.dataset, fieldName, mode);
  51569. })
  51570. }
  51571. _fieldStatisticRequest(datasource, dataset, fieldName, statisticMode) {
  51572. var me = this;
  51573. var statisticService = new FieldStatisticService(me.url, {
  51574. eventListeners: {
  51575. scope: me,
  51576. processCompleted: me._processCompleted.bind(me),
  51577. processFailed: me._statisticsCallback
  51578. },
  51579. datasource: datasource,
  51580. dataset: dataset,
  51581. field: fieldName,
  51582. statisticMode: statisticMode,
  51583. crossOrigin: me.options.crossOrigin,
  51584. headers: me.options.headers
  51585. });
  51586. statisticService.processAsync();
  51587. }
  51588. _processCompleted(fieldStatisticResult, options) {
  51589. var me = this;
  51590. var getAll = true,
  51591. result = fieldStatisticResult.result;
  51592. if (this.currentStatisticResult) {
  51593. if (null == me.currentStatisticResult[result.mode]) {
  51594. this.currentStatisticResult[result.mode] = result.result;
  51595. }
  51596. }
  51597. for (var mode in me.currentStatisticResult) {
  51598. if (null == me.currentStatisticResult[mode]) {
  51599. getAll = false;
  51600. break;
  51601. }
  51602. }
  51603. if (getAll) {
  51604. me._statisticsCallback({result: me.currentStatisticResult, options});
  51605. }
  51606. }
  51607. }
  51608. ;// CONCATENATED MODULE: ./src/mapboxgl/services/FieldService.js
  51609. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51610. * This program are made available under the terms of the Apache License, Version 2.0
  51611. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51612. /**
  51613. * @class FieldService
  51614. * @category iServer Data Field
  51615. * @classdesc 字段服务类。
  51616. * @modulecategory Services
  51617. * @example
  51618. * new FieldService(url).getFields(function(result){
  51619. * //doSomething
  51620. * });
  51621. * @param {string} url - 服务地址。
  51622. * @param {Object} options - 参数。
  51623. * @param {string} [options.proxy] - 服务代理地址。
  51624. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  51625. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  51626. * @param {Object} [options.headers] - 请求头。
  51627. * @extends {ServiceBase}
  51628. * @usage
  51629. */
  51630. class FieldService extends ServiceBase {
  51631. constructor(url, options) {
  51632. super(url, options);
  51633. this._fieldService = new FieldService_FieldService(url, options);
  51634. }
  51635. /**
  51636. * @function FieldService.prototype.getFields
  51637. * @description 字段查询服务。
  51638. * @param {FieldParameters} params - 字段信息查询参数类。
  51639. * @param {RequestCallback} callback 回调函数。
  51640. */
  51641. getFields(params, callback) {
  51642. this._fieldService.getFields(params, callback);
  51643. }
  51644. /**
  51645. * @function FieldService.prototype.getFieldStatisticsInfo
  51646. * @description 字段统计服务。
  51647. * @param {FieldStatisticsParameters} params - 字段统计信息查询参数类。
  51648. * @param {RequestCallback} callback 回调函数。
  51649. */
  51650. getFieldStatisticsInfo(params, callback) {
  51651. this._fieldService.getFieldStatisticsInfo(params, callback);
  51652. }
  51653. }
  51654. ;// CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosParameters.js
  51655. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51656. * This program are made available under the terms of the Apache License, Version 2.0
  51657. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51658. /**
  51659. * @class GetGridCellInfosParameters
  51660. * @deprecatedclass SuperMap.GetGridCellInfosParameters
  51661. * @category iServer Data Grid
  51662. * @classdesc 数据服务栅格查询参数类。
  51663. * @param {Object} options - 参数。
  51664. * @param {string} options.datasetName - 数据集名称。
  51665. * @param {string} options.dataSourceName - 数据源名称。
  51666. * @param {number} options.X - 地理位置 X 轴。
  51667. * @param {number} options.Y - 地理位置 Y 轴。
  51668. * @usage
  51669. */
  51670. class GetGridCellInfosParameters {
  51671. constructor(options) {
  51672. /**
  51673. * @member {string} GetGridCellInfosParameters.prototype.datasetName
  51674. * @description 数据集名称。
  51675. */
  51676. this.datasetName = null;
  51677. /**
  51678. * @member {string} GetGridCellInfosParameters.prototype.dataSourceName
  51679. * @description 数据源名称。
  51680. */
  51681. this.dataSourceName = null;
  51682. /**
  51683. * @member {number} GetGridCellInfosParameters.prototype.X
  51684. * @description 要查询的地理位置 X 轴。
  51685. */
  51686. this.X = null;
  51687. /**
  51688. * @member {number} GetGridCellInfosParameters.prototype.Y
  51689. * @description 要查询的地理位置 Y 轴。
  51690. */
  51691. this.Y = null;
  51692. Util_Util.extend(this, options);
  51693. this.CLASS_NAME = "SuperMap.GetGridCellInfosParameters";
  51694. }
  51695. /**
  51696. * @function GetGridCellInfosParameters.prototype.destroy
  51697. * @description 释放资源,将引用的资源属性置空。
  51698. */
  51699. destroy() {
  51700. var me = this;
  51701. me.datasetName = null;
  51702. me.dataSourceName = null;
  51703. me.X = null;
  51704. me.Y = null;
  51705. }
  51706. }
  51707. ;// CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosService.js
  51708. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51709. * This program are made available under the terms of the Apache License, Version 2.0
  51710. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51711. /**
  51712. * @class GetGridCellInfosService
  51713. * @deprecatedclass SuperMap.GetGridCellInfosService
  51714. * @category iServer Data Grid
  51715. * @classdesc 数据栅格查询服务,支持查询指定地理位置的栅格信息。
  51716. * @param {string} url - 服务地址。例如: http://localhost:8090/iserver/services/data-jingjin/rest/data
  51717. * @param {Object} options - 参数。
  51718. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
  51719. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  51720. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  51721. * @param {Object} [options.headers] - 请求头。
  51722. * @extends {CommonServiceBase}
  51723. * @example
  51724. * var myService = new GetGridCellInfosService(url, {eventListeners: {
  51725. * "processCompleted": queryCompleted,
  51726. * "processFailed": queryError
  51727. * }
  51728. * });
  51729. * @usage
  51730. */
  51731. class GetGridCellInfosService extends CommonServiceBase {
  51732. constructor(url, options) {
  51733. super(url, options);
  51734. /**
  51735. * @member {string} GetGridCellInfosService.prototype.datasetName
  51736. * @description 数据集名称。
  51737. */
  51738. this.datasetName = null;
  51739. /**
  51740. * @member {string} GetGridCellInfosService.prototype.dataSourceName
  51741. * @description 数据源名称。
  51742. */
  51743. this.dataSourceName = null;
  51744. /**
  51745. * @member {string} GetGridCellInfosService.prototype.datasetType
  51746. * @description 数据集类型。
  51747. */
  51748. this.datasetType = null;
  51749. /**
  51750. * @member {number} GetGridCellInfosService.prototype.X
  51751. * @description 要查询的地理位置X轴
  51752. */
  51753. this.X = null;
  51754. /**
  51755. * @member {number} GetGridCellInfosService.prototype.Y
  51756. * @description 要查询的地理位置Y轴
  51757. */
  51758. this.Y = null;
  51759. if (options) {
  51760. Util_Util.extend(this, options);
  51761. }
  51762. this.eventCount = 0;
  51763. this.CLASS_NAME = "SuperMap.GetGridCellInfosService";
  51764. }
  51765. /**
  51766. * @function GetGridCellInfosService.prototype.destroy
  51767. * @override
  51768. */
  51769. destroy() {
  51770. super.destroy();
  51771. var me = this;
  51772. me.X = null;
  51773. me.Y = null;
  51774. me.datasetName = null;
  51775. me.dataSourceName = null;
  51776. me.datasetType = null;
  51777. }
  51778. /**
  51779. * @function GetGridCellInfosService.prototype.processAsync
  51780. * @description 执行服务,查询数据集信息。
  51781. * @param {GetGridCellInfosParameters} params - 查询参数。
  51782. */
  51783. processAsync(params, callback) {
  51784. if (!(params instanceof GetGridCellInfosParameters)) {
  51785. return;
  51786. }
  51787. Util_Util.extend(this, params);
  51788. var me = this;
  51789. me.url = Util_Util.urlPathAppend(me.url,`datasources/${me.dataSourceName}/datasets/${me.datasetName}`);
  51790. me.queryRequest(me.getDatasetInfoCompleted.bind(me), me.getDatasetInfoFailed.bind(me), callback);
  51791. }
  51792. /**
  51793. * @function GetGridCellInfosService.prototype.queryRequest
  51794. * @description 执行服务,查询。
  51795. * @callback {function} successFun - 成功后执行的函数。
  51796. * @callback {function} failedFunc - 失败后执行的函数。
  51797. */
  51798. queryRequest(successFun, failedFunc, callback) {
  51799. let eventId = ++this.eventCount;
  51800. let eventListeners = {
  51801. scope: this,
  51802. processCompleted: function(result) {
  51803. if (eventId === result.result.eventId && callback) {
  51804. delete result.result.eventId;
  51805. callback(result);
  51806. this.events && this.events.un(eventListeners);
  51807. return false;
  51808. }
  51809. },
  51810. processFailed: function(result) {
  51811. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  51812. callback(result);
  51813. this.events && this.events.un(eventListeners);
  51814. return false;
  51815. }
  51816. }
  51817. }
  51818. this.events.on(eventListeners);
  51819. var me = this;
  51820. me.request({
  51821. method: "GET",
  51822. data: null,
  51823. scope: me,
  51824. success(result, options) {
  51825. result.eventId = eventId;
  51826. successFun(result, options, callback);
  51827. },
  51828. failure(result, options) {
  51829. if (result.error) {
  51830. result.error.eventId = eventId;
  51831. }
  51832. result.eventId = eventId;
  51833. failedFunc(result, options);
  51834. }
  51835. });
  51836. }
  51837. /**
  51838. * @function GetGridCellInfosService.prototype.getDatasetInfoCompleted
  51839. * @description 数据集查询完成,执行此方法。
  51840. * @param {Object} result - 服务器返回的结果对象。
  51841. */
  51842. getDatasetInfoCompleted(result, options, callback) {
  51843. var me = this;
  51844. result = Util_Util.transformResult(result);
  51845. me.datasetType = result.datasetInfo.type;
  51846. me.queryGridInfos(callback);
  51847. }
  51848. /**
  51849. * @function GetGridCellInfosService.prototype.queryGridInfos
  51850. * @description 执行服务,查询数据集栅格信息。
  51851. */
  51852. queryGridInfos(callback) {
  51853. var me = this;
  51854. me.url = Util_Util.urlPathAppend(me.url, me.datasetType == 'GRID' ? 'gridValue' : 'imageValue');
  51855. if (me.X != null && me.Y != null) {
  51856. me.url = Util_Util.urlAppend(me.url, `x=${me.X}&y=${me.Y}`);
  51857. }
  51858. me.queryRequest(me.serviceProcessCompleted.bind(me), me.serviceProcessFailed.bind(me), callback);
  51859. }
  51860. /**
  51861. * @function GetGridCellInfosService.prototype.getDatasetInfoFailed
  51862. * @description 数据集查询失败,执行此方法。
  51863. * @param {Object} result - 服务器返回的结果对象。
  51864. */
  51865. getDatasetInfoFailed(result, options) {
  51866. var me = this;
  51867. me.serviceProcessFailed(result, options);
  51868. }
  51869. }
  51870. ;// CONCATENATED MODULE: ./src/mapboxgl/services/GridCellInfosService.js
  51871. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51872. * This program are made available under the terms of the Apache License, Version 2.0
  51873. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51874. /**
  51875. * @class GridCellInfosService
  51876. * @category iServer Data Grid
  51877. * @classdesc 数据栅格查询服务类。
  51878. * @modulecategory Services
  51879. * @extends {ServiceBase}
  51880. * @example
  51881. * new GridCellInfosService(url)
  51882. * .getGridCellInfos(param,function(result){
  51883. * //doSomething
  51884. * })
  51885. * @param {string} url - 服务地址。请求地图服务,URL 应为:</br>
  51886. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World。
  51887. * @param {Object} options - 参数。
  51888. * @param {string} [options.proxy] - 服务代理地址。
  51889. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  51890. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  51891. * @param {Object} [options.headers] - 请求头。
  51892. * @usage
  51893. */
  51894. class GridCellInfosService extends ServiceBase {
  51895. constructor(url, options) {
  51896. super(url, options);
  51897. this._gridCellQueryService = new GetGridCellInfosService(this.url, {
  51898. proxy: this.options.proxy,
  51899. withCredentials: this.options.withCredentials,
  51900. crossOrigin: this.options.crossOrigin,
  51901. headers: this.options.headers
  51902. });
  51903. }
  51904. /**
  51905. * @function GridCellInfosService.prototype.getGridCellInfos
  51906. * @param {GetGridCellInfosParameters} params - 数据服务栅格查询参数类。
  51907. * @param {RequestCallback} callback 回调函数。
  51908. */
  51909. getGridCellInfos(params, callback) {
  51910. if (!params) {
  51911. return null;
  51912. }
  51913. this._gridCellQueryService.processAsync(params, callback);
  51914. }
  51915. }
  51916. ;// CONCATENATED MODULE: ./src/common/iServer/GeoprocessingService.js
  51917. /**
  51918. * @class GeoprocessingService
  51919. * @deprecatedclass SuperMap.GeoprocessingService
  51920. * @category iServer ProcessingAutomationService
  51921. * @classdesc 处理自动化服务接口的基类。
  51922. * @version 10.1.0
  51923. * @extends {CommonServiceBase}
  51924. * @param {string} url - 服务地址。
  51925. * @param {Object} options - 参数。
  51926. * @param {Events} options.events - 处理所有事件的对象。
  51927. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  51928. * @usage
  51929. */
  51930. class GeoprocessingService_GeoprocessingService extends CommonServiceBase {
  51931. constructor(url, options) {
  51932. options = options || {};
  51933. options.EVENT_TYPES = ['processCompleted', 'processFailed', 'processRunning'];
  51934. super(url, options);
  51935. this.CLASS_NAME = 'SuperMap.GeoprocessingService';
  51936. this.headers = {};
  51937. this.crossOrigin = true;
  51938. this.eventCount = 0;
  51939. }
  51940. /**
  51941. * @function GeoprocessingService.prototype.getTools
  51942. * @description 获取处理自动化工具列表。
  51943. * @param {string} identifier - 处理自动化工具ID。
  51944. */
  51945. getTools(callback) {
  51946. this._processAsync({ url: `${this.url}/list`, callback });
  51947. }
  51948. /**
  51949. * @function GeoprocessingService.prototype.getTool
  51950. * @description 获取处理自动化工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
  51951. * @param {string} identifier - 处理自动化工具ID。
  51952. */
  51953. getTool(identifier, callback) {
  51954. this._processAsync({ url: `${this.url}/${identifier}`, callback });
  51955. }
  51956. /**
  51957. * @function GeoprocessingService.prototype.execute
  51958. * @description 同步执行处理自动化工具。
  51959. * @param {string} identifier - 处理自动化工具ID。
  51960. * @param {Object} parameter - 处理自动化工具的输入参数。
  51961. * @param {Object} environment - 处理自动化工具的环境参数。
  51962. */
  51963. execute(identifier, parameter, environment, callback) {
  51964. parameter = parameter ? parameter : null;
  51965. environment = environment ? environment : null;
  51966. const executeParamter = { parameter, environment };
  51967. this._processAsync({ url: `${this.url}/${identifier}/execute`, executeParamter, callback });
  51968. }
  51969. /**
  51970. * @function GeoprocessingService.prototype.submitJob
  51971. * @description 异步执行处理自动化工具。
  51972. * @param {string} identifier - 处理自动化工具ID。
  51973. * @param {Object} parameter - 处理自动化工具的输入参数。
  51974. * @param {Object} environments - 处理自动化工具的环境参数。
  51975. */
  51976. submitJob(identifier, parameter, environments, callback) {
  51977. parameter = parameter ? parameter : null;
  51978. environments = environments ? environments : null;
  51979. const asyncParamter = JSON.stringify({ parameter: parameter, environments: environments });
  51980. this._processAsync({ url: `${this.url}/${identifier}/jobs`, method: 'POST', callback, params: asyncParamter });
  51981. }
  51982. /**
  51983. * @function GeoprocessingService.prototype.waitForJobCompletion
  51984. * @description 获取处理自动化异步执行状态信息。
  51985. * @param {string} jobId - 处理自动化任务ID。
  51986. * @param {string} identifier - 处理自动化工具ID。
  51987. * @param {Object} options - 状态信息参数。
  51988. * @param {number} options.interval - 定时器时间间隔。
  51989. * @param {function} options.statusCallback - 任务状态的回调函数。
  51990. */
  51991. waitForJobCompletion(jobId, identifier, options, callback) {
  51992. const me = this;
  51993. const timer = setInterval(function () {
  51994. const serviceProcessCompleted = function (serverResult, options) {
  51995. const state = serverResult.state.runState;
  51996. if (options.statusCallback) {
  51997. options.statusCallback(state);
  51998. }
  51999. switch (state) {
  52000. case 'FINISHED':
  52001. clearInterval(timer);
  52002. me.events.triggerEvent('processCompleted', {
  52003. result: serverResult,
  52004. options
  52005. });
  52006. break;
  52007. case 'FAILED':
  52008. clearInterval(timer);
  52009. me.events.triggerEvent('processFailed', {
  52010. result: serverResult,
  52011. options
  52012. });
  52013. break;
  52014. case 'CANCELED':
  52015. clearInterval(timer);
  52016. me.events.triggerEvent('processFailed', {
  52017. result: serverResult,
  52018. options
  52019. });
  52020. break;
  52021. }
  52022. };
  52023. me._processAsync({ url: `${me.url}/${identifier}/jobs/${jobId}`, serviceProcessCompleted, callback });
  52024. }, options.interval);
  52025. }
  52026. /**
  52027. * @function GeoprocessingService.prototype.getJobInfo
  52028. * @description 获取处理自动化任务的执行信息。
  52029. * @param {string} identifier - 处理自动化工具ID。
  52030. * @param {string} jobId - 处理自动化任务ID。
  52031. */
  52032. getJobInfo(identifier, jobId, callback) {
  52033. this._processAsync({ url: `${this.url}/${identifier}/jobs/${jobId}`, callback });
  52034. }
  52035. /**
  52036. * @function GeoprocessingService.prototype.cancelJob
  52037. * @description 取消处理自动化任务的异步执行。
  52038. * @param {string} identifier - 处理自动化工具ID。
  52039. * @param {string} jobId - 处理自动化任务ID。
  52040. */
  52041. cancelJob(identifier, jobId, callback) {
  52042. this._processAsync({ url: `${this.url}/${identifier}/jobs/${jobId}/cancel`, callback });
  52043. }
  52044. /**
  52045. * @function GeoprocessingService.prototype.getJobs
  52046. * @description 获取处理自动化服务任务列表。
  52047. * @param {string} identifier - 处理自动化工具ID。(传参代表identifier算子的任务列表,不传参代表所有任务的列表)
  52048. */
  52049. getJobs(identifier, callback) {
  52050. let url = `${this.url}/jobs`;
  52051. if (identifier) {
  52052. url = `${this.url}/${identifier}/jobs`;
  52053. }
  52054. this._processAsync({ url, callback });
  52055. }
  52056. /**
  52057. * @function GeoprocessingService.prototype.getResults
  52058. * @description 处理自动化工具执行的结果等,支持结果过滤。
  52059. * @param {string} identifier - 处理自动化工具ID。
  52060. * @param {string} jobId - 处理自动化任务ID。
  52061. * @param {string} filter - 输出异步结果的ID。(可选,传入filter参数时对该处理自动化工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
  52062. */
  52063. getResults(identifier, jobId, filter, callback) {
  52064. let url = `${this.url}/${identifier}/jobs/${jobId}/results`;
  52065. if (filter) {
  52066. url = `${url}/${filter}`;
  52067. }
  52068. this._processAsync({ url, callback });
  52069. }
  52070. _processAsync({ url, method, callback, paramter, serviceProcessCompleted, serviceProcessFailed }) {
  52071. let eventId = ++this.eventCount;
  52072. let eventListeners = {
  52073. scope: this,
  52074. processCompleted: function(result) {
  52075. if (eventId === result.result.eventId && callback) {
  52076. delete result.result.eventId;
  52077. callback(result);
  52078. this.events && this.events.un(eventListeners);
  52079. return false;
  52080. }
  52081. },
  52082. processFailed: function(result) {
  52083. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  52084. callback(result);
  52085. this.events && this.events.un(eventListeners);
  52086. return false;
  52087. }
  52088. }
  52089. }
  52090. this.events.on(eventListeners);
  52091. this.request({
  52092. url: url,
  52093. method: method || 'GET',
  52094. params: paramter,
  52095. headers: { 'Content-type': 'application/json' },
  52096. scope: this,
  52097. success(result, options) {
  52098. result.eventId = eventId;
  52099. const callback = serviceProcessCompleted || this.serviceProcessCompleted.bind(this);
  52100. callback(result, options);
  52101. },
  52102. failure(result, options) {
  52103. if (result.error) {
  52104. result.error.eventId = eventId;
  52105. }
  52106. result.eventId = eventId;
  52107. const callback = serviceProcessFailed || this.serviceProcessFailed.bind(this);
  52108. callback(result, options);
  52109. }
  52110. });
  52111. }
  52112. }
  52113. ;// CONCATENATED MODULE: ./src/mapboxgl/services/GeoprocessingService.js
  52114. /**
  52115. * @class GeoprocessingService
  52116. * @classdesc 处理自动化服务接口类。
  52117. * @version 10.1.0
  52118. * @category iServer ProcessingAutomationService
  52119. * @modulecategory Services
  52120. * @extends {ServiceBase}
  52121. * @example
  52122. * //为了安全访问受保护的处理自动化服务,必须通过传递iserver令牌(token),才能正确访问相关资源。
  52123. * SecurityManager.registerToken(serviceUrl, token);
  52124. * var geoprocessingService = new GeoprocessingService("http://localhost:8090/iserver/services/geoprocessing/restjsr/gp/v2")
  52125. geoprocessingService.submitJob(identifier,params, environments, function(serverResult) {
  52126. console.log(serverResult.result);
  52127. var jobID = serverResult.result.jobID;
  52128. var options = {
  52129. interval: 5000,
  52130. statusCallback: function(state) {
  52131. console.log("Job Status: ", state);
  52132. }
  52133. };
  52134. geoprocessingService.waitForJobCompletion(jobID, identifier, options, function(serverResult) {
  52135. console.log(serverResult);
  52136. })
  52137. })
  52138. * @param {string} url - 服务地址。
  52139. * @param {Object} options - 参数。
  52140. * @usage
  52141. */
  52142. class GeoprocessingService extends ServiceBase {
  52143. constructor(url, options) {
  52144. super(url, options);
  52145. this.headers = {};
  52146. this.crossOrigin = true;
  52147. this.withCredentials = true;
  52148. this.proxy = true;
  52149. this._geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  52150. proxy: this.options.proxy,
  52151. withCredentials: this.options.withCredentials,
  52152. crossOrigin: this.options.crossOrigin,
  52153. headers: this.options.headers
  52154. });
  52155. }
  52156. /**
  52157. * @function GeoprocessingService.prototype.getTools
  52158. * @description 获取处理自动化工具列表。
  52159. * @param {RequestCallback} callback 回调函数。
  52160. */
  52161. getTools(callback) {
  52162. this._geoprocessingJobsService.getTools(callback);
  52163. }
  52164. /**
  52165. * @function GeoprocessingService.prototype.getTool
  52166. * @description 获取处理自动化工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
  52167. * @param {string} identifier - 处理自动化工具ID。
  52168. * @param {RequestCallback} callback 回调函数。
  52169. */
  52170. getTool(identifier, callback) {
  52171. this._geoprocessingJobsService.getTool(identifier, callback);
  52172. }
  52173. /**
  52174. * @function GeoprocessingService.prototype.execute
  52175. * @description 同步执行处理自动化工具。
  52176. * @param {string} identifier - 处理自动化工具ID。
  52177. * @param {Object} parameter - 处理自动化工具的输入参数。
  52178. * @param {Object} environment - 处理自动化工具的环境参数。
  52179. * @param {RequestCallback} callback 回调函数。
  52180. */
  52181. execute(identifier, parameter, environment, callback) {
  52182. this._geoprocessingJobsService.execute(identifier, parameter, environment, callback);
  52183. }
  52184. /**
  52185. * @function GeoprocessingService.prototype.submitJob
  52186. * @description 异步执行处理自动化工具。
  52187. * @param {string} identifier - 处理自动化工具ID。
  52188. * @param {Object} parameter - 处理自动化工具的输入参数。
  52189. * @param {Object} environment - 处理自动化工具的环境参数。
  52190. * @param {RequestCallback} callback 回调函数。
  52191. */
  52192. submitJob(identifier, parameter, environment, callback) {
  52193. this._geoprocessingJobsService.submitJob(identifier, parameter, environment, callback);
  52194. }
  52195. /**
  52196. * @function GeoprocessingService.prototype.waitForJobCompletion
  52197. * @description 获取处理自动化异步执行状态信息。
  52198. * @param {string} jobId - 处理自动化任务ID。
  52199. * @param {string} identifier - 处理自动化工具ID。
  52200. * @param {Object} options - 状态信息参数。
  52201. * @param {number} options.interval - 定时器时间间隔。
  52202. * @param {function} options.statusCallback - 任务状态的回调函数。
  52203. * @param {RequestCallback} callback 回调函数。
  52204. */
  52205. waitForJobCompletion(jobId, identifier, options, callback) {
  52206. this._geoprocessingJobsService.waitForJobCompletion(jobId, identifier, options, callback);
  52207. }
  52208. /**
  52209. * @function GeoprocessingService.prototype.getJobInfo
  52210. * @description 获取处理自动化任务的执行信息。
  52211. * @param {string} identifier - 处理自动化工具ID。
  52212. * @param {string} jobId - 处理自动化任务ID。
  52213. * @param {RequestCallback} callback 回调函数。
  52214. */
  52215. getJobInfo(identifier, jobId, callback) {
  52216. this._geoprocessingJobsService.getJobInfo(identifier, jobId, callback);
  52217. }
  52218. /**
  52219. * @function GeoprocessingService.prototype.cancelJob
  52220. * @description 取消处理自动化任务的异步执行。
  52221. * @param {string} identifier - 处理自动化工具ID。
  52222. * @param {string} jobId - 处理自动化任务ID。
  52223. * @param {RequestCallback} callback 回调函数。
  52224. */
  52225. cancelJob(identifier, jobId, callback) {
  52226. this._geoprocessingJobsService.cancelJob(identifier, jobId, callback);
  52227. }
  52228. /**
  52229. * @function GeoprocessingService.prototype.getJobs
  52230. * @description 获取处理自动化服务任务列表。
  52231. * @param {string} identifier - 处理自动化工具ID。(可选,传参代表identifier算子的任务列表,不传参代表所有任务的列表)
  52232. * @param {RequestCallback} callback 回调函数。
  52233. */
  52234. getJobs(identifier, callback) {
  52235. this._geoprocessingJobsService.getJobs(identifier, callback);
  52236. }
  52237. /**
  52238. * @function GeoprocessingService.prototype.getResults
  52239. * @description 处理自动化工具异步执行的结果,支持结果过滤。
  52240. * @param {string} identifier - 处理自动化工具ID。
  52241. * @param {string} jobId - 处理自动化任务ID。
  52242. * @param {string} filter - 输出异步结果的ID。(可选,传入filter参数时对该处理自动化工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
  52243. * @param {RequestCallback} callback 回调函数。
  52244. */
  52245. getResults(identifier, jobId, filter, callback) {
  52246. this._geoprocessingJobsService.getResults(identifier, jobId, filter, callback);
  52247. }
  52248. }
  52249. ;// CONCATENATED MODULE: ./src/common/iServer/Theme.js
  52250. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52251. * This program are made available under the terms of the Apache License, Version 2.0
  52252. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52253. /**
  52254. * @class CommonTheme
  52255. * @aliasclass Theme
  52256. * @deprecatedclass SuperMap.Theme
  52257. * @category iServer Map Theme
  52258. * @classdesc 专题图基类。
  52259. * @param {string} type - 专题图类型。
  52260. * @param {Object} options - 可选参数。
  52261. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  52262. * @usage
  52263. */
  52264. class Theme_Theme {
  52265. constructor(type, options) {
  52266. if (!type) {
  52267. return this;
  52268. }
  52269. /**
  52270. * @member {ThemeMemoryData} CommonTheme.prototype.memoryData
  52271. * @description 专题图内存数据。<br>
  52272. * 用内存数据制作专题图的方式与表达式制作专题图的方式互斥,前者优先级较高。
  52273. * 第一个参数代表专题值,即数据集中用来做专题图的字段或表达式的值;第二个参数代表外部值。在制作专题图时,会用外部值代替专题值来制作相应的专题图。
  52274. */
  52275. this.memoryData = null;
  52276. /**
  52277. * @member {string} CommonTheme.prototype.type
  52278. * @description 专题图类型。
  52279. */
  52280. this.type = type;
  52281. if (options) {
  52282. Util_Util.extend(this, options);
  52283. }
  52284. this.CLASS_NAME = "SuperMap.Theme";
  52285. }
  52286. /**
  52287. * @function CommonTheme.prototype.destroy
  52288. * @description 释放资源,将引用资源的属性置空。
  52289. */
  52290. destroy() {
  52291. var me = this;
  52292. if (me.memoryData) {
  52293. me.memoryData.destroy();
  52294. me.memoryData = null;
  52295. }
  52296. me.type = null;
  52297. }
  52298. /**
  52299. * @function CommonTheme.prototype.toServerJSONObject
  52300. * @description 转换成对应的 JSON 格式对象。
  52301. * @returns {Object} 对应的 JSON 格式对象。
  52302. */
  52303. toServerJSONObject() {
  52304. //return 子类实现
  52305. return;
  52306. }
  52307. }
  52308. ;// CONCATENATED MODULE: ./src/common/iServer/ServerTextStyle.js
  52309. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52310. * This program are made available under the terms of the Apache License, Version 2.0
  52311. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52312. /**
  52313. * @class ServerTextStyle
  52314. * @deprecatedclass SuperMap.ServerTextStyle
  52315. * @category iServer Map Theme
  52316. * @classdesc 服务端文本风格类。该类用于定义文本风格的相关属性。
  52317. * @param {Object} options - 可选参数。
  52318. * @param {TextAlignment} [options.align=TextAlignment.BASELINECENTER] - 文本的对齐方式。
  52319. * @param {ServerColor} [options.backColor] - 文本的背景色。默认 backColor = new ServerColor(255, 255, 255)。
  52320. * @param {ServerColor} [options.foreColor] - 文本的前景色。默认 foreColor = new ServerColor(0, 0, 0)。
  52321. * @param {boolean} [options.backOpaque=false] - 文本背景是否不透明。
  52322. * @param {boolean} [options.sizeFixed=true] - 文本大小是否固定。
  52323. * @param {number} [options.fontHeight=6] - 文本字体的高度。
  52324. * @param {number} [options.fontWidth=0] - 文本字体的宽度。
  52325. * @param {number} [options.fontWeight=400] - 文本字体的磅数。
  52326. * @param {string} [options.fontName='Times New Roman'] - 文本字体的名称。
  52327. * @param {boolean} [options.bold=false] - 文本是否为粗体字。
  52328. * @param {boolean} [options.italic=false] - 文本是否采用斜体。
  52329. * @param {number} [options.italicAngle=0] - 字体倾斜角度。
  52330. * @param {boolean} [options.shadow=false] - 文本是否有阴影。
  52331. * @param {boolean} [options.strikeout=false] - 文本字体是否加删除线。
  52332. * @param {boolean} [options.outline=false] - 是否以轮廓的方式来显示文本的背景。
  52333. * @param {number} [options.opaqueRate=0] - 注记文字的不透明度。
  52334. * @param {boolean} [options.underline=false] - 文本字体是否加下划线。
  52335. * @param {number} [options.rotation=0.0] - 文本旋转的角度。
  52336. * @usage
  52337. */
  52338. class ServerTextStyle {
  52339. constructor(options) {
  52340. /**
  52341. * @member {TextAlignment} [ServerTextStyle.prototype.align= TextAlignment.BASELINECENTER]
  52342. * @description 文本的对齐方式。
  52343. */
  52344. this.align = TextAlignment.BASELINECENTER;
  52345. /**
  52346. * @member {ServerColor} [ServerTextStyle.prototype.backColor=(255, 255, 255)]
  52347. * @description 文本的背景色。
  52348. */
  52349. this.backColor = new ServerColor(255, 255, 255);
  52350. /**
  52351. * @member {ServerColor} [ServerTextStyle.prototype.foreColor=(0, 0, 0)]
  52352. * @description 文本的前景色。
  52353. */
  52354. this.foreColor = new ServerColor(0, 0, 0);
  52355. /**
  52356. * @member {boolean} [ServerTextStyle.prototype.backOpaque=false]
  52357. * @description 文本背景是否不透明。true 表示文本背景不透明。
  52358. */
  52359. this.backOpaque = false;
  52360. /**
  52361. * @member {boolean} [ServerTextStyle.prototype.sizeFixed=true]
  52362. * @description 文本大小是否固定。设置为 true,表示图片为固定像素大小,具体大小请参考 fontHeight。当设为 false 时,图片会随着地图缩放而缩放。
  52363. */
  52364. this.sizeFixed = true;
  52365. /**
  52366. * @member {number} [ServerTextStyle.prototype.fontHeight=6]
  52367. * @description 文本字体的高度,单位与 sizeFixed 有关,当 sizeFixed 为 False 时,即非固定文本大小时使用地图坐标单位,
  52368. * 如地理坐标系下的地图中单位为度;当 sizeFixed 为 True 时,单位为毫米(mm)。
  52369. */
  52370. this.fontHeight = 6;
  52371. /**
  52372. * @member {number} [ServerTextStyle.prototype.fontWidth=0]
  52373. * @description 文本字体的宽度。字体的宽度以英文字符为标准,由于一个中文字符相当于两个英文字符。
  52374. */
  52375. this.fontWidth = 0;
  52376. /**
  52377. * @member {number} [ServerTextStyle.prototype.fontWeight=400]
  52378. * @description 文本字体的磅数。表示粗体的具体数值。取值范围为从0-900之间的整百数。
  52379. */
  52380. this.fontWeight = 400;
  52381. /**
  52382. * @member {string} [ServerTextStyle.prototype.fontName="Times New Roman"]
  52383. * @description 文本字体的名称。
  52384. */
  52385. this.fontName = "Times New Roman";
  52386. /**
  52387. * @member {boolean} [ServerTextStyle.prototype.bold=false]
  52388. * @description 文本是否为粗体字。true 表示为粗体。false 表示文本不是粗体字。
  52389. */
  52390. this.bold = false;
  52391. /**
  52392. * @member {boolean} [ServerTextStyle.prototype.italic=false]
  52393. * @description 文本是否采用斜体。true 表示采用斜体。
  52394. */
  52395. this.italic = false;
  52396. /**
  52397. * @member {number} [ServerTextStyle.prototype.italicAngle=0]
  52398. * @description 字体倾斜角度。正负度之间,以度为单位,精确到0.1度。当倾斜角度为0度,为系统默认的字体倾斜样式。
  52399. * 正负度是指以纵轴为起始零度线,其纵轴左侧为正,右侧为负。允许的最大角度为60,最小-60。大于60按照60处理,小于-60按照-60处理。目前只对标签专题图有效。
  52400. */
  52401. this.italicAngle = 0;
  52402. /**
  52403. * @member {boolean} [ServerTextStyle.prototype.shadow=false]
  52404. * @description 文本是否有阴影。true 表示给文本增加阴影。false 表示文本没有阴影。
  52405. */
  52406. this.shadow = false;
  52407. /**
  52408. * @member {boolean} [ServerTextStyle.prototype.strikeout=false]
  52409. * @description 文本字体是否加删除线。true 表示加删除线。false 表示文本字体不加删除线。
  52410. */
  52411. this.strikeout = false;
  52412. /**
  52413. * @member {boolean} [ServerTextStyle.prototype.outline=false]
  52414. * @description 是否以轮廓的方式来显示文本的背景。true 表示以轮廓的方式来显示文本的背景。false 表示不以轮廓的方式来显示文本的背景。
  52415. */
  52416. this.outline = false;
  52417. /**
  52418. * @member {number} [ServerTextStyle.prototype.opaqueRate=0]
  52419. * @description 注记文字的不透明度。不透明度的范围为0-100。0表示透明。
  52420. */
  52421. this.opaqueRate = 0;
  52422. /**
  52423. * @member {boolean} [ServerTextStyle.prototype.underline=false]
  52424. * @description 文本字体是否加下划线。true 表示加下划线。
  52425. */
  52426. this.underline = false;
  52427. /**
  52428. * @member {number} [ServerTextStyle.prototype.rotation=0.0]
  52429. * @description 文本旋转的角度。逆时针方向为正方向,单位为度,精确到0.1度。
  52430. */
  52431. this.rotation = 0.0;
  52432. if (options) {
  52433. Util_Util.extend(this, options);
  52434. }
  52435. this.CLASS_NAME = "SuperMap.ServerTextStyle";
  52436. }
  52437. /**
  52438. * @function ServerTextStyle.prototype.destroy
  52439. * @description 释放资源,将引用资源的属性置空。
  52440. */
  52441. destroy() {
  52442. var me = this;
  52443. me.align = null;
  52444. if (me.backColor) {
  52445. me.backColor.destroy();
  52446. me.backColor = null;
  52447. }
  52448. if (me.foreColor) {
  52449. me.foreColor.destroy();
  52450. me.foreColor = null;
  52451. }
  52452. me.backOpaque = null;
  52453. me.sizeFixed = null;
  52454. me.fontHeight = null;
  52455. me.fontWidth = null;
  52456. me.fontWeight = null;
  52457. me.fontName = null;
  52458. me.bold = null;
  52459. me.italic = null;
  52460. me.italicAngle = null;
  52461. me.shadow = null;
  52462. me.strikeout = null;
  52463. me.outline = null;
  52464. me.opaqueRate = null;
  52465. me.underline = null;
  52466. me.rotation = null;
  52467. }
  52468. /**
  52469. * @function ServerTextStyle.fromObj
  52470. * @description 从传入对象获服务端文本风格类。
  52471. * @param {Object} obj - 传入对象
  52472. * @returns {ServerTextStyle} 返回服务端文本风格对象
  52473. */
  52474. static fromObj(obj) {
  52475. var res = new ServerTextStyle(obj);
  52476. Util_Util.copy(res, obj);
  52477. res.backColor = ServerColor.fromJson(obj.backColor);
  52478. res.foreColor = ServerColor.fromJson(obj.foreColor);
  52479. return res;
  52480. }
  52481. }
  52482. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelItem.js
  52483. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52484. * This program are made available under the terms of the Apache License, Version 2.0
  52485. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52486. /**
  52487. * @class ThemeLabelItem
  52488. * @deprecatedclass SuperMap.ThemeLabelItem
  52489. * @category iServer Map Theme
  52490. * @classdesc 分段标签专题图的子项。标签专题图用专题值对点、线、面等对象做标注。
  52491. * 值得注意的是,分段标签专题图允许用户通过 rangeExpression 字段指定用于分段的数值型字段,
  52492. * 同一范围段内的标签具有相同的显示风格,其中每一个范围段就是一个专题图子项,
  52493. * 每一个子项都具有其名称、风格、起始值和终止值。注意:每个分段所表示的范围为 [Start, End)。例如:标签专题图的分段点有两个子项,
  52494. * 他们所代表的分段区间分别为[0,5),[5,10)。那么需要分别设置 ThemeLabelItem[0].start=0,
  52495. * ThemeLabelItem[0].end=5,SuperMap.ThemeLabelItem[1].start=5,SuperMap.ThemeLabelItem[1].end=10。
  52496. * @param {Object} options - 可选参数。
  52497. * @param {string} [options.caption] - 子项的名称。
  52498. * @param {number} [options.end=0] - 子项的终止值。
  52499. * @param {number} [options.start=0] - 子项的分段起始值。
  52500. * @param {boolean} [options.visible=true] - 子项是否可见。
  52501. * @param {ServerTextStyle} [options.style] - 子项文本的显示风格。
  52502. * @usage
  52503. */
  52504. class ThemeLabelItem {
  52505. constructor(options) {
  52506. /**
  52507. * @member {string} [ThemeLabelItem.prototype.caption]
  52508. * @description 标签专题子项的标题。
  52509. */
  52510. this.caption = null;
  52511. /**
  52512. * @member {number} [ThemeLabelItem.prototype.end=0]
  52513. * @description 标签专题图子项的终止值。如果该子项是分段中最后一个子项,那么该终止值就是分段的最大值;
  52514. * 如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常。
  52515. */
  52516. this.end = 0;
  52517. /**
  52518. * @member {number} [ThemeLabelItem.prototype.start=0]
  52519. * @description 标签专题图子项的分段起始值。如果该子项是分段中第一项,那么该起始值就是分段的最小值;
  52520. * 如果该子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
  52521. */
  52522. this.start = 0;
  52523. /**
  52524. * @member {boolean} [ThemeLabelItem.prototype.visible=true]
  52525. * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
  52526. */
  52527. this.visible = true;
  52528. /**
  52529. * @member {ServerTextStyle} ThemeLabelItem.prototype.style
  52530. * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
  52531. * uniformMixedStyle(标签文本的复合风格),ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  52532. */
  52533. this.style = new ServerTextStyle();
  52534. if (options) {
  52535. Util_Util.extend(this, options);
  52536. }
  52537. this.CLASS_NAME = "SuperMap.ThemeLabelItem";
  52538. }
  52539. /**
  52540. * @function ThemeLabelItem.prototype.destroy
  52541. * @description 释放资源,将引用资源的属性置空。
  52542. */
  52543. destroy() {
  52544. var me = this;
  52545. me.caption = null;
  52546. me.end = null;
  52547. me.start = null;
  52548. if (me.style) {
  52549. me.style.destroy();
  52550. me.style = null;
  52551. }
  52552. me.visible = null;
  52553. }
  52554. /**
  52555. * @function ThemeLabelItem.fromObj
  52556. * @description 从传入对象获取分段标签专题图的子项类。
  52557. * @param {Object} obj - 传入对象。
  52558. * @returns {ThemeLabelItem} ThemeLabelItem 对象。
  52559. */
  52560. static fromObj(obj) {
  52561. if (!obj) {
  52562. return;
  52563. }
  52564. var t = new ThemeLabelItem();
  52565. Util_Util.copy(t, obj);
  52566. return t;
  52567. }
  52568. }
  52569. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeUniqueItem.js
  52570. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52571. * This program are made available under the terms of the Apache License, Version 2.0
  52572. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52573. /**
  52574. * @class ThemeUniqueItem
  52575. * @deprecatedclass SuperMap.ThemeUniqueItem
  52576. * @category iServer Map Theme
  52577. * @classdesc 单值专题图子项类。单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,Name 字段代表省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有 5 种不同值,则该行政区划图有 5 个专题图子项。
  52578. * @param {Object} options - 参数。
  52579. * @param {string} options.unique - 子项的单值字段。
  52580. * @param {string} [options.caption] - 子项的标题。
  52581. * @param {ServerStyle} [options.style] - 子项的风格。
  52582. * @param {boolean} [options.visible=true] - 子项是否可见。
  52583. * @usage
  52584. */
  52585. class ThemeUniqueItem {
  52586. constructor(options) {
  52587. /**
  52588. * @member {string} [ThemeUniqueItem.prototype.caption]
  52589. * @description 单值专题图子项的标题。
  52590. */
  52591. this.caption = null;
  52592. /**
  52593. * @member {ServerStyle} [ThemeUniqueItem.prototype.style]
  52594. * @description 单值专题图子项的显示风格。
  52595. */
  52596. this.style = new ServerStyle();
  52597. /**
  52598. * @member {string} ThemeUniqueItem.prototype.unique
  52599. * @description 单值专题图子项的值,可以为数字、字符串等。
  52600. */
  52601. this.unique = null;
  52602. /**
  52603. * @member {boolean} [ThemeUniqueItem.prototype.visible=true]
  52604. * @description 单值专题图子项的可见性。
  52605. */
  52606. this.visible = true;
  52607. if (options) {
  52608. Util_Util.extend(this, options);
  52609. }
  52610. this.CLASS_NAME = "SuperMap.ThemeUniqueItem";
  52611. }
  52612. /**
  52613. * @function ThemeUniqueItem.prototype.destroy
  52614. * @description 释放资源,将引用资源的属性置空。
  52615. */
  52616. destroy() {
  52617. var me = this;
  52618. me.caption = null;
  52619. me.unique = null;
  52620. if (me.style) {
  52621. me.style.destroy();
  52622. me.style = null;
  52623. }
  52624. me.visible = null;
  52625. }
  52626. /**
  52627. * @function ThemeUniqueItem.prototype.toServerJSONObject
  52628. * @description 转换成对应的 JSON 格式对象。
  52629. * @returns {Object} 对应的 JSON 格式对象。
  52630. */
  52631. toServerJSONObject() {
  52632. var obj = {};
  52633. obj = Util_Util.copyAttributes(obj, this);
  52634. if (obj.style) {
  52635. if (obj.style.toServerJSONObject) {
  52636. obj.style = obj.style.toServerJSONObject();
  52637. }
  52638. }
  52639. return obj;
  52640. }
  52641. /**
  52642. * @function ThemeUniqueItem.fromObj
  52643. * @description 从传入对象获取单值专题图子项类。
  52644. * @param {Object} obj - 传入对象。
  52645. * @returns {ThemeUniqueItem} ThemeUniqueItem 对象。
  52646. */
  52647. static fromObj(obj) {
  52648. var res = new ThemeUniqueItem();
  52649. Util_Util.copy(res, obj);
  52650. res.style = ServerStyle.fromJson(obj.style);
  52651. return res;
  52652. }
  52653. }
  52654. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeOffset.js
  52655. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52656. * This program are made available under the terms of the Apache License, Version 2.0
  52657. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52658. /**
  52659. * @class ThemeOffset
  52660. * @deprecatedclass SuperMap.ThemeOffset
  52661. * @category iServer Map Theme
  52662. * @classdesc 专题图中文本或符号相对于要素内点的偏移量设置类。
  52663. * 通过该类可以设置专题图中标记文本或符号的偏移量以及偏移量是否随地图缩放而改变。
  52664. * @param {Object} options - 可选参数。
  52665. * @param {boolean} [options.offsetFixed=false] - 当前专题图是否固定标记文本或符号的偏移量。
  52666. * @param {string} [options.offsetX='0.0'] - 专题图中文本或符号相对于要素内点的水平偏移量。
  52667. * @param {string} [options.offsetY='0.0'] - 专题图中文本或符号相对于要素内点的垂直偏移量。
  52668. * @usage
  52669. */
  52670. class ThemeOffset {
  52671. constructor(options) {
  52672. /**
  52673. * @member {boolean} [ThemeOffset.prototype.offsetFixed=false]
  52674. * @description 当前专题图是否固定标记文本或符号的偏移量。所谓固定偏移量,指文本或符号的偏移量不随地图的缩放而变化。
  52675. */
  52676. this.offsetFixed = false;
  52677. /**
  52678. * @member {string} [ThemeOffset.prototype.offsetX=0.0]
  52679. * @description 专题图中文本或符号相对于要素内点的水平偏移量。偏移量的单位为地图单位。
  52680. * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么水平偏移量为2。
  52681. */
  52682. this.offsetX = "0.0";
  52683. /**
  52684. * @member {string} [ThemeOffset.prototype.offsetY=0.0]
  52685. * @description 专题图中文本或符号相对于要素内点的垂直偏移量。偏移量的单位为地图单位。
  52686. * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么垂直偏移量为2。
  52687. */
  52688. this.offsetY = "0.0";
  52689. if (options) {
  52690. Util_Util.extend(this, options);
  52691. }
  52692. this.CLASS_NAME = "SuperMap.ThemeOffset";
  52693. }
  52694. /**
  52695. * @function ThemeOffset.prototype.destroy
  52696. * @description 释放资源,将引用资源的属性置空。
  52697. */
  52698. destroy() {
  52699. var me = this;
  52700. me.offsetFixed = null;
  52701. me.offsetX = null;
  52702. me.offsetY = null;
  52703. }
  52704. /**
  52705. * @function ThemeOffset.fromObj
  52706. * @description 从传入对象获取专题图中文本或符号相对于要素内点的偏移量设置类。
  52707. * @param {Object} obj - 传入对象。
  52708. * @returns {ThemeOffset} ThemeOffset 对象。
  52709. */
  52710. static fromObj(obj) {
  52711. if (!obj) {
  52712. return;
  52713. }
  52714. var res = new ThemeOffset();
  52715. Util_Util.copy(res, obj);
  52716. return res;
  52717. }
  52718. }
  52719. ;// CONCATENATED MODULE: ./src/common/iServer/LabelMixedTextStyle.js
  52720. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52721. * This program are made available under the terms of the Apache License, Version 2.0
  52722. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52723. /**
  52724. * @class LabelMixedTextStyle
  52725. * @deprecatedclass SuperMap.LabelMixedTextStyle
  52726. * @category iServer Map Theme
  52727. * @classdesc 标签文本复合风格类。
  52728. * 该类主要用于对标签专题图中标签的文本内容进行风格设置。通过该类用户可以使标签的文字显示不同的风格,比如文本 “喜马拉雅山”,通过本类可以将前三个字用红色显示,后两个字用蓝色显示。对同一文本设置不同的风格实质上是对文本的字符进行分段,同一分段内的字符具有相同的显示风格。对字符分段有两种方式,一种是利用分隔符对文本进行分段;另一种是根据分段索引值进行分段:</br>
  52729. * 1.利用分隔符对文本进行分段: 比如文本 “5&109” 被分隔符 “&” 分为 “5” 和 “109” 两部分,
  52730. * 在显示时,“5” 和分隔符 “&” 使用同一个风格,字符串 “109” 使用相同的风格。<br>
  52731. * 2.利用分段索引值进行分段: 文本中字符的索引值是以0开始的整数,比如文本 “珠穆朗玛峰”,
  52732. * 第一个字符(“珠”)的索引值为 0,第二个字符(“穆”)的索引值为 1,以此类推;当设置分段索引值为 1,3,4,9 时,
  52733. * 字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),可以看出索引号为 0 的字符(即“珠” )在第一个分段内,
  52734. * 索引号为 1,2 的字符(即“穆”、“朗”)位于第二个分段内,索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
  52735. * @param {Object} options - 可选参数。
  52736. * @param {ServerTextStyle} [options.defaultStyle] - 默认的文本复合风格。
  52737. * @param {string} [options.separator] - 文本的分隔符。
  52738. * @param {boolean} [options.separatorEnabled=false] - 文本的分隔符是否有效。
  52739. * @param {Array.<number>} [options.splitIndexes] - 分段索引值,分段索引值用来对文本中的字符进行分段。
  52740. * @param {Array.<ServerTextStyle>} [options.styles] - 文本样式集合。
  52741. * @usage
  52742. */
  52743. class LabelMixedTextStyle {
  52744. constructor(options) {
  52745. /**
  52746. * @member {ServerTextStyle} LabelMixedTextStyle.prototype.defaultStyle
  52747. * @description 默认的文本复合风格,即 ServerTextStyle 各字段的默认值。
  52748. */
  52749. this.defaultStyle = null;
  52750. /**
  52751. * @member {string} LabelMixedTextStyle.prototype.separator
  52752. * @description 文本的分隔符,分隔符的风格与前一个字符的风格一样。文本的分隔符是一个将文本分割开的符号,
  52753. * 比如文本 “5_109” 被 “ _ ” 分隔为 “5” 和 “109” 两部分,假设有风格数组:style1、style2。
  52754. * 在显示时,“5” 和分隔符 “ _ ” 使用 Style1 风格渲染,字符串 “109” 使用 Style2 的风格。
  52755. */
  52756. this.separator = null;
  52757. /**
  52758. * @member {boolean} [LabelMixedTextStyle.prototype.separatorEnabled=false]
  52759. * @description 文本的分隔符是否有效。分隔符有效时利用分隔符对文本进行分段;无效时根据文本中字符的位置进行分段。
  52760. * 分段后,同一分段内的字符具有相同的显示风格。
  52761. */
  52762. this.separatorEnabled = false;
  52763. /**
  52764. * @member {Array.<number>} LabelMixedTextStyle.prototype.splitIndexes
  52765. * @description 分段索引值,分段索引值用来对文本中的字符进行分段。
  52766. * 文本中字符的索引值是以 0 开始的整数,比如文本“珠穆朗玛峰”,第一个字符(“珠”)的索引值为0,第二个字符(“穆”)的索引值为 1,
  52767. * 以此类推;当设置分段索引值数组为 [1,3,4,9] 时,字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),
  52768. * 可以看出索引号为 0 的字符(即 “珠”)在第一个分段内,索引号为 1,2 的字符(即 “穆”、“朗”)位于第二个分段内,
  52769. * 索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
  52770. */
  52771. this.splitIndexes = null;
  52772. /**
  52773. * @member {Array.<ServerTextStyle>} LabelMixedTextStyle.prototype.styles
  52774. * @description 文本样式集合。文本样式集合中的样式根据索引与不同分段一一对应,
  52775. * 如果有分段没有风格对应则使用 defaultStyle。
  52776. */
  52777. this.styles = new ServerTextStyle();
  52778. if (options) {
  52779. Util_Util.extend(this, options);
  52780. }
  52781. this.CLASS_NAME = "SuperMap.LabelMixedTextStyle"
  52782. }
  52783. /**
  52784. * @function LabelMixedTextStyle.prototype.destroy
  52785. * @description 释放资源,将引用资源的属性置空。
  52786. */
  52787. destroy() {
  52788. var me = this;
  52789. if (me.defaultStyle) {
  52790. me.defaultStyle.destroy();
  52791. me.defaultStyle = null;
  52792. }
  52793. me.separator = null;
  52794. me.separatorEnabled = null;
  52795. if (me.splitIndexes) {
  52796. me.splitIndexes = null;
  52797. }
  52798. if (me.styles) {
  52799. for (var i = 0, styles = me.styles, len = styles.length; i < len; i++) {
  52800. styles[i].destroy();
  52801. }
  52802. me.styles = null;
  52803. }
  52804. }
  52805. /**
  52806. * @function LabelMixedTextStyle.fromObj
  52807. * @description 从传入对象获取标签文本复合风格类。
  52808. * @param {Object} obj - 传入对象。
  52809. * @returns {LabelMixedTextStyle} 返回新的 LabelMixedTextStyle 对象。
  52810. */
  52811. static fromObj(obj) {
  52812. if (!obj) {
  52813. return;
  52814. }
  52815. var res = new LabelMixedTextStyle();
  52816. var stys = obj.styles;
  52817. Util_Util.copy(res, obj);
  52818. res.defaultStyle = new ServerTextStyle(obj.defaultStyle);
  52819. if (stys) {
  52820. res.styles = [];
  52821. for (var i = 0, len = stys.length; i < len; i++) {
  52822. res.styles.push(new ServerTextStyle(stys[i]));
  52823. }
  52824. }
  52825. return res;
  52826. }
  52827. }
  52828. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelText.js
  52829. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52830. * This program are made available under the terms of the Apache License, Version 2.0
  52831. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52832. /**
  52833. * @class ThemeLabelText
  52834. * @deprecatedclass SuperMap.ThemeLabelText
  52835. * @category iServer Map Theme
  52836. * @classdesc 标签中文本风格类。
  52837. * 通过该类可以设置标签中的文本字体大小和显示风格。
  52838. * @param {Object} options - 参数。
  52839. * @param {number} [options.maxTextHeight=0] - 标签中文本的最大高度。
  52840. * @param {number} [options.maxTextWidth=0] - 标签中文本的最大宽度。
  52841. * @param {number} [options.minTextHeight=0] - 标签中文本的最小高度。
  52842. * @param {number} [options.minTextWidth=0] - 标签中文本的最小宽度。
  52843. * @param {ServerTextStyle} [options.uniformStyle] - 统一文本风格。
  52844. * @param {LabelMixedTextStyle} [options.uniformMixedStyle] - 标签专题图统一的文本复合风格。
  52845. * @usage
  52846. */
  52847. class ThemeLabelText {
  52848. constructor(options) {
  52849. /**
  52850. * @member {number} [ThemeLabelText.prototype.maxTextHeight=0]
  52851. * @description 标签中文本的最大高度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
  52852. * 当放大后的文本高度超过最大高度之后就不再放大。高度单位为毫米。
  52853. */
  52854. this.maxTextHeight = 0;
  52855. /**
  52856. * @member {number} [ThemeLabelText.prototype.maxTextWidth=0]
  52857. * @description 标签中文本的最大宽度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
  52858. * 当放大后的文本宽度超过最大高度之后就不再放大。宽度单位为毫米。
  52859. */
  52860. this.maxTextWidth = 0;
  52861. /**
  52862. * @member {number} [ThemeLabelText.prototype.minTextHeight=0]
  52863. * @description 标签中文本的最小高度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
  52864. * 当缩小后的文本高度小于最小高度之后就不再缩小。高度单位为毫米。
  52865. */
  52866. this.minTextHeight = 0;
  52867. /**
  52868. * @member {number} [ThemeLabelText.prototype.minTextWidth=0]
  52869. * @description 标签中文本的最小宽度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
  52870. * 当缩小后的文本宽度小于最小宽度之后就不再缩小。宽度单位为毫米。
  52871. */
  52872. this.minTextWidth = 0;
  52873. /**
  52874. * @member {ServerTextStyle} [ThemeLabelText.prototype.uniformStyle]
  52875. * @description 统一文本风格。当标签专题图子项的个数大于等于1时,
  52876. * uniformStyle 不起作用,各标签的风格使用子项中设置的风格。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
  52877. * ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  52878. */
  52879. this.uniformStyle = new ServerTextStyle();
  52880. /**
  52881. *@member {LabelMixedTextStyle} [ThemeLabelText.prototype.uniformMixedStyle]
  52882. *@description 标签专题图统一的文本复合风格。通过该类可以使同一个标签中的文字使用多种风格显示。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
  52883. * ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  52884. */
  52885. this.uniformMixedStyle = null;
  52886. if (options) {
  52887. Util_Util.extend(this, options);
  52888. }
  52889. this.CLASS_NAME = "SuperMap.ThemeLabelText";
  52890. }
  52891. /**
  52892. * @function ThemeLabelText.prototype.destroy
  52893. * @description 释放资源,将引用资源的属性置空。
  52894. */
  52895. destroy() {
  52896. var me = this;
  52897. me.maxTextHeight = null;
  52898. me.maxTextWidth = null;
  52899. me.minTextHeight = null;
  52900. me.minTextWidth = null;
  52901. if (me.uniformStyle) {
  52902. me.uniformStyle.destroy();
  52903. me.uniformStyle = null;
  52904. }
  52905. if (me.uniformMixedStyle) {
  52906. me.uniformMixedStyle.destroy();
  52907. me.uniformMixedStyle = null;
  52908. }
  52909. }
  52910. /**
  52911. * @function ThemeLabelText.fromObj
  52912. * @description 从传入对象获取标签中文本风格类。
  52913. * @param {Object} obj - 传入对象。
  52914. * @returns {ThemeLabelText} ThemeLabelText 对象。
  52915. */
  52916. static fromObj(obj) {
  52917. if (!obj) {
  52918. return;
  52919. }
  52920. var res = new ThemeLabelText();
  52921. Util_Util.copy(res, obj);
  52922. res.uniformStyle = ServerTextStyle.fromObj(obj.uniformStyle);
  52923. res.uniformMixedStyle = LabelMixedTextStyle.fromObj(obj.uniformMixedStyle);
  52924. return res;
  52925. }
  52926. }
  52927. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelAlongLine.js
  52928. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52929. * This program are made available under the terms of the Apache License, Version 2.0
  52930. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52931. /**
  52932. * @class ThemeLabelAlongLine
  52933. * @deprecatedclass SuperMap.ThemeLabelAlongLine
  52934. * @category iServer Map Theme
  52935. * @classdesc 标签沿线标注样式类。
  52936. * @param {Object} options - 可选参数。
  52937. * @param {boolean} [options.isAlongLine=true] - 是否沿线显示文本。
  52938. * @param {AlongLineDirection} [options.alongLineDirection=AlongLineDirection.LB_TO_RT] - 标签沿线标注方向。
  52939. * @param {boolean} [options.angleFixed=false] - 当沿线显示文本时,是否将文本角度固定。
  52940. * @param {boolean} [options.repeatedLabelAvoided=false] - 沿线循环标注时是否避免标签重复标注。
  52941. * @param {boolean} [options.repeatIntervalFixed=false] - 循环标注间隔是否固定。
  52942. * @param {number} [options.labelRepeatInterval=0] - 沿线且循环标注时循环标注的间隔。
  52943. * @usage
  52944. */
  52945. class ThemeLabelAlongLine {
  52946. constructor(options) {
  52947. /**
  52948. * @member {boolean} [ThemeLabelAlongLine.prototype.isAlongLine=true]
  52949. * @description 是否沿线显示文本。true 表示沿线显示文本,false 表示正常显示文本。
  52950. */
  52951. this.isAlongLine = true;
  52952. /**
  52953. * @member {AlongLineDirection} [ThemeLabelAlongLine.prototype.alongLineDirection=AlongLineDirection.LB_TO_RT]
  52954. * @description 标签沿线标注方向。
  52955. */
  52956. this.alongLineDirection = AlongLineDirection.LB_TO_RT;
  52957. /**
  52958. * @member {boolean} [ThemeLabelAlongLine.prototype.angleFixed=false]
  52959. * @description 当沿线显示文本时,是否将文本角度固定。true 表示按固定文本角度显示文本,false 表示按照沿线角度显示文本。
  52960. * 如果固定角度,则所有标签均按所设置的文本风格中字体的旋转角度来显示,不考虑沿线标注的方向;
  52961. * 如果不固定角度,在显示标签时会同时考虑字体的旋转角度和沿线标注的方向。
  52962. */
  52963. this.angleFixed = false;
  52964. /**
  52965. * @member {boolean} ThemeLabelAlongLine.prototype.repeatedLabelAvoided
  52966. * @description 沿线循环标注时是否避免标签重复标注。
  52967. */
  52968. this.repeatedLabelAvoided = false;
  52969. /**
  52970. * @member {boolean} [ThemeLabelAlongLine.prototype.repeatIntervalFixed=false]
  52971. * @description 循环标注间隔是否固定。true 表示使用固定循环标注间隔,即使用逻辑坐标来显示循环标注间隔;
  52972. * false 表示循环标注间隔随地图的缩放而变化,即使用地理坐标来显示循环标注间隔。
  52973. */
  52974. this.repeatIntervalFixed = false;
  52975. /**
  52976. * @member {number} [ThemeLabelAlongLine.prototype.labelRepeatInterval=0]
  52977. * @description 沿线且循环标注时循环标注的间隔。长度的单位与地图的地理单位一致。只有设定 RepeatedLabelAvoided 为 true
  52978. * 的时候,labelRepeatInterval 属性才有效。
  52979. */
  52980. this.labelRepeatInterval = 0;
  52981. if (options) {
  52982. Util_Util.extend(this, options);
  52983. }
  52984. this.CLASS_NAME = "SuperMap.ThemeLabelAlongLine";
  52985. }
  52986. /**
  52987. * @function ThemeLabelAlongLine.prototype.destroy
  52988. * @description 释放资源,将引用资源的属性置空。
  52989. */
  52990. destroy() {
  52991. var me = this;
  52992. me.isAlongLine = null;
  52993. me.alongLineDirection = null;
  52994. me.angleFixed = null;
  52995. me.repeatedLabelAvoided = null;
  52996. me.repeatIntervalFixed = null;
  52997. me.labelRepeatInterval = null;
  52998. }
  52999. /**
  53000. * @function ThemeLabelAlongLine.fromObj
  53001. * @description 从传入对象获取标签沿线标注样式类。
  53002. * @param {Object} obj - 传入对象。
  53003. * @returns {ThemeLabelAlongLine} ThemeLabelAlongLine 对象。
  53004. */
  53005. static fromObj(obj) {
  53006. if (!obj) {
  53007. return;
  53008. }
  53009. var t = new ThemeLabelAlongLine();
  53010. Util_Util.copy(t, obj);
  53011. return t;
  53012. }
  53013. }
  53014. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelBackground.js
  53015. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53016. * This program are made available under the terms of the Apache License, Version 2.0
  53017. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53018. /**
  53019. * @class ThemeLabelBackground
  53020. * @deprecatedclass SuperMap.ThemeLabelBackground
  53021. * @category iServer Map Theme
  53022. * @classdesc 标签背景风格类。通过该类可以设置标签的背景形状和风格。
  53023. * @param {Object} options - 可选参数。
  53024. * @param {LabelBackShape} [options.labelBackShape=LabelBackShape.NONE] - 标签专题图中标签背景的形状枚举类。
  53025. * @param {ServerStyle} [options.backStyle] - 标签专题图中标签背景风格。
  53026. * @usage
  53027. */
  53028. class ThemeLabelBackground {
  53029. constructor(options) {
  53030. /**
  53031. * @member {LabelBackShape} [ThemeLabelBackground.prototype.labelBackShape=LabelBackShape.NONE]
  53032. * @description 标签专题图中标签背景风格。当背景形状
  53033. * labelBackShape 属性设为 NONE(即无背景形状)时,backStyle 属性无效。
  53034. */
  53035. this.labelBackShape = LabelBackShape.NONE;
  53036. /**
  53037. * @member {ServerStyle} [ThemeLabelBackground.prototype.backStyle]
  53038. * @description 标签专题图中标签背景的形状枚举类。背景类型可以是矩形、圆角矩形、菱形、椭圆形、三角形和符号等,即不使用任何的形状作为标签的背景。
  53039. */
  53040. this.backStyle = new ServerStyle();
  53041. if (options) {
  53042. Util_Util.extend(this, options);
  53043. }
  53044. this.CLASS_NAME = "SuperMap.ThemeLabelBackground";
  53045. }
  53046. /**
  53047. * @function ThemeLabelBackground.prototype.destroy
  53048. * @description 释放资源,将引用资源的属性置空。
  53049. */
  53050. destroy() {
  53051. var me = this;
  53052. me.labelBackShape = null;
  53053. if (me.backStyle) {
  53054. me.backStyle.destroy();
  53055. me.backStyle = null;
  53056. }
  53057. }
  53058. /**
  53059. * @function ThemeLabelBackground.fromObj
  53060. * @description 从传入对象获取标签背景风格类。
  53061. * @param {Object} obj - 传入对象。
  53062. * @returns {ThemeLabelBackground} ThemeLabelBackground 对象。
  53063. */
  53064. static fromObj(obj) {
  53065. if (!obj) {
  53066. return;
  53067. }
  53068. var t = new ThemeLabelBackground();
  53069. t.labelBackShape = obj.labelBackShape;
  53070. t.backStyle = ServerStyle.fromJson(obj.backStyle);
  53071. return t;
  53072. }
  53073. }
  53074. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabel.js
  53075. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53076. * This program are made available under the terms of the Apache License, Version 2.0
  53077. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53078. /**
  53079. * @class ThemeLabel
  53080. * @deprecatedclass SuperMap.ThemeLabel
  53081. * @category iServer Map Theme
  53082. * @classdesc 标签专题图类。
  53083. * @extends CommonTheme
  53084. * @param {Object} options - 参数。
  53085. * @param {Array.<ThemeLabelItem>} options.items - 子项数组。
  53086. * @param {string} options.labelExpression - 标注字段表达式。
  53087. * @param {Array.<LabelImageCell|LabelSymbolCell|LabelThemeCell>} options.matrixCells - 矩阵标签元素数组。
  53088. * @param {ThemeLabelAlongLine} [options.alongLine] - 标签沿线标注方向样式类。
  53089. * @param {ThemeLabelBackground} [options.background] - 标签的背景风格类。
  53090. * @param {LabelOverLengthMode} [options.labelOverLengthMode=LabelOverLengthMode.NONE] - 超长标签的处理模式枚举类。
  53091. * @param {number} [options.maxLabelLength=256] - 标签在每一行显示的最大长度。
  53092. * @param {number} [options.numericPrecision=0] - 通过该字段设置其显示的精度。
  53093. * @param {ThemeOffset} [options.offset] - 指定标签专题图中标记文本相对于要素内点的偏移量对象。
  53094. * @param {boolean} [options.overlapAvoided=true] - 是否允许以文本避让方式显示文本。
  53095. * @param {string} [options.rangeExpression] - 制作分段标签专题的分段字段或字段表达式。
  53096. * @param {boolean} [options.smallGeometryLabeled=false] - 是否显示长度大于被标注对象本身长度的标签。
  53097. * @param {ThemeLabelText} options.text - 标签中文本风格。
  53098. * @param {number} [options.textSpace=0] - 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
  53099. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  53100. * @usage
  53101. */
  53102. class ThemeLabel extends Theme_Theme {
  53103. constructor(options) {
  53104. super("LABEL", options);
  53105. /**
  53106. * @member {ThemeLabelAlongLine} [ThemeLabel.prototype.alongLine]
  53107. * @description 标签沿线标注方向样式类。
  53108. * 在该类中可以设置标签是否沿线标注以及沿线标注的多种方式。沿线标注属性只适用于线数据集专题图。
  53109. */
  53110. this.alongLine = new ThemeLabelAlongLine();
  53111. /**
  53112. * @member {ThemeLabelBackground} [ThemeLabel.prototype.background]
  53113. * @description 标签专题图中标签的背景风格类。通过该字段可以设置标签的背景形状和风格。
  53114. */
  53115. this.background = new ThemeLabelBackground();
  53116. /**
  53117. * @member {Array.<ThemeLabelItem>} [ThemeLabel.prototype.items]
  53118. * @description 分段标签专题图的子项数组。分段标签专题图使用 rangeExpression
  53119. * 指定数字型的字段作为分段数据,items 中的每个子对象的 [start,end) 分段值必须来源于属性 rangeExpression 的字段值。每个子项拥有自己的风格。
  53120. */
  53121. this.items = null;
  53122. /**
  53123. * @member {Array.<ThemeLabelUniqueItem>} ThemeLabel.prototype.uniqueItems
  53124. * @description 单值标签专题图子项数组。单值标签专题图使用 uniqueExpression单值标签专题图子项集合。
  53125. */
  53126. this.uniqueItems = null;
  53127. /**
  53128. * @member {string} ThemeLabel.prototype.labelExpression
  53129. * @description 标注字段表达式。系统将 labelExpression 对应的字段或字段表达式的值以标签的形式显示在图层中。
  53130. */
  53131. this.labelExpression = null;
  53132. /**
  53133. * @member {LabelOverLengthMode} [ThemeLabel.prototype.labelOverLengthMode=LabelOverLengthMode.NONE] - 标签专题图中超长标签的处理模式枚举类。
  53134. * @description 对于标签的长度超过设置的标签最大长度 maxLabelLength 时称为超长标签。
  53135. */
  53136. this.labelOverLengthMode = LabelOverLengthMode.NONE;
  53137. /**
  53138. * @member {Array.<LabelImageCell|LabelSymbolCell|LabelThemeCell>} ThemeLabel.prototype.matrixCells
  53139. * @description 矩阵标签元素数组,用于制作矩阵标签专题图。
  53140. * 数组中可以放置符号类型的矩阵标签元素和图片类型的矩阵标签元素。
  53141. */
  53142. this.matrixCells = null;
  53143. /**
  53144. * @member {number} [ThemeLabel.prototype.maxLabelLength=256]
  53145. * @description 标签在每一行显示的最大长度,一个中文为两个字符。
  53146. * 如果超过最大长度,可以采用两种方式来处理,一种是换行的模式进行显示,另一种是以省略号方式显示。单位为字符。
  53147. */
  53148. this.maxLabelLength = 256;
  53149. /**
  53150. * @member {number} [ThemeLabel.prototype.numericPrecision=0]
  53151. * @description 如果显示的标签内容为数字,通过该字段设置其显示的精度。例如标签对应的数字是8071.64529347,
  53152. * 如果该属性为0时,显示8071;为1时,显示8071.6;为3时,则是8071.645。
  53153. */
  53154. this.numericPrecision = 0;
  53155. /**
  53156. * @member {ThemeOffset} [ThemeLabel.prototype.offset]
  53157. * @description 用于设置标签专题图中标记文本相对于要素内点的偏移量对象。
  53158. */
  53159. this.offset = new ThemeOffset();
  53160. /**
  53161. * @member {boolean} [ThemeLabel.prototype.overlapAvoided=true]
  53162. * @description 是否允许以文本避让方式显示文本。true 表示自动避免文本叠盖。只针对该标签专题图层中的文本数据。
  53163. * 在标签重叠度很大的情况下,即使使用自动避让功能,可能也无法完全避免标签重叠现象。
  53164. */
  53165. this.overlapAvoided = true;
  53166. /**
  53167. * @member {string} ThemeLabel.prototype.rangeExpression
  53168. * @description 制作分段标签专题的分段字段或字段表达式。该表达式对应的字段(或者字段表达式)的值应该为数值型。
  53169. * 该字段与 items 分段子项联合使用,每个子项的起始值 [start,end)来源于 rangeExpression 字段值。
  53170. * 最后 labelExpression 指定的标签字段(标签专题图要显示的具体内容)会根据分段子项的风格进行分段显示。
  53171. */
  53172. this.rangeExpression = null;
  53173. /**
  53174. * @member {string} ThemeLabel.prototype.uniqueExpression
  53175. * @description 用于制作单值专题图的字段或字段表达式。
  53176. * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。必须与labelExpression一起使用。
  53177. */
  53178. this.uniqueExpression = null;
  53179. /**
  53180. * @member {boolean} [ThemeLabel.prototype.smallGeometryLabeled=false]
  53181. * @description 是否显示长度大于被标注对象本身长度的标签。在标签的长度大于线或者面对象本身的长度时,
  53182. * 如果该值为 true,则标签文字会叠加在一起显示,为了清楚完整的显示该标签,
  53183. * 可以采用换行模式来显示标签,但必须保证每行的长度小于对象本身的长度。
  53184. */
  53185. this.smallGeometryLabeled = false;
  53186. /**
  53187. * @member {ThemeLabelText} ThemeLabel.prototype.text
  53188. * @description 标签中文本风格。
  53189. */
  53190. this.text = new ThemeLabelText();
  53191. /**
  53192. * @member {number} [ThemeLabel.prototype.textSpace=0]
  53193. * @description 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
  53194. */
  53195. this.textSpace = 0;
  53196. if (options) {
  53197. Util_Util.extend(this, options);
  53198. }
  53199. this.CLASS_NAME = "SuperMap.ThemeLabel";
  53200. }
  53201. /**
  53202. * @function ThemeLabel.prototype.destroy
  53203. * @override
  53204. */
  53205. destroy() {
  53206. super.destroy();
  53207. var me = this;
  53208. me.alongLine = null;
  53209. if (me.background) {
  53210. me.background.destroy();
  53211. me.background = null;
  53212. }
  53213. if (me.items) {
  53214. for (var i = 0, items = me.items, len = items.length; i < len; i++) {
  53215. items[i].destroy();
  53216. }
  53217. me.items = null;
  53218. }
  53219. if (me.uniqueItems) {
  53220. for (var j = 0, uniqueItems = me.uniqueItems, uniqueLen = uniqueItems.length; j < uniqueLen; j++) {
  53221. uniqueItems[j].destory();
  53222. }
  53223. me.uniqueItems = null;
  53224. }
  53225. me.labelExpression = null;
  53226. me.labelOverLengthMode = null;
  53227. me.matrixCells = null;
  53228. me.maxLabelLength = null;
  53229. me.numericPrecision = null;
  53230. me.overlapAvoided = null;
  53231. me.rangeExpression = null;
  53232. me.uniqueExpression = null;
  53233. if (me.offset) {
  53234. me.offset.destroy();
  53235. me.offset = null;
  53236. }
  53237. me.overlapAvoided = null;
  53238. me.smallGeometryLabeled = null;
  53239. if (me.text) {
  53240. me.text.destroy();
  53241. me.text = null;
  53242. }
  53243. me.textSpace = null;
  53244. }
  53245. /**
  53246. * @function ThemeLabel.prototype.toJSON
  53247. * @description 将themeLabel对象转化为 JSON 字符串。
  53248. * @returns {string} 返回转换后的 JSON 字符串。
  53249. */
  53250. toJSON() {
  53251. return Util_Util.toJSON(this.toServerJSONObject());
  53252. }
  53253. /**
  53254. * @function ThemeLabel.prototype.toServerJSONObject
  53255. * @description 转换成对应的 JSON 格式对象。
  53256. * @returns {Object} 对应的 JSON 格式对象。
  53257. */
  53258. toServerJSONObject() {
  53259. var obj = {};
  53260. obj.type = this.type;
  53261. obj.memoryData = this.memoryData;
  53262. if (this.alongLine) {
  53263. obj.alongLine = this.alongLine.isAlongLine;
  53264. obj.alongLineDirection = this.alongLine.alongLineDirection;
  53265. obj.angleFixed = this.alongLine.angleFixed;
  53266. obj.isLabelRepeated = this.alongLine.isLabelRepeated;
  53267. obj.labelRepeatInterval = this.alongLine.labelRepeatInterval;
  53268. obj.repeatedLabelAvoided = this.alongLine.repeatedLabelAvoided;
  53269. obj.repeatIntervalFixed = this.alongLine.repeatIntervalFixed;
  53270. }
  53271. if (this.offset) {
  53272. obj.offsetFixed = this.offset.offsetFixed;
  53273. obj.offsetX = this.offset.offsetX;
  53274. obj.offsetY = this.offset.offsetY;
  53275. }
  53276. if (this.text) {
  53277. obj.maxTextHeight = this.text.maxTextHeight;
  53278. obj.maxTextWidth = this.text.maxTextWidth;
  53279. obj.minTextHeight = this.text.minTextHeight;
  53280. obj.minTextWidth = this.text.minTextWidth;
  53281. obj.uniformStyle = this.text.uniformStyle;
  53282. obj.uniformMixedStyle = this.text.uniformMixedStyle;
  53283. }
  53284. if (this.background) {
  53285. obj.labelBackShape = this.background.labelBackShape;
  53286. obj.backStyle = this.background.backStyle;
  53287. }
  53288. obj.labelOverLengthMode = this.labelOverLengthMode;
  53289. obj.maxLabelLength = this.maxLabelLength;
  53290. obj.smallGeometryLabeled = this.smallGeometryLabeled;
  53291. obj.rangeExpression = this.rangeExpression;
  53292. obj.uniqueExpression = this.uniqueExpression;
  53293. obj.numericPrecision = this.numericPrecision;
  53294. obj.items = this.items;
  53295. obj.uniqueItems = this.uniqueItems;
  53296. obj.labelExpression = this.labelExpression;
  53297. obj.overlapAvoided = this.overlapAvoided;
  53298. obj.matrixCells = this.matrixCells;
  53299. obj.textSpace = this.textSpace;
  53300. return obj;
  53301. }
  53302. /**
  53303. * @function ThemeLabel.fromObj
  53304. * @description 从传入对象获取标签专题图类。
  53305. * @param {Object} obj - 传入对象。
  53306. * @returns {ThemeLabel} ThemeLabel 对象。
  53307. */
  53308. static fromObj(obj) {
  53309. if (!obj) {
  53310. return;
  53311. }
  53312. var lab = new ThemeLabel();
  53313. var itemsL = obj.items, itemsU = obj.uniqueItems, cells = obj.matrixCells;
  53314. obj.matrixCells = null;
  53315. Util_Util.copy(lab, obj);
  53316. lab.alongLine = ThemeLabelAlongLine.fromObj(obj);
  53317. lab.background = ThemeLabelBackground.fromObj(obj);
  53318. if (itemsL) {
  53319. lab.items = [];
  53320. for (var i = 0, len = itemsL.length; i < len; i++) {
  53321. lab.items.push(ThemeLabelItem.fromObj(itemsL[i]));
  53322. }
  53323. }
  53324. if (itemsU) {
  53325. lab.uniqueItems = [];
  53326. for (let j = 0, uniqueLen = itemsU.length; j < uniqueLen; j++) {
  53327. lab.uniqueItems.push(ThemeUniqueItem.fromObj(itemsU[j]));
  53328. }
  53329. }
  53330. if (cells) {
  53331. lab.matrixCells = [];
  53332. for (let i = 0, len = cells.length; i < len; i++) {
  53333. //TODO
  53334. //lab.matrixCells.push(LabelMatrixCell.fromObj(cells[i]));
  53335. }
  53336. }
  53337. lab.offset = ThemeOffset.fromObj(obj);
  53338. lab.text = ThemeLabelText.fromObj(obj);
  53339. return lab;
  53340. }
  53341. }
  53342. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeUnique.js
  53343. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53344. * This program are made available under the terms of the Apache License, Version 2.0
  53345. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53346. /**
  53347. * @class ThemeUnique
  53348. * @deprecatedclass SuperMap.ThemeUnique
  53349. * @category iServer Map Theme
  53350. * @classdesc 单值专题图。单值专题图是利用不同的颜色或符号(线型、填充)表示图层中某一属性信息的不同属性值,属性值相同的要素具有相同的渲染风格。单值专题图多用于具有分类属性的地图上,
  53351. * 比如土壤类型分布图、土地利用图、行政区划图等。单值专题图着重表示现象质的差别,一般不表示数量的特征。尤其是有交叉或重叠现象时,此类不推荐使用,例如:民族分布区等。
  53352. * @extends {CommonTheme}
  53353. * @param {Object} options - 参数。
  53354. * @param {Array.<ThemeUniqueItem>} options.items - 子项类数组。
  53355. * @param {string} options.uniqueExpression - 指定单值专题图的字段或字段表达式。
  53356. * @param {ServerStyle} [options.defaultStyle] - 未参与单值专题图制作的对象的显示风格。
  53357. * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  53358. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  53359. * @usage
  53360. */
  53361. class ThemeUnique extends Theme_Theme {
  53362. constructor(options) {
  53363. super("UNIQUE", options);
  53364. /**
  53365. * @member {ServerStyle} ThemeUnique.prototype.defaultStyle
  53366. * @description 未参与单值专题图制作的对象的显示风格。
  53367. * 通过单值专题图子项数组 (items)可以指定某些要素参与单值专题图制作,对于那些没有被包含的要素,即不参加单值专题表达的要素,使用该风格显示。
  53368. */
  53369. this.defaultStyle = new ServerStyle();
  53370. /**
  53371. * @member {Array.<ThemeUniqueItem>} ThemeUnique.prototype.items
  53372. * @description 单值专题图子项类数组。
  53373. * 单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,
  53374. * Name 字段代表省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有5种不同值,则该行政区划图有 5 个专题图子项。
  53375. */
  53376. this.items = null;
  53377. /**
  53378. * @member {string} ThemeUnique.prototype.uniqueExpression
  53379. * @description 用于制作单值专题图的字段或字段表达式。
  53380. * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。
  53381. */
  53382. this.uniqueExpression = null;
  53383. /**
  53384. * @member {ColorGradientType} [ThemeUnique.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
  53385. * @description 渐变颜色枚举类。
  53386. * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
  53387. * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色方案完成填充。
  53388. * 但如果为某几个子项的风格进行单独设置后(设置了 ThemeUniqueItem 或 ThemeRangeItem 类中Style属性),
  53389. * 该配色方案对于这几个子项将不起作用。
  53390. */
  53391. this.colorGradientType = ColorGradientType.YELLOW_RED;
  53392. if (options) {
  53393. Util_Util.extend(this, options);
  53394. }
  53395. this.CLASS_NAME = "SuperMap.ThemeUnique";
  53396. }
  53397. /**
  53398. * @function ThemeUnique.prototype.destroy
  53399. * @override
  53400. */
  53401. destroy() {
  53402. super.destroy();
  53403. var me = this;
  53404. me.uniqueExpression = null;
  53405. me.colorGradientType = null;
  53406. if (me.items) {
  53407. if (me.items.length > 0) {
  53408. for (var item in me.items) {
  53409. me.items[item].destroy();
  53410. me.items[item] = null;
  53411. }
  53412. }
  53413. me.items = null;
  53414. }
  53415. if (me.defaultStyle) {
  53416. me.defaultStyle.destroy();
  53417. me.defaultStyle = null;
  53418. }
  53419. }
  53420. /**
  53421. * @function ThemeUnique.prototype.toServerJSONObject
  53422. * @description 转换成对应的 JSON 格式对象。
  53423. * @returns {Object} 对应的 JSON 格式对象。
  53424. */
  53425. toServerJSONObject() {
  53426. var obj = {};
  53427. obj = Util_Util.copyAttributes(obj, this);
  53428. if (obj.defaultStyle) {
  53429. if (obj.defaultStyle.toServerJSONObject) {
  53430. obj.defaultStyle = obj.defaultStyle.toServerJSONObject();
  53431. }
  53432. }
  53433. if (obj.items) {
  53434. var items = [],
  53435. len = obj.items.length;
  53436. for (var i = 0; i < len; i++) {
  53437. items.push(obj.items[i].toServerJSONObject());
  53438. }
  53439. obj.items = items;
  53440. }
  53441. return obj;
  53442. }
  53443. /**
  53444. * @function ThemeUnique.fromObj
  53445. * @description 从传入对象获取单值专题图类。
  53446. * @param {Object} obj - 传入对象。
  53447. * @returns {ThemeUnique} ThemeUnique 对象。
  53448. */
  53449. static fromObj(obj) {
  53450. var res = new ThemeUnique();
  53451. var uItems = obj.items;
  53452. var len = uItems ? uItems.length : 0;
  53453. Util_Util.extend(res, obj);
  53454. res.items = [];
  53455. res.defaultStyle = ServerStyle.fromJson(obj.defaultStyle);
  53456. for (var i = 0; i < len; i++) {
  53457. res.items.push(ThemeUniqueItem.fromObj(uItems[i]));
  53458. }
  53459. return res;
  53460. }
  53461. }
  53462. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphAxes.js
  53463. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53464. * This program are made available under the terms of the Apache License, Version 2.0
  53465. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53466. /**
  53467. * @class ThemeGraphAxes
  53468. * @deprecatedclass SuperMap.ThemeGraphAxes
  53469. * @category iServer Map Theme
  53470. * @classdesc 统计专题图坐标轴样式类。
  53471. * @param {Object} options - 参数。
  53472. * @param {ServerColor} [options.axesColor=(0, 0, 0)] - 坐标轴颜色。
  53473. * @param {boolean} [options.axesDisplayed=false] - 是否显示坐标轴。
  53474. * @param {boolean} [options.axesGridDisplayed=false] - 是否在统计图坐标轴上显示网格。
  53475. * @param {boolean} [options.axesTextDisplayed=false] - 是否显示坐标轴的文本标注。
  53476. * @param {ServerTextStyle} [options.axesTextStyle] - 统计符号的最大最小尺寸。
  53477. * @usage
  53478. */
  53479. class ThemeGraphAxes {
  53480. constructor(options) {
  53481. /**
  53482. * @member {ServerColor} [ThemeGraphAxes.prototype.axesColor=(0, 0, 0)]
  53483. * @description 坐标轴颜色。当 axesDisplayed = true 时有效。
  53484. */
  53485. this.axesColor = new ServerColor(0, 0, 0);
  53486. /**
  53487. * @member {boolean} [ThemeGraphAxes.prototype.axesDisplayed=false]
  53488. * @description 是否显示坐标轴。<br>
  53489. * 由于饼状图和环状图无坐标轴,故该属性以及所有与坐标轴设置相关的属性都不适用于它们。并且只有当该值为 true 时,其它设置坐标轴的属性才起作用。
  53490. */
  53491. this.axesDisplayed = false;
  53492. /**
  53493. * @member {boolean} [ThemeGraphAxes.prototype.axesGridDisplayed=false]
  53494. * @description 是否在统计图坐标轴上显示网格。
  53495. */
  53496. this.axesGridDisplayed = false;
  53497. /**
  53498. * @member {boolean} [ThemeGraphAxes.prototype.axesTextDisplayed=false]
  53499. * @description 是否显示坐标轴的文本标注。
  53500. */
  53501. this.axesTextDisplayed = false;
  53502. /**
  53503. * @member {ServerTextStyle} ThemeGraphAxes.prototype.axesTextStyle
  53504. * @description 坐标轴文本风格。当 axesTextDisplayed = true 时有效。
  53505. */
  53506. this.axesTextStyle = new ServerTextStyle();
  53507. if (options) {
  53508. Util_Util.extend(this, options);
  53509. }
  53510. this.CLASS_NAME = "SuperMap.ThemeGraphAxes";
  53511. }
  53512. /**
  53513. * @function ThemeGraphAxes.prototype.destroy
  53514. * @description 释放资源,将引用资源的属性置空。
  53515. */
  53516. destroy() {
  53517. var me = this;
  53518. if (me.axesColor) {
  53519. me.axesColor.destroy();
  53520. me.axesColor = null;
  53521. }
  53522. me.axesDisplayed = null;
  53523. me.axesGridDisplayed = null;
  53524. me.axesTextDisplayed = null;
  53525. if (me.axesTextStyle) {
  53526. me.axesTextStyle.destroy();
  53527. me.axesTextStyle = null;
  53528. }
  53529. }
  53530. /**
  53531. * @function ThemeGraphAxes.fromObj
  53532. * @description 从传入对象获取统计专题图坐标轴样式类。
  53533. * @param {Object} obj - 传入对象。
  53534. * @returns {ThemeGraphAxes} ThemeGraphAxes 对象。
  53535. */
  53536. static fromObj(obj) {
  53537. if (!obj) {
  53538. return;
  53539. }
  53540. var res = new ThemeGraphAxes();
  53541. Util_Util.copy(res, obj);
  53542. res.axesColor = ServerColor.fromJson(obj.axesColor);
  53543. res.axesTextStyle = ServerTextStyle.fromObj(obj.axesTextStyle);
  53544. return res;
  53545. }
  53546. }
  53547. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphSize.js
  53548. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53549. * This program are made available under the terms of the Apache License, Version 2.0
  53550. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53551. /**
  53552. * @class ThemeGraphSize
  53553. * @deprecatedclass SuperMap.ThemeGraphSize
  53554. * @category iServer Map Theme
  53555. * @classdesc 统计专题图符号尺寸类。
  53556. * @param {Object} options - 参数。
  53557. * @param {number} [options.maxGraphSize=0] - 统计图中显示的最大图表尺寸基准值。
  53558. * @param {number} [options.minGraphSize=0] - 统计图中显示的最小图表尺寸基准值。
  53559. * @usage
  53560. */
  53561. class ThemeGraphSize {
  53562. constructor(options) {
  53563. /**
  53564. * @member {number} [ThemeGraphSize.prototype.maxGraphSize=0]
  53565. * @description 获取或设置统计图中显示的最大图表尺寸基准值,单位为像素。
  53566. */
  53567. this.maxGraphSize = 0;
  53568. /**
  53569. * @member {number} [ThemeGraphSize.prototype.minGraphSize=0]
  53570. * @description 获取或设置统计图中显示的最小图表尺寸基准值,单位为像素。
  53571. */
  53572. this.minGraphSize = 0;
  53573. if (options) {
  53574. Util_Util.extend(this, options);
  53575. }
  53576. this.CLASS_NAME = "SuperMap.ThemeGraphSize";
  53577. }
  53578. /**
  53579. * @function ThemeGraphSize.prototype.destroy
  53580. * @description 释放资源,将引用资源的属性置空。
  53581. */
  53582. destroy() {
  53583. var me = this;
  53584. me.maxGraphSize = null;
  53585. me.minGraphSize = null;
  53586. }
  53587. /**
  53588. * @function ThemeGraphSize.fromObj
  53589. * @description 从传入对象获统计专题图符号尺寸类。
  53590. * @param {Object} obj - 传入对象。
  53591. * @returns {ThemeGraphSize} ThemeGraphSize 对象。
  53592. */
  53593. static fromObj(obj) {
  53594. var res = new ThemeGraphSize();
  53595. Util_Util.copy(res, obj);
  53596. return res;
  53597. }
  53598. }
  53599. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphText.js
  53600. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53601. * This program are made available under the terms of the Apache License, Version 2.0
  53602. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53603. /**
  53604. * @class ThemeGraphText
  53605. * @deprecatedclass SuperMap.ThemeGraphText
  53606. * @category iServer Map Theme
  53607. * @classdesc 统计图文字标注风格类。
  53608. * @param {Object} options - 可选参数。
  53609. * @param {boolean} [options.graphTextDisplayed=false] - 是否显示统计图上的文字标注。
  53610. * @param {ThemeGraphTextFormat} [options.graphTextFormat=ThemeGraphTextFormat.CAPTION] - 统计专题图文本显示格式。
  53611. * @param {ServerTextStyle} [options.graphTextStyle] - 统计图上的文字标注风格。
  53612. * @usage
  53613. */
  53614. class ThemeGraphText {
  53615. constructor(options) {
  53616. /**
  53617. * @member {boolean} [ThemeGraphText.prototype.graphTextDisplayed=false]
  53618. * @description 是否显示统计图上的文字标注。
  53619. */
  53620. this.graphTextDisplayed = false;
  53621. /**
  53622. * @member {ThemeGraphTextFormat} [ThemeGraphText.prototype.graphTextFormat=ThemeGraphTextFormat.CAPTION]
  53623. * @description 统计专题图文本显示格式。
  53624. * 文本显示格式包括百分数、真实数值、标题、标题+百分数、标题+真实数值。
  53625. */
  53626. this.graphTextFormat = ThemeGraphTextFormat.CAPTION;
  53627. /**
  53628. * @member {ServerTextStyle} ThemeGraphText.prototype.graphTextStyle
  53629. * @description 统计图上的文字标注风格。
  53630. */
  53631. this.graphTextStyle = new ServerTextStyle();
  53632. if (options) {
  53633. Util_Util.extend(this, options);
  53634. }
  53635. this.CLASS_NAME = "SuperMap.ThemeGraphText";
  53636. }
  53637. /**
  53638. * @function ThemeGraphText.prototype.destroy
  53639. * @description 释放资源,将引用资源的属性置空。
  53640. */
  53641. destroy() {
  53642. var me = this;
  53643. me.graphTextDisplayed = null;
  53644. me.graphTextFormat = null;
  53645. if (me.graphTextStyle) {
  53646. me.graphTextStyle.destroy();
  53647. me.graphTextStyle = null;
  53648. }
  53649. }
  53650. /**
  53651. * @function ThemeGraphText.fromObj
  53652. * @description 从传入对象获取统计图文字标注风格类。
  53653. * @param {Object} obj - 传入对象。
  53654. * @returns {ThemeGraphText} ThemeGraphText 对象。
  53655. */
  53656. static fromObj(obj) {
  53657. var res = new ThemeGraphText();
  53658. Util_Util.copy(res, obj);
  53659. res.graphTextStyle = ServerTextStyle.fromObj(obj.graphTextStyle);
  53660. return res;
  53661. }
  53662. }
  53663. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphItem.js
  53664. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53665. * This program are made available under the terms of the Apache License, Version 2.0
  53666. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53667. /**
  53668. * @class ThemeGraphItem
  53669. * @deprecatedclass SuperMap.ThemeGraphItem
  53670. * @category iServer Map Theme
  53671. * @classdesc 统计专题图子项类。
  53672. * @param {Object} options - 参数。
  53673. * @param {string} [options.caption] - 专题图子项的名称。
  53674. * @param {string} options.graphExpression - 统计专题图的专题变量。
  53675. * @param {Array.<number>} [options.memoryDoubleValues] - 内存数组方式制作专题图时的值数组。
  53676. * @param {ServerStyle} [options.uniformStyle] - 统计专题图子项的显示风格。
  53677. * @usage
  53678. */
  53679. class ThemeGraphItem {
  53680. constructor(options) {
  53681. /**
  53682. * @member {string} [ThemeGraphItem.prototype.caption]
  53683. * @description 专题图子项的名称。
  53684. */
  53685. this.caption = null;
  53686. /**
  53687. * @member {string} ThemeGraphItem.prototype.graphExpression
  53688. * @description 统计专题图的专题变量。专题变量可以是一个字段或字段表达式。字段必须为数值型;表达式只能为数值型的字段间的运算。
  53689. */
  53690. this.graphExpression = null;
  53691. /**
  53692. * @member {Array.<number>} [ThemeGraphItem.prototype.memoryDoubleValues]
  53693. * @description 内存数组方式制作专题图时的值数组。<br>
  53694. * 内存数组方式制作专题图时,只对 SmID 值在键数组({@link ThemeGraph#memoryKeys})中的记录制作专题图。
  53695. * 值数组的数值个数必须与键数组中数值的个数一致。值数组中的值将代替原来的专题值来制作统计专题图。
  53696. * 比如:利用面积字段和周长字段(即有两个统计专题图子项 )作为专题变量制作统计专题图。
  53697. */
  53698. this.memoryDoubleValues = null;
  53699. /**
  53700. * @member {ServerStyle} [ThemeGraphItem.prototype.uniformStyle]
  53701. * @description 统计专题图子项的显示风格。
  53702. * 每一个统计专题图子项都对应一种显示风格。
  53703. */
  53704. this.uniformStyle = new ServerStyle();
  53705. if (options) {
  53706. Util_Util.extend(this, options);
  53707. }
  53708. this.CLASS_NAME = "SuperMap.ThemeGraphItem";
  53709. }
  53710. /**
  53711. * @function ThemeGraphItem.prototype.destroy
  53712. * @description 释放资源,将引用资源的属性置空。
  53713. */
  53714. destroy() {
  53715. var me = this;
  53716. me.caption = null;
  53717. me.graphExpression = null;
  53718. me.memoryDoubleValues = null;
  53719. me.uniformStyle = null;
  53720. }
  53721. /**
  53722. * @function ThemeGraphItem.fromObj
  53723. * @description 从传入对象获取统计专题图子项类。
  53724. * @param {Object} obj - 传入对象。
  53725. * @returns {ThemeGraphItem} ThemeGraphItem 对象。
  53726. */
  53727. static fromObj(obj) {
  53728. if (!obj) {
  53729. return;
  53730. }
  53731. var res = new ThemeGraphItem();
  53732. Util_Util.copy(res, obj);
  53733. res.uniformStyle = ServerStyle.fromJson(obj.uniformStyle);
  53734. return res;
  53735. }
  53736. }
  53737. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraph.js
  53738. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53739. * This program are made available under the terms of the Apache License, Version 2.0
  53740. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53741. /**
  53742. * @class ThemeGraph
  53743. * @deprecatedclass SuperMap.ThemeGraph
  53744. * @category iServer Map Theme
  53745. * @classdesc 统计专题图类。
  53746. * @extends {CommonTheme}
  53747. * @param {Object} options - 参数。
  53748. * @param {Array.<ThemeGraphItem>} options.items - 统计专题图子项集合。
  53749. * @param {number} [options.barWidth=0] - 柱状专题图中每一个柱的宽度。
  53750. * @param {GraduatedMode} [options.graduatedMode=GraduatedMode.CONSTANT] - 统计图中地理要素的值与图表尺寸间的映射关系。
  53751. * @param {ThemeGraphAxes} [options.graphAxes] - 统计图中坐标轴样式相关信息。
  53752. * @param {ThemeGraphSize} [options.graphSize=0] - 统计符号的最大最小尺寸。
  53753. * @param {boolean} [options.graphSizeFixed=false] - 缩放地图时统计图符号是否固定大小。
  53754. * @param {ThemeGraphText} [options.graphText] - 统计图上的文字是否可见以及文字标注风格。
  53755. * @param {GraphAxesTextDisplayMode} [options.graphAxesTextDisplayMode=GraphAxesTextDisplayMode.NONE] - 统计专题图坐标轴文本显示模式。
  53756. * @param {ThemeGraphType} [options.graphType=ThemeGraphType.AREA] - 统计专题图类型。
  53757. * @param {Array.<number>} [options.memoryKeys] - 以内存数组方式制作专题图时的键数组。
  53758. * @param {boolean} [options.negativeDisplayed=false] - 专题图中是否显示属性为负值的数据。
  53759. * @param {ThemeOffset} [options.offset] - 统计图相对于要素内点的偏移量。
  53760. * @param {boolean} [options.overlapAvoided=true] - 统计图是否采用避让方式显示。
  53761. * @param {number} [options.roseAngle=0] - 统计图中玫瑰图或三维玫瑰图用于等分的角度。
  53762. * @param {number} [options.startAngle=0] - 饼状统计图扇形的起始角度。
  53763. * @usage
  53764. */
  53765. class ThemeGraph extends Theme_Theme {
  53766. constructor(options) {
  53767. super("GRAPH", options);
  53768. /**
  53769. * @member {number} [ThemeGraph.prototype.barWidth=0]
  53770. * @description 柱状专题图中每一个柱的宽度。使用地图坐标单位。
  53771. * 只有选择的统计图类型为柱状图(柱状图、三维柱状图、堆叠柱状图、三维堆叠柱状图)时,此项才可设置。
  53772. */
  53773. this.barWidth = 0;
  53774. /**
  53775. * @member {GraduatedMode} [ThemeGraph.prototype.graduatedMode=GraduatedMode.CONSTANT]
  53776. * @description 统计图中地理要素的值与图表尺寸间的映射关系(常数、对数、平方根),即分级方式。
  53777. * 分级主要是为了减少制作统计专题图中数据大小之间的差异,使得统计图的视觉效果比较好,同时不同类别之间的比较也还是有意义的。
  53778. * 提供三种分级模式:常数、对数和平方根,对于有值为负数的字段,不可以采用对数和平方根的分级方式。不同的等级方式用于确定符号大小的数值是不相同的。
  53779. */
  53780. this.graduatedMode = GraduatedMode.CONSTANT;
  53781. /**
  53782. * @member {ThemeGraphAxes} ThemeGraph.prototype.graphAxes
  53783. * @description 用于设置统计图中坐标轴样式相关信息,如坐标轴颜色、是否显示、坐标文本样式等。
  53784. */
  53785. this.graphAxes = new ThemeGraphAxes();
  53786. /**
  53787. * @member {ThemeGraphSize} [ThemeGraph.prototype.graphSize=0]
  53788. * @description 用于设置统计符号的最大最小尺寸。
  53789. */
  53790. this.graphSize = new ThemeGraphSize();
  53791. /**
  53792. * @member {boolean} [ThemeGraph.prototype.graphSizeFixed=false]
  53793. * @description 缩放地图时统计图符号是否固定大小。即统计图符号将随地图缩放。
  53794. */
  53795. this.graphSizeFixed = false;
  53796. /**
  53797. * @member {ThemeGraphText} ThemeGraph.prototype.graphText
  53798. * @description 统计图上的文字是否可见以及文字标注风格。
  53799. */
  53800. this.graphText = new ThemeGraphText();
  53801. /**
  53802. * @member {ThemeGraphType} [ThemeGraph.prototype.graphType=ThemeGraphType.AREA]
  53803. * @description 统计专题图类型。SuperMap 提供了多种类型的统计图,
  53804. * 分别为面积图、阶梯图、折线图、点状图、柱状图、三维柱状图、饼图、三维饼图、玫瑰图、三维玫瑰图、堆叠柱状图、三维堆叠柱状图、环状图。默认为面积图。
  53805. */
  53806. this.graphType = ThemeGraphType.AREA;
  53807. /**
  53808. * @member {GraphAxesTextDisplayMode} [ThemeGraph.prototype.graphAxesTextDisplayMode=GraphAxesTextDisplayMode.NONE]
  53809. * @description 统计专题图坐标轴文本显示模式。
  53810. */
  53811. this.graphAxesTextDisplayMode = GraphAxesTextDisplayMode.NONE;
  53812. /**
  53813. * @member {Array.<ThemeGraphItem>} ThemeGraph.prototype.items
  53814. * @description 统计专题图子项集合。
  53815. * 统计专题图可以基于多个变量,反映多种属性,即可以将多个专题变量的值绘制在一个统计图上。每一个专题变量对应的统计图即为一个专题图子项。
  53816. * 对于每个专题图子项可以为其设置标题、风格,甚至可以将该子项再制作成范围分段专题图。
  53817. */
  53818. this.items = null;
  53819. /**
  53820. * @member {Array.<number>} ThemeGraph.prototype.memoryKeys
  53821. * @description 以内存数组方式制作专题图时的键数组。
  53822. * 键数组内的数值代表 SmID 值,它与 {@link ThemeGraphItem} 类中的值数组({@link ThemeGraphItem#memoryDoubleValues})要关联起来应用。
  53823. * 键数组中数值的个数必须要与值数组的数值个数一致。值数组中的值将代替原来的专题值来制作统计专题图。
  53824. * 目前所有的专题图都支持以内存数组的方式制作专题图,但统计专题图与其他专题图指定内存数组的方式不同,
  53825. * 统计专题图使用 memoryKeys 指定内存数组,而其他专题图则使用 memoryData 来指定内存数组。
  53826. * @example
  53827. * memoryKeys 的使用方法如下:
  53828. * function addThemeGraph() {
  53829. * removeTheme();
  53830. * //创建统计专题图对象,ThemeGraph 必设 items。
  53831. * //专题图参数 ThemeParameters 必设 theme(即以设置好的分段专题图对象)、dataSourceName 和 datasetName
  53832. * var style1 = new ServerStyle({
  53833. * fillForeColor: new ServerColor(92,73,234),
  53834. * lineWidth: 0.1
  53835. * }),
  53836. * style2 = new ServerStyle({
  53837. * fillForeColor: new ServerColor(211,111,240),
  53838. * lineWidth: 0.1
  53839. * }),
  53840. * item1 = new ThemeGraphItem({
  53841. * memoryDoubleValues:[1.18,0.95,0.37,1.31,0.8,1.5],
  53842. * caption: "1992-1995人口增长率",
  53843. * graphExpression: "Pop_Rate95",
  53844. * uniformStyle: style1
  53845. * }),
  53846. * item2 = new ThemeGraphItem({
  53847. * //以内存数组方式制作专题图时的值数组
  53848. * memoryDoubleValues:[2.71,0,0.74,3.1,2.2,3.5],
  53849. * caption: "1995-1999人口增长率", //专题图子项的名称
  53850. * graphExpression: "Pop_Rate99", //统计专题图的专题变量
  53851. * uniformStyle: style2 //统计专题图子项的显示风格
  53852. * }),
  53853. * themeGraph = new ThemeGraph({
  53854. * //以内存数组方式制作专题图时的键数组,键数组内的数值代表 SmID 值
  53855. * memoryKeys:[1,2,4,8,10,12],
  53856. * items: new Array(item1,item2),
  53857. * barWidth: 0.03,
  53858. * //统计图中地理要素的值与图表尺寸间的映射关系为平方根
  53859. * graduatedMode: GraduatedMode.SQUAREROOT,
  53860. * //graphAxes用于设置统计图中坐标轴样式相关信息
  53861. * graphAxes: new ThemeGraphAxes({
  53862. * axesDisplayed: true
  53863. * }),
  53864. * graphSize: new ThemeGraphSize({
  53865. * maxGraphSize: 1,
  53866. * minGraphSize: 0.35
  53867. * }),
  53868. * //统计图上的文字是否可见以及文字标注风格
  53869. * graphText: new ThemeGraphText({
  53870. * graphTextDisplayed: true,
  53871. * graphTextFormat: ThemeGraphTextFormat.VALUE,
  53872. * graphTextStyle: new ServerTextStyle({
  53873. * sizeFixed: true,
  53874. * fontHeight: 9,
  53875. * fontWidth: 5
  53876. * })
  53877. * }),
  53878. * //统计专题图类型为三维柱状图
  53879. * graphType: ThemeGraphType.BAR3D
  53880. * }),
  53881. * //专题图参数对象
  53882. * themeParameters = new ThemeParameters({
  53883. * themes: [themeGraph],
  53884. * dataSourceNames: ["Jingjin"],
  53885. * datasetNames: ["BaseMap_R"]
  53886. * }),
  53887. * //与服务端交互
  53888. * themeService=new ThemeService(url, {
  53889. * eventListeners: {
  53890. * "processCompleted": ThemeCompleted,
  53891. * "processFailed": themeFailed
  53892. * }
  53893. * });
  53894. * themeService.processAsync(themeParameters);
  53895. * }
  53896. */
  53897. this.memoryKeys = null;
  53898. /**
  53899. * @member {boolean} [ThemeGraph.prototype.negativeDisplayed=false]
  53900. * @description 专题图中是否显示属性为负值的数据。true 表示显示;false 不显示。
  53901. */
  53902. this.negativeDisplayed = false;
  53903. /**
  53904. * @member {ThemeOffset} ThemeGraph.prototype.offset
  53905. * @description 用于设置统计图相对于要素内点的偏移量。
  53906. */
  53907. this.offset = new ThemeOffset();
  53908. /**
  53909. * @member {boolean} ThemeGraph.prototype.overlapAvoided
  53910. * @description 统计图是否采用避让方式显示。<br>
  53911. * 1.对数据集制作统计专题图:当统计图采用避让方式显示时,如果 overlapAvoided 为 true,则在统计图重叠度很大的情况下,
  53912. * 会出现无法完全避免统计图重叠的现象;如果 overlapAvoided 为 false,会过滤掉一些统计图,从而保证所有的统计图均不重叠。<br>
  53913. * 2.对数据集同时制作统计专题图和标签专题图:当统计图不显示子项文本时,标签专题图的标签即使和统计图重叠,两者也都可正常显示;
  53914. * 当统计图显示子项文本时,如果统计图中的子项文本和标签专题图中的标签不重叠,则两者均正常显示;如果重叠,则会过滤掉统计图的子项文本,只显示标签。
  53915. */
  53916. this.overlapAvoided = true;
  53917. /**
  53918. * @member {number} [ThemeGraph.prototype.roseAngle=0]
  53919. * @description 统计图中玫瑰图或三维玫瑰图用于等分的角度,默认为 0 度,精确到 0.1 度。在角度为0或者大于 360 度的情况下均使用 360 度来等分制作统计图的字段数。
  53920. */
  53921. this.roseAngle = 0;
  53922. /**
  53923. * @member {number} [ThemeGraph.prototype.startAngle=0]
  53924. * @description 饼状统计图扇形的起始角度。精确到 0.1 度,以水平方向为正向。只有选择的统计图类型为饼状图(饼图、三维饼图、玫瑰图、三维玫瑰图)时,此项才可设置。
  53925. */
  53926. this.startAngle = 0;
  53927. if (options) {
  53928. Util_Util.extend(this, options);
  53929. }
  53930. this.CLASS_NAME = "SuperMap.ThemeGraph";
  53931. }
  53932. /**
  53933. * @function ThemeGraph.prototype.destroy
  53934. * @override
  53935. */
  53936. destroy() {
  53937. super.destroy();
  53938. var me = this;
  53939. me.barWidth = null;
  53940. me.graduatedMode = null;
  53941. if (me.graphAxes) {
  53942. me.graphAxes.destroy();
  53943. me.graphAxes = null;
  53944. }
  53945. if (me.graphSize) {
  53946. me.graphSize.destroy();
  53947. me.graphSize = null;
  53948. }
  53949. me.graphSizeFixed = null;
  53950. if (me.graphText) {
  53951. me.graphText.destroy();
  53952. me.graphText = null;
  53953. }
  53954. me.graphType = null;
  53955. if (me.items) {
  53956. for (var i = 0, items = me.items, len = items.length; i < len; i++) {
  53957. items[i].destroy();
  53958. }
  53959. me.items = null;
  53960. }
  53961. me.memoryKeys = null;
  53962. me.negativeDisplayed = null;
  53963. if (me.offset) {
  53964. me.offset.destroy();
  53965. me.offset = null;
  53966. }
  53967. me.overlapAvoided = null;
  53968. me.roseAngle = null;
  53969. me.startAngle = null;
  53970. me.graphAxesTextDisplayMode = null;
  53971. }
  53972. /**
  53973. * @function ThemeGraph.prototype.toJSON
  53974. * @description 将 ThemeGraph 对象转化为 JSON 字符串。
  53975. * @returns {string} 返回转换后的 JSON 字符串。
  53976. */
  53977. toJSON() {
  53978. return Util_Util.toJSON(this.toServerJSONObject());
  53979. }
  53980. /**
  53981. * @function ThemeGraph.prototype.toServerJSONObject
  53982. * @description 转换成对应的 JSON 格式对象。
  53983. * @returns {Object} 对应的 JSON 格式对象。
  53984. */
  53985. toServerJSONObject() {
  53986. var obj = {};
  53987. obj.type = this.type;
  53988. if (this.graphText) {
  53989. obj.graphTextDisplayed = this.graphText.graphTextDisplayed;
  53990. obj.graphTextFormat = this.graphText.graphTextFormat;
  53991. obj.graphTextStyle = this.graphText.graphTextStyle;
  53992. }
  53993. if (this.graphAxes) {
  53994. obj.axesColor = this.graphAxes.axesColor;
  53995. obj.axesDisplayed = this.graphAxes.axesDisplayed;
  53996. obj.axesGridDisplayed = this.graphAxes.axesGridDisplayed;
  53997. obj.axesTextDisplayed = this.graphAxes.axesTextDisplayed;
  53998. obj.axesTextStyle = this.graphAxes.axesTextStyle;
  53999. }
  54000. if (this.graphSize) {
  54001. obj.maxGraphSize = this.graphSize.maxGraphSize;
  54002. obj.minGraphSize = this.graphSize.minGraphSize;
  54003. }
  54004. if (this.offset) {
  54005. obj.offsetFixed = this.offset.offsetFixed;
  54006. obj.offsetX = this.offset.offsetX;
  54007. obj.offsetY = this.offset.offsetY;
  54008. }
  54009. obj.barWidth = this.barWidth;
  54010. obj.graduatedMode = this.graduatedMode;
  54011. obj.graphSizeFixed = this.graphSizeFixed;
  54012. obj.graphType = this.graphType;
  54013. obj.graphAxesTextDisplayMode = this.graphAxesTextDisplayMode;
  54014. obj.items = this.items;
  54015. obj.memoryKeys = this.memoryKeys;
  54016. obj.negativeDisplayed = this.negativeDisplayed;
  54017. obj.overlapAvoided = this.overlapAvoided;
  54018. obj.roseAngle = this.roseAngle;
  54019. obj.startAngle = this.startAngle;
  54020. return obj;
  54021. }
  54022. /**
  54023. * @function ThemeGraph.fromObj
  54024. * @description 从传入对象获取统计专题图类。
  54025. * @param {Object} obj - 传入对象。
  54026. * @returns {ThemeGraph} ThemeGraph 对象。
  54027. */
  54028. static fromObj(obj) {
  54029. var res = new ThemeGraph();
  54030. var itemsG = obj.items;
  54031. var len = itemsG ? itemsG.length : 0;
  54032. Util_Util.copy(res, obj);
  54033. res.items = [];
  54034. res.graphAxes = ThemeGraphAxes.fromObj(obj);
  54035. res.graphSize = ThemeGraphSize.fromObj(obj);
  54036. res.graphText = ThemeGraphText.fromObj(obj);
  54037. res.offset = ThemeOffset.fromObj(obj);
  54038. for (var i = 0; i < len; i++) {
  54039. res.items.push(ThemeGraphItem.fromObj(itemsG[i]));
  54040. }
  54041. return res;
  54042. }
  54043. }
  54044. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeDotDensity.js
  54045. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54046. * This program are made available under the terms of the Apache License, Version 2.0
  54047. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54048. /**
  54049. * @class ThemeDotDensity
  54050. * @deprecatedclass SuperMap.ThemeDotDensity
  54051. * @category iServer Map Theme
  54052. * @classdesc 点密度专题图。点密度专题图用一定大小、形状相同的点表示现象分布范围、数量特征和分布密度。点的多少和所代表的意义由地图的内容确定。
  54053. * 点密度专题图利用图层的某一数值属性信息(专题值)映射为不同等级,每一级别使用不同数量或表现为密度的点符号来表示。
  54054. * 该专题值在各个分区内的分布情况,体现不同区域的相对数量差异。多用于具有数量特征的地图上,
  54055. * 比如表示不同地区的粮食产量、GDP、人口等的分级,主要针对区域或面状的要素,因而,点密度专题图适用于面数据集。
  54056. * 注意:点密度专题图中点的分布是随机的,并不代表实际的分布位置。即使在相关设置完全相同的情况下,
  54057. * 每次制作出的专题图,点的数量相同,但点的位置都有差异。
  54058. * @extends {CommonTheme}
  54059. * @param {Object} options - 参数。
  54060. * @param {string} options.dotExpression - 创建点密度专题图的字段或字段表达式。
  54061. * @param {ServerStyle} [options.style] - 点密度专题图中点的风格。
  54062. * @param {number} [options.value] - 专题图中每一个点所代表的数值。
  54063. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  54064. * @usage
  54065. */
  54066. class ThemeDotDensity extends Theme_Theme {
  54067. constructor(options) {
  54068. super("DOTDENSITY", options);
  54069. /**
  54070. * @member {string} ThemeDotDensity.prototype.dotExpression
  54071. * @description 创建点密度专题图的字段或字段表达式。点的数目或密集程度的来源。
  54072. */
  54073. this.dotExpression = null;
  54074. /**
  54075. * @member {ServerStyle} ThemeDotDensity.prototype.style
  54076. * @description 点密度专题图中点的风格。
  54077. */
  54078. this.style = new ServerStyle();
  54079. /**
  54080. * @member {number} ThemeDotDensity.prototype.value
  54081. * @description 专题图中每一个点所代表的数值。<br>
  54082. * 点值的确定与地图比例尺以及点的大小有关。地图比例尺越大,相应的图面范围也越大,
  54083. * 点相应就可以越多,此时点值就可以设置相对小一些。点形状越大,
  54084. * 点值相应就应该设置的小一些。点值过大或过小都是不合适的。
  54085. */
  54086. this.value = null;
  54087. if (options) {
  54088. Util_Util.extend(this, options);
  54089. }
  54090. this.CLASS_NAME = "SuperMap.ThemeDotDensity";
  54091. }
  54092. /**
  54093. * @function ThemeDotDensity.prototype.destroy
  54094. * @description 释放资源,将引用资源的属性置空。
  54095. */
  54096. destroy() {
  54097. var me = this;
  54098. me.dotExpression = null;
  54099. me.value = null;
  54100. if (me.style) {
  54101. me.style.destroy();
  54102. me.style = null;
  54103. }
  54104. }
  54105. /**
  54106. * @function ThemeDotDensity.prototype.toServerJSONObject
  54107. * @description 转换成对应的 JSON 格式对象。
  54108. * @returns {Object} 对应的 JSON 格式对象。
  54109. */
  54110. toServerJSONObject() {
  54111. var obj = {};
  54112. obj = Util_Util.copyAttributes(obj, this);
  54113. if (obj.style) {
  54114. if (obj.style.toServerJSONObject) {
  54115. obj.style = obj.style.toServerJSONObject();
  54116. }
  54117. }
  54118. return obj;
  54119. }
  54120. /**
  54121. * @function ThemeDotDensity.fromObj
  54122. * @description 从传入对象获取点密度专题图中点的风格。
  54123. * @param {Object} obj - 传入对象。
  54124. * @returns {ThemeDotDensity} ThemeDotDensity 对象。
  54125. */
  54126. static fromObj(obj) {
  54127. if (!obj) {
  54128. return;
  54129. }
  54130. var res = new ThemeDotDensity();
  54131. Util_Util.copy(res, obj);
  54132. res.style = ServerStyle.fromJson(obj.style);
  54133. return res;
  54134. }
  54135. }
  54136. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbolStyle.js
  54137. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54138. * This program are made available under the terms of the Apache License, Version 2.0
  54139. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54140. /**
  54141. * @class ThemeGraduatedSymbolStyle
  54142. * @deprecatedclass SuperMap.ThemeGraduatedSymbolStyle
  54143. * @category iServer Map Theme
  54144. * @classdesc 等级符号专题图正负零值显示风格类。
  54145. * @param {Object} options - 参数。
  54146. * @param {boolean} [options.negativeDisplayed=false] - 是否显示负值。
  54147. * @param {ServerStyle} [options.negativeStyle] - 负值的等级符号风格。
  54148. * @param {ServerStyle} [options.positiveStyle] - 正值的等级符号风格。
  54149. * @param {boolean} [options.zeroDisplayed=false] - 是否显示 0 值。
  54150. * @param {ServerStyle} [options.zeroStyle] - 0 值的等级符号风格。
  54151. * @usage
  54152. */
  54153. class ThemeGraduatedSymbolStyle {
  54154. constructor(options) {
  54155. /**
  54156. * @member {boolean} [ThemeGraduatedSymbolStyle.prototype.negativeDisplayed=false]
  54157. * @description 是否显示负值。
  54158. */
  54159. this.negativeDisplayed = false;
  54160. /**
  54161. * @member {ServerStyle} [ThemeGraduatedSymbolStyle.prototype.negativeStyle]
  54162. * @description 负值的等级符号风格。
  54163. */
  54164. this.negativeStyle = new ServerStyle();
  54165. /**
  54166. * @member {ServerStyle} [ThemeGraduatedSymbolStyle.prototype.positiveStyle]
  54167. * @description 正值的等级符号风格。
  54168. */
  54169. this.positiveStyle = new ServerStyle();
  54170. /**
  54171. * @member {boolean} [ThemeGraduatedSymbolStyle.prototype.zeroDisplayed=false]
  54172. * @description 是否显示 0 值。
  54173. */
  54174. this.zeroDisplayed = false;
  54175. /**
  54176. * @member {ServerStyle} ThemeGraduatedSymbolStyle.prototype.zeroStyle
  54177. * @description 0 值的等级符号风格。
  54178. */
  54179. this.zeroStyle = new ServerStyle();
  54180. if (options) {
  54181. Util_Util.extend(this, options);
  54182. }
  54183. this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbolStyle";
  54184. }
  54185. /**
  54186. * @function ThemeGraduatedSymbolStyle.prototype.destroy
  54187. * @description 释放资源,将引用资源的属性置空。
  54188. */
  54189. destroy() {
  54190. var me = this;
  54191. me.negativeDisplayed = null;
  54192. me.negativeStyle = null;
  54193. me.positiveStyle = null;
  54194. me.zeroDisplayed = null;
  54195. me.zeroStyle = null;
  54196. }
  54197. /**
  54198. * @function ThemeGraduatedSymbolStyle.fromObj
  54199. * @description 从传入对象获取等级符号专题图正负零值显示风格类。
  54200. * @param {Object} obj - 传入对象。
  54201. * @returns {ThemeGraduatedSymbolStyle} ThemeGraduatedSymbolStyle 对象。
  54202. */
  54203. static fromObj(obj) {
  54204. if (!obj) {
  54205. return;
  54206. }
  54207. var res = new ThemeGraduatedSymbolStyle();
  54208. Util_Util.copy(res, obj);
  54209. res.negativeStyle = ServerStyle.fromJson(obj.negativeStyle);
  54210. res.positiveStyle = ServerStyle.fromJson(obj.positiveStyle);
  54211. res.zeroStyle = ServerStyle.fromJson(obj.zeroStyle);
  54212. return res;
  54213. }
  54214. }
  54215. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbol.js
  54216. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54217. * This program are made available under the terms of the Apache License, Version 2.0
  54218. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54219. /**
  54220. * @class ThemeGraduatedSymbol
  54221. * @deprecatedclass SuperMap.ThemeGraduatedSymbol
  54222. * @category iServer Map Theme
  54223. * @classdesc 等级符号专题图。
  54224. * @extends {CommonTheme}
  54225. * @param {Object} options - 参数。
  54226. * @param {ThemeGraduatedSymbolStyle} options.style - 等级符号专题图正负零值显示风格类。
  54227. * @param {string} options.expression - 等级符号专题图的字段或字段表达式。
  54228. * @param {number} [options.baseValue=0] - 等级符号专题图的基准值,单位同专题变量的单位。
  54229. * @param {GraduatedMode} [options.graduatedMode=GraduatedMode.CONSTANT] - 等级符号专题图分级模式。
  54230. * @param {ThemeOffset} [options.offset] - 指定等级符号专题图中标记文本相对于要素内点的偏移量对象。
  54231. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  54232. * @usage
  54233. */
  54234. class ThemeGraduatedSymbol extends Theme_Theme {
  54235. constructor(options) {
  54236. super("GRADUATEDSYMBOL", options);
  54237. /**
  54238. * @member {number} [ThemeGraduatedSymbol.prototype.baseValue=0]
  54239. * @description 等级符号专题图的基准值,单位同专题变量的单位。<br>
  54240. * 依据此值系统会自动根据分级方式计算其余值对应的符号大小,每个符号的显示大小等于
  54241. * ThemeValueSection.positiveStyle(或 zeroStyle,negativeStyle).markerSize * value / basevalue,
  54242. * 其中 value 是 expression 所指定字段对应的值经过分级计算之后的值。默认值为0,建议通过多次尝试设置该值才能达到较好的显示效果。
  54243. */
  54244. this.baseValue = 0;
  54245. /**
  54246. * @member {string} ThemeGraduatedSymbol.prototype.expression
  54247. * @description 用于创建等级符号专题图的字段或字段表达式,字段或字段表达式应为数值型。
  54248. */
  54249. this.expression = null;
  54250. /**
  54251. * @member {GraduatedMode} [ThemeGraduatedSymbol.prototype.graduatedMode=GraduatedMode.CONSTANT]
  54252. * @description 等级符号专题图分级模式。<br>
  54253. * 分级主要是为了减少制作等级符号专题图中数据大小之间的差异。如果数据之间差距较大,则可以采用对数或者平方根的分级方式来进行,
  54254. * 这样就减少了数据之间的绝对大小的差异,使得等级符号图的视觉效果比较好,同时不同类别之间的比较也是有意义的。
  54255. * 有三种分级模式:常数、对数和平方根,对于有值为负数的字段,在用对数或平方根方式分级时,默认对负数取正。
  54256. * 不同的分级模式用于确定符号大小的数值是不相同的:常数按照字段的原始数据进行;对数则是对每条记录对应的专题变量取自然对数;
  54257. * 平方根则是对其取平方根,然后用最终得到的结果来确定其等级符号的大小。
  54258. */
  54259. this.graduatedMode = GraduatedMode.CONSTAN;
  54260. /**
  54261. * @member {ThemeOffset} [ThemeGraduatedSymbol.prototype.offset]
  54262. * @description 用于设置等级符号图相对于要素内点的偏移量。
  54263. */
  54264. this.offset = new ThemeOffset();
  54265. /**
  54266. * @member {ThemeGraduatedSymbolStyle} ThemeGraduatedSymbol.prototype.style
  54267. * @description 用于设置等级符号图正负和零值显示风格。
  54268. */
  54269. this.style = new ThemeGraduatedSymbolStyle();
  54270. if (options) {
  54271. Util_Util.extend(this, options);
  54272. }
  54273. this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbol";
  54274. }
  54275. /**
  54276. * @function ThemeGraduatedSymbol.prototype.destroy
  54277. * @description 释放资源,将引用资源的属性置空。
  54278. */
  54279. destroy() {
  54280. super.destroy();
  54281. var me = this;
  54282. me.expression = null;
  54283. me.graduatedMode = GraduatedMode.CONSTANT;
  54284. if (me.offset) {
  54285. me.offset.destroy();
  54286. me.offset = null;
  54287. }
  54288. if (me.style) {
  54289. me.style.destroy();
  54290. me.style = null;
  54291. }
  54292. }
  54293. /**
  54294. * @function ThemeGraduatedSymbol.prototype.toJSON
  54295. * @description 将 themeLabel 对象转化为 JSON 字符串。
  54296. * @returns {string} 返回转换后的 JSON 字符串。
  54297. */
  54298. toJSON() {
  54299. return Util_Util.toJSON(this.toServerJSONObject());
  54300. }
  54301. /**
  54302. * @function ThemeGraduatedSymbol.prototype.toServerJSONObject
  54303. * @description 转换成对应的 JSON 格式对象。
  54304. * @returns {Object} 对应的 JSON 格式对象。
  54305. */
  54306. toServerJSONObject() {
  54307. var obj = {};
  54308. obj.type = this.type;
  54309. obj.memoryData = this.memoryData;
  54310. obj.baseValue = this.baseValue;
  54311. obj.expression = this.expression;
  54312. obj.graduatedMode = this.graduatedMode;
  54313. if (this.offset) {
  54314. obj.offsetFixed = this.offset.offsetFixed;
  54315. obj.offsetX = this.offset.offsetX;
  54316. obj.offsetY = this.offset.offsetY;
  54317. }
  54318. if (this.style) {
  54319. obj.negativeStyle = this.style.negativeStyle;
  54320. obj.negativeDisplayed = this.style.negativeDisplayed;
  54321. obj.positiveStyle = this.style.positiveStyle;
  54322. obj.zeroDisplayed = this.style.zeroDisplayed;
  54323. obj.zeroStyle = this.style.zeroStyle;
  54324. }
  54325. return obj;
  54326. }
  54327. /**
  54328. * @function ThemeGraduatedSymbol.fromObj
  54329. * @description 从传入对象获取等级符号专题图。
  54330. * @param {Object} obj - 传入对象。
  54331. * @returns {ThemeGraduatedSymbol} 等级符号专题图对象。
  54332. */
  54333. static fromObj(obj) {
  54334. if (!obj) {
  54335. return;
  54336. }
  54337. var res = new ThemeGraduatedSymbol();
  54338. Util_Util.copy(res, obj);
  54339. res.offset = ThemeOffset.fromObj(obj);
  54340. res.style = ThemeGraduatedSymbolStyle.fromObj(obj);
  54341. return res;
  54342. }
  54343. }
  54344. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeRangeItem.js
  54345. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54346. * This program are made available under the terms of the Apache License, Version 2.0
  54347. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54348. /**
  54349. * @class ThemeRangeItem
  54350. * @deprecatedclass SuperMap.ThemeRangeItem
  54351. * @category iServer Map Theme
  54352. * @classdesc 范围分段专题图子项类。在分段专题图中,字段值按照某种分段模式被分成多个范围段,
  54353. * 每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
  54354. * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为[start, end)。
  54355. * @param {Object} options - 参数。
  54356. * @param {string} [options.caption] - 子项的标题。
  54357. * @param {number} [options.end=0] - 子项的终止值。
  54358. * @param {number} [options.start=0] - 子项的起始值。
  54359. * @param {ServerStyle} options.style - 子项的风格。
  54360. * @param {boolean} [options.visible=true] - 子项是否可见。
  54361. * @usage
  54362. */
  54363. class ThemeRangeItem {
  54364. constructor(options) {
  54365. /**
  54366. * @member {string} [ThemeRangeItem.prototype.caption]
  54367. * @description 分段专题图子项的标题。
  54368. */
  54369. this.caption = null;
  54370. /**
  54371. * @member {number} [ThemeRangeItem.prototype.end=0]
  54372. * @description 分段专题图子项的终止值,即该段专题值范围的最大值。<br>
  54373. * 如果该子项是分段中最后一个子项,则该终止值应大于分段字段(ThemeRange 类的 rangeExpression 属性)的最大值,若该终止值小于分段字段最大值,
  54374. * 则剩余部分由内部随机定义其颜色;如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常;
  54375. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
  54376. */
  54377. this.end = 0;
  54378. /**
  54379. * @member {number} [ThemeRangeItem.prototype.start=0]
  54380. * @description 分段专题图子项的起始值,即该段专题值范围的最小值。<br>
  54381. * 如果该子项是分段中第一个子项,那么该起始值就是分段的最小值;如果子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
  54382. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
  54383. */
  54384. this.start = 0;
  54385. /**
  54386. * @member {ServerStyle} ThemeRangeItem.prototype.style
  54387. * @description 分段专题图子项的风格。
  54388. * 每一个分段专题图子项都对应一种显示风格。
  54389. */
  54390. this.style = new ServerStyle();
  54391. /**
  54392. * @member {boolean} [ThemeRangeItem.prototype.visible=true]
  54393. * @description 分段专题图子项是否可见。
  54394. */
  54395. this.visible = true;
  54396. if (options) {
  54397. Util_Util.extend(this, options);
  54398. }
  54399. this.CLASS_NAME = "SuperMap.ThemeRangeItem";
  54400. }
  54401. /**
  54402. * @function ThemeRangeItem.prototype.destroy
  54403. * @description 释放资源,将引用资源的属性置空。
  54404. */
  54405. destroy() {
  54406. var me = this;
  54407. me.caption = null;
  54408. me.end = null;
  54409. me.start = null;
  54410. if (me.style) {
  54411. me.style.destroy();
  54412. me.style = null;
  54413. }
  54414. me.visible = null;
  54415. }
  54416. /**
  54417. * @function ThemeRangeItem.prototypetoServerJSONObject
  54418. * @description 转换成对应的 JSON 格式对象。
  54419. * @returns {Object} 对应的 JSON 格式对象。
  54420. */
  54421. toServerJSONObject() {
  54422. var obj = {};
  54423. obj = Util_Util.copyAttributes(obj, this);
  54424. if (obj.style) {
  54425. if (obj.style.toServerJSONObject) {
  54426. obj.style = obj.style.toServerJSONObject();
  54427. }
  54428. }
  54429. return obj;
  54430. }
  54431. /**
  54432. * @function ThemeRangeItem.fromObj
  54433. * @description 从传入对象获取范围分段专题图子项类。
  54434. * @param {Object} obj - 传入对象。
  54435. * @returns {ThemeRangeItem} ThemeRangeItem 对象。
  54436. */
  54437. static fromObj(obj) {
  54438. if (!obj) {
  54439. return;
  54440. }
  54441. var res = new ThemeRangeItem();
  54442. Util_Util.copy(res, obj);
  54443. res.style = ServerStyle.fromJson(obj.style);
  54444. return res;
  54445. }
  54446. }
  54447. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeRange.js
  54448. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54449. * This program are made available under the terms of the Apache License, Version 2.0
  54450. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54451. /**
  54452. * @class ThemeRange
  54453. * @deprecatedclass SuperMap.ThemeRange
  54454. * @category iServer Map Theme
  54455. * @classdesc 范围分段专题图。
  54456. * 范围分段专题图是按照指定的分段方法(如:等距离分段法)对字段的属性值进行分段,使用不同的颜色或符号(线型、填充)表示不同范围段落的属性值在整体上的分布情况,体现区域的差异。
  54457. * 在分段专题图中,专题值按照某种分段方式被分成多个范围段,要素根据各自的专题值被分配到其中一个范围段中,在同一个范围段中的要素使用相同的颜色,填充,符号等风格进行显示。
  54458. * 分段专题图所基于的专题变量必须为数值型,分段专题图一般用来反映连续分布现象的数量或程度特征,如降水量的分布,土壤侵蚀强度的分布等。
  54459. * @extends {CommonTheme}
  54460. * @param {Object} options - 参数。
  54461. * @param {Array.<ThemeRangeItem>} options.items - 子项数组。
  54462. * @param {string} options.rangeExpression - 分段字段表达式。
  54463. * @param {number} options.rangeParameter - 分段参数。
  54464. * @param {RangeMode} [options.rangeMode=RangeMode.EQUALINTERVAL] - 分段模式。
  54465. * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  54466. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  54467. * @usage
  54468. */
  54469. class ThemeRange extends Theme_Theme {
  54470. constructor(options) {
  54471. super("RANGE", options);
  54472. /**
  54473. * @member {string} ThemeRange.prototype.precision
  54474. * @description 精准度。
  54475. */
  54476. this.precision = '1.0E-12';
  54477. /**
  54478. * @member {Array.<ThemeRangeItem>} ThemeRange.prototype.items
  54479. * @description 分段专题图子项数组。<br>
  54480. * 在分段专题图中,字段值按照某种分段模式被分成多个范围段,每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
  54481. * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为 [start, end)。
  54482. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按照您设置的值对分段结果进行调整。
  54483. */
  54484. this.items = null;
  54485. /**
  54486. * @member {string} ThemeRange.prototype.rangeExpression
  54487. * @description 分段字段表达式。<br>
  54488. * 由于范围分段专题图基于各种分段方法根据一定的距离进行分段,因而范围分段专题图所基于的字段值的数据类型必须为数值型。对于字段表达式,只能为数值型的字段间的运算。
  54489. */
  54490. this.rangeExpression = null;
  54491. /**
  54492. * @member {RangeMode} [ThemeRange.prototype.rangeMode=RangeMode.EQUALINTERVAL]
  54493. * @description 分段专题图的分段模式。<br>
  54494. * 在分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
  54495. * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
  54496. * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
  54497. */
  54498. this.rangeMode = RangeMode.EQUALINTERVAL;
  54499. /**
  54500. * @member {number} ThemeRange.prototype.rangeParameter
  54501. * @description 分段参数。
  54502. * 当分段模式为等距离分段法,平方根分段,对数分段法,等计数分段法其中一种模式时,该参数用于设置分段个数;当分段模式为标准差分段法时,
  54503. * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
  54504. */
  54505. this.rangeParameter = 0;
  54506. /**
  54507. * @member {ColorGradientType} [ThemeRange.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
  54508. * @description 渐变颜色枚举类。<br>
  54509. * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
  54510. * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色方案完成填充。但如果为某几个子项的风格进行单独设置后(设置了 {@link ThemeUniqueItem} 或 {@link ThemeRangeItem} 类中Style属性),
  54511. * 该配色方案对于这几个子项将不起作用。
  54512. */
  54513. this.colorGradientType = ColorGradientType.YELLOW_RED;
  54514. if (options) {
  54515. Util_Util.extend(this, options);
  54516. }
  54517. this.CLASS_NAME = "SuperMap.ThemeRange";
  54518. }
  54519. /**
  54520. * @function ThemeRange.prototype.destroy
  54521. * @override
  54522. */
  54523. destroy() {
  54524. super.destroy();
  54525. var me = this;
  54526. if (me.items) {
  54527. if (me.items.length > 0) {
  54528. for (var item in me.items) {
  54529. me.items[item].destroy();
  54530. me.items[item] = null;
  54531. }
  54532. }
  54533. me.items = null;
  54534. }
  54535. me.rangeExpression = null;
  54536. me.rangeMode = null;
  54537. me.rangeParameter = null;
  54538. me.colorGradientType = null;
  54539. }
  54540. /**
  54541. * @function ThemeRange.fromObj
  54542. * @description 从传入对象获取范围分段专题图类。
  54543. * @param {Object} obj - 传入对象。
  54544. * @returns {ThemeRange} ThemeRange 对象。
  54545. */
  54546. static fromObj(obj) {
  54547. if (!obj) {
  54548. return;
  54549. }
  54550. var res = new ThemeRange();
  54551. Util_Util.copy(res, obj);
  54552. var itemsR = obj.items;
  54553. var len = itemsR ? itemsR.length : 0;
  54554. res.items = [];
  54555. for (var i = 0; i < len; i++) {
  54556. res.items.push(ThemeRangeItem.fromObj(itemsR[i]));
  54557. }
  54558. return res;
  54559. }
  54560. }
  54561. ;// CONCATENATED MODULE: ./src/common/iServer/UGCLayer.js
  54562. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54563. * This program are made available under the terms of the Apache License, Version 2.0
  54564. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54565. /**
  54566. * @class UGCLayer
  54567. * @deprecatedclass SuperMap.UGCLayer
  54568. * @category iServer Map Layer
  54569. * @classdesc SuperMap 图层类。
  54570. * @param {Object} options - 参数。
  54571. * @param {Bounds} options.bounds - 图层范围。
  54572. * @param {string} options.name - 图层的名称。
  54573. * @param {UGCLayerType} options.type - 图层类型。
  54574. * @param {string} [options.caption] - 图层的标题。
  54575. * @param {string} [options.description] - 图层的描述信息。
  54576. * @param {boolean} [options.queryable] - 图层中的对象是否可以查询。
  54577. * @param {boolean} [options.subUGCLayers] - 是否允许图层的符号大小随图缩放。
  54578. * @param {boolean} [options.visible=false] - 地图对象在同一范围内时,是否重叠显示。
  54579. * @usage
  54580. */
  54581. class UGCLayer {
  54582. constructor(options) {
  54583. options = options || {};
  54584. /**
  54585. * @member {Bounds} UGCLayer.prototype.bounds
  54586. * @description 图层范围。
  54587. */
  54588. this.bounds = null;
  54589. /**
  54590. * @member {string} [UGCLayer.prototype.caption]
  54591. * @description 图层的标题。默认情况下图层的标题与图层的名称一致。在图例、图层控制列表中显示的图层名称就是该图层的标题值。
  54592. */
  54593. this.caption = null;
  54594. /**
  54595. * @member {string} UGCLayer.prototype.description
  54596. * @description 图层的描述信息。
  54597. */
  54598. this.description = null;
  54599. /**
  54600. * @member {string} UGCLayer.prototype.name
  54601. * @description 图层的名称。图层的名称在图层所在的地图中唯一标识此图层。该属性区分大小写。
  54602. */
  54603. this.name = null;
  54604. /**
  54605. * @member {boolean} UGCLayer.prototype.queryable
  54606. * @description 图层中的对象是否可以查询。
  54607. */
  54608. this.queryable = null;
  54609. /**
  54610. * @member {Array} UGCLayer.prototype.subLayers
  54611. * @description 子图层集。
  54612. */
  54613. this.subLayers = null;
  54614. /**
  54615. * @member {UGCLayerType} UGCLayer.prototype.type
  54616. * @description 图层类型。
  54617. */
  54618. this.type = null;
  54619. /**
  54620. * @member {boolean} UGCLayer.prototype.visible
  54621. * @description 地图对象在同一范围内时,是否重叠显示。
  54622. */
  54623. this.visible = null;
  54624. Util_Util.extend(this, options);
  54625. this.CLASS_NAME = "SuperMap.UGCLayer";
  54626. }
  54627. /**
  54628. * @function UGCLayer.prototype.destroy
  54629. * @description 释放资源,将引用资源的属性置空。
  54630. */
  54631. destroy() {
  54632. var me = this;
  54633. Util_Util.reset(me);
  54634. }
  54635. /**
  54636. * @function UGCLayer.prototype.fromJson
  54637. * @description 将服务端 JSON 对象转换成当前客户端对象。
  54638. * @param {Object} jsonObject - 要转换的 JSON 对象。
  54639. */
  54640. fromJson(jsonObject) {
  54641. jsonObject = jsonObject ? jsonObject : {};
  54642. Util_Util.extend(this, jsonObject);
  54643. var b = this.bounds;
  54644. if (b) {
  54645. this.bounds = new Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
  54646. }
  54647. }
  54648. /**
  54649. * @function UGCLayer.prototype.toServerJSONObject
  54650. * @description 转换成对应的 JSON 格式对象。
  54651. * @returns {Object} 对应的 JSON 格式对象。
  54652. */
  54653. toServerJSONObject() {
  54654. var jsonObject = {};
  54655. jsonObject = Util_Util.copyAttributes(jsonObject, this);
  54656. if (jsonObject.bounds) {
  54657. if (jsonObject.bounds.toServerJSONObject) {
  54658. jsonObject.bounds = jsonObject.bounds.toServerJSONObject();
  54659. }
  54660. }
  54661. return jsonObject;
  54662. }
  54663. }
  54664. ;// CONCATENATED MODULE: ./src/common/iServer/UGCMapLayer.js
  54665. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54666. * This program are made available under the terms of the Apache License, Version 2.0
  54667. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54668. /**
  54669. * @class UGCMapLayer
  54670. * @deprecatedclass SuperMap.UGCMapLayer
  54671. * @category iServer Map Layer
  54672. * @classdesc SuperMap 地图图层类。
  54673. * @extends {UGCLayer}
  54674. * @param {Object} options - 可选参数。
  54675. * @param {boolean} [options.completeLineSymbolDisplayed] - 是否显示完整线型。
  54676. * @param {number} [options.maxScale] - 地图最大比例尺。
  54677. * @param {number} [options.minScale] - 地图最小比例尺。
  54678. * @param {number} [options.minVisibleGeometrySize] - 几何对象的最小可见大小,以像素为单位。
  54679. * @param {number} [options.opaqueRate] - 图层的不透明度。
  54680. * @param {boolean} [options.symbolScalable] - 是否允许图层的符号大小随图缩放。
  54681. * @param {number} [options.symbolScale] - 图层的符号缩放基准比例尺。
  54682. * @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内时,是否重叠显示。
  54683. * @param {OverlapDisplayedOptions} [options.overlapDisplayedOptions] - 地图的压盖过滤显示选项,当overlapDisplayed 为 false 时有效。
  54684. * @usage
  54685. */
  54686. class UGCMapLayer extends UGCLayer {
  54687. constructor(options) {
  54688. options = options || {};
  54689. super(options);
  54690. /**
  54691. * @member {boolean} UGCMapLayer.prototype.completeLineSymbolDisplayed
  54692. * @description 是否显示完整线型。
  54693. */
  54694. this.completeLineSymbolDisplayed = null;
  54695. /**
  54696. * @member {number} UGCMapLayer.prototype.maxScale
  54697. * @description 地图最大比例尺。
  54698. */
  54699. this.maxScale = null;
  54700. /**
  54701. * @member {number} UGCMapLayer.prototype.minScale
  54702. * @description 地图最小比例尺。
  54703. */
  54704. this.minScale = null;
  54705. /**
  54706. * @member {number} UGCMapLayer.prototype.minVisibleGeometrySize
  54707. * @description 几何对象的最小可见大小,以像素为单位。
  54708. */
  54709. this.minVisibleGeometrySize = null;
  54710. /**
  54711. * @member {number} UGCMapLayer.prototype.opaqueRate
  54712. * @description 图层的不透明度。
  54713. */
  54714. this.opaqueRate = null;
  54715. /**
  54716. * @member {boolean} UGCMapLayer.prototype.symbolScalable
  54717. * @description 是否允许图层的符号大小随图缩放。
  54718. */
  54719. this.symbolScalable = null;
  54720. /**
  54721. * @member {number} UGCMapLayer.prototype.symbolScale
  54722. * @description 图层的符号缩放基准比例尺。
  54723. */
  54724. this.symbolScale = null;
  54725. /**
  54726. * @member {boolean} [UGCMapLayer.prototype.overlapDisplayed=false]
  54727. * @description 地图对象在同一范围内时,是否重叠显示。
  54728. */
  54729. this.overlapDisplayed = null;
  54730. /**
  54731. * @member {OverlapDisplayedOptions} UGCMapLayer.prototype.overlapDisplayedOptions
  54732. * @description 地图的压盖过滤显示选项,当 overlapDisplayed 为 false 时有效。
  54733. */
  54734. this.overlapDisplayedOptions = null;
  54735. this.CLASS_NAME = "SuperMap.UGCMapLayer";
  54736. }
  54737. /**
  54738. * @function UGCMapLayer.prototype.destroy
  54739. * @override
  54740. */
  54741. destroy() {
  54742. super.destroy();
  54743. Util_Util.reset(this);
  54744. }
  54745. /**
  54746. * @function UGCMapLayer.prototype.fromJson
  54747. * @description 将服务端 JSON 对象转换成当前客户端对象。
  54748. * @param {Object} jsonObject - 要转换的 JSON 对象。
  54749. */
  54750. fromJson(jsonObject) {
  54751. super.fromJson(jsonObject);
  54752. }
  54753. /**
  54754. * @function UGCMapLayer.prototype.toServerJSONObject
  54755. * @description 转换成对应的 JSON 格式对象。
  54756. * @returns {Object} 对应的 JSON 格式对象。
  54757. */
  54758. toServerJSONObject() {
  54759. return super.toServerJSONObject();
  54760. }
  54761. }
  54762. ;// CONCATENATED MODULE: ./src/common/iServer/JoinItem.js
  54763. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54764. * This program are made available under the terms of the Apache License, Version 2.0
  54765. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54766. /**
  54767. * @class JoinItem
  54768. * @deprecatedclass SuperMap.JoinItem
  54769. * @category iServer Data FeatureResults
  54770. * @classdesc 连接信息类。
  54771. * 该类用于矢量数据集与外部表的连接。外部表可以为另一个矢量数据集(其中纯属性数据集中没有空间几何信息)所对应的 DBMS 表,也可以是用户自建的业务表。
  54772. * 需要注意的是,矢量数据集与外部表必须属于同一数据源。表之间的联系的建立有两种方式,一种是连接(join),一种是关联(link)。
  54773. * 连接,实际上是依据相同的字段将一个外部表追加到指定的表;而关联是基于一个相同的字段定义了两个表格之间的联系,但不是实际的追加。
  54774. * 用于连接两个表的字段的名称不一定相同,但类型必须一致。当两个表格之间建立了连接,通过对主表进行操作,可以对外部表进行查询,制作专题图以及分析等。
  54775. * 当两个表格之间是一对一或多对一的关系时,可以使用 join 连接。当为多对一的关系时,允许指定多个字段之间的关联。
  54776. *(注意:JoinItem 目前支持左连接和内连接,不支持全连接和右连接,UDB 引擎不支持内连接。并且用于建立连接的两个表必须在同一个数据源下。)
  54777. * @param {Object} options - 参数。
  54778. * @param {string} options.foreignTableName - 外部表的名称。
  54779. * @param {string} options.joinFilter - 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
  54780. * @param {JoinType} options.joinType - 两个表之间连接类型。
  54781. * @example 下面以 SQL 查询说明 joinItem 的使用方法:
  54782. *(start code)
  54783. * function queryBySQL() {
  54784. * // 设置与外部表的连接信息
  54785. * var joinItem = new JoinItem({
  54786. * foreignTableName: "foreignTable",
  54787. * joinFilter: "foreignTable.CONTINENT = Countries.CONTINENT",
  54788. * joinType: "LEFTJOIN"
  54789. * })
  54790. * var queryParam, queryBySQLParams, queryBySQLService;
  54791. * // 设置查询参数,在查询参数中添加joinItem关联条件信息
  54792. * queryParam = new FilterParameter({
  54793. * name: "Countries@World",
  54794. * joinItems: [joinItem]
  54795. * }),
  54796. * queryBySQLParams = new QueryBySQLParameters({
  54797. * queryParams: [queryParam]
  54798. * }),
  54799. * queryBySQLService = new QueryBySQLService(url, {
  54800. * eventListeners: { "processCompleted": processCompleted, "processFailed": processFailed}
  54801. * });
  54802. * queryBySQLService.processAsync(queryBySQLParams);
  54803. * }
  54804. * function processCompleted(queryEventArgs) {//todo}
  54805. * function processFailed(e) {//todo}
  54806. * (end)
  54807. * @usage
  54808. */
  54809. class JoinItem {
  54810. constructor(options) {
  54811. /**
  54812. * @member {string} JoinItem.prototype.foreignTableName
  54813. * @description 外部表的名称。
  54814. * 如果外部表的名称是以 “表名@数据源名” 命名方式,则该属性只需赋值表名。
  54815. * 例如:外部表 Name@changchun,Name 为表名,changchun 为数据源名称,则该属性的赋值应为:Name。
  54816. */
  54817. this.foreignTableName = null;
  54818. /**
  54819. * @member {string} JoinItem.prototype.joinFilter
  54820. * @description 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
  54821. * 例如,将房屋面数据集(Building)的 district 字段与房屋拥有者的纯属性数据集(Owner)的 region 字段相连接,
  54822. * 两个数据集对应的表名称分别为 Table_Building 和 Table_Owner,
  54823. * 则连接表达式为 Table_Building.district = Table_Owner.region。
  54824. * 当有多个字段相连接时,用 AND 将多个表达式相连。
  54825. */
  54826. this.joinFilter = null;
  54827. /**
  54828. * @member {JoinType} JoinItem.prototype.joinType
  54829. * @description 两个表之间连接类型。
  54830. * 连接类型决定了对两个表进行连接查询后返回的记录的情况。
  54831. */
  54832. this.joinType = null;
  54833. if (options) {
  54834. Util_Util.extend(this, options);
  54835. }
  54836. this.CLASS_NAME = "SuperMap.JoinItem";
  54837. }
  54838. /**
  54839. * @function JoinItem.prototype.destroy
  54840. * @description 释放资源,将引用资源的属性置空。
  54841. */
  54842. destroy() {
  54843. var me = this;
  54844. me.foreignTableName = null;
  54845. me.joinFilter = null;
  54846. me.joinType = null;
  54847. }
  54848. /**
  54849. * @function JoinItem.prototype.toServerJSONObject
  54850. * @description 转换成对应的 JSON 格式对象。
  54851. */
  54852. toServerJSONObject() {
  54853. var dataObj = {};
  54854. dataObj = Util_Util.copyAttributes(dataObj, this);
  54855. //joinFilter基本是个纯属性对象,这里不再做转换
  54856. return dataObj;
  54857. }
  54858. }
  54859. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetInfo.js
  54860. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54861. * This program are made available under the terms of the Apache License, Version 2.0
  54862. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54863. /**
  54864. * @class DatasetInfo
  54865. * @deprecatedclass SuperMap.DatasetInfo
  54866. * @category iServer Data Dataset
  54867. * @classdesc 数据集信息类。
  54868. * 数据集一般为存储在一起的相关数据的集合;根据数据类型的不同,分为矢量数据集、栅格数据集(griddataset)和
  54869. * 影像数据集(image dataset),以及为了处理特定问题而设计的数据集,如拓扑数据集,网络数据集等。
  54870. * 数据集是 GIS 数据组织的最小单位。其中矢量数据集是由同种类型空间要素组成的集合,
  54871. * 所以也可以称为要素集。根据要素的空间特征的不同,矢量数据集又分为点数据集,
  54872. * 线数据集,面数据集等,各矢量数据集是空间特征和性质相同的数据组织起来的集合。
  54873. * 目前版本支持的数据集主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、
  54874. * 网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  54875. * @param {Object} options - 参数。
  54876. * @param {Bounds} [options.bounds] - 数据集范围。
  54877. * @param {string} [options.dataSourceName] - 数据源名称。
  54878. * @param {string} [options.description] - 数据集的描述信息。
  54879. * @param {string} [options.encodeType] - 数据集存储时的压缩编码方式。
  54880. * @param {boolean} [options.isReadOnly] - 数据集是否为只读。
  54881. * @param {string} options.name - 数据集名称。
  54882. * @param {Object} [options.prjCoordSys] - 数据集的投影信息。如:prjCoordSys={"epsgCode":3857}。
  54883. * @param {string} [options.tableName] - 表名。
  54884. * @param {string} options.type - 数据集类型。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  54885. * @usage
  54886. */
  54887. class DatasetInfo {
  54888. constructor(options) {
  54889. options = options || {};
  54890. /**
  54891. * @member {Bounds} [DatasetInfo.prototype.bounds]
  54892. * @description 数据集范围,该字段只读。
  54893. */
  54894. this.bounds = null;
  54895. /**
  54896. * @member {string} [DatasetInfo.prototype.dataSourceName]
  54897. * @description 数据源名称,该字段只读。
  54898. */
  54899. this.dataSourceName = null;
  54900. /**
  54901. * @member {string} [DatasetInfo.prototype.description]
  54902. * @description 数据集的描述信息。
  54903. */
  54904. this.description = null;
  54905. /**
  54906. * @member {string} [DatasetInfo.prototype.encodeType]
  54907. * @description 数据集存储时的压缩编码方式,该字段只读。
  54908. */
  54909. this.encodeType = null;
  54910. /**
  54911. * @member {boolean} [DatasetInfo.prototype.isReadOnly]
  54912. * @description 数据集是否为只读。
  54913. */
  54914. this.isReadOnly = null;
  54915. /**
  54916. * @member {string} DatasetInfo.prototype.name
  54917. * @description 数据集名称,该字段必须且只读。
  54918. */
  54919. this.name = null;
  54920. /**
  54921. * @member {Object} [DatasetInfo.prototype.prjCoordSys]
  54922. * @description 数据集的投影信息。
  54923. */
  54924. this.prjCoordSys = null;
  54925. /**
  54926. * @member {string} [DatasetInfo.prototype.tableName]
  54927. * @description 表名,该字段只读。
  54928. */
  54929. this.tableName = null;
  54930. /**
  54931. * @member {string} DatasetInfo.prototype.type
  54932. * @description 数据集类型,该字段必设。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  54933. */
  54934. this.type = null;
  54935. Util_Util.extend(this, options);
  54936. var b = this.bounds;
  54937. if (b) {
  54938. this.bounds = new Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
  54939. }
  54940. this.CLASS_NAME = "SuperMap.DatasetInfo";
  54941. }
  54942. /**
  54943. * @function DatasetInfo.prototype.destroy
  54944. * @description 释放资源,将引用资源的属性置空。
  54945. */
  54946. destroy() {
  54947. Util_Util.reset(this);
  54948. }
  54949. /**
  54950. * @function DatasetInfo.prototype.toServerJSONObject
  54951. * @description 转换成对应的 JSON 格式对象。
  54952. * @returns {Object} JSON 对象。
  54953. */
  54954. toServerJSONObject() {
  54955. var dataObj = {};
  54956. dataObj = Util_Util.copyAttributes(dataObj, this);
  54957. if (dataObj.bounds) {
  54958. if (dataObj.bounds.toServerJSONObject) {
  54959. dataObj.bounds = dataObj.bounds.toServerJSONObject();
  54960. }
  54961. }
  54962. return dataObj;
  54963. }
  54964. }
  54965. ;// CONCATENATED MODULE: ./src/common/iServer/UGCSubLayer.js
  54966. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54967. * This program are made available under the terms of the Apache License, Version 2.0
  54968. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54969. /**
  54970. * @class UGCSubLayer
  54971. * @deprecatedclass SuperMap.UGCSubLayer
  54972. * @category iServer Map Layer
  54973. * @classdesc 地图服务图层属性信息类。影像图层(Image)、专题图层(ServerTheme)、栅格图层(Grid)、矢量图层(Vector)等图层均继承该类。
  54974. * @extends {UGCMapLayer}
  54975. * @param {Object} options - 参数。
  54976. * @param {DatasetInfo} options.datasetInfo - 数据集信息。
  54977. * @param {string} [options.displayFilter] - 图层显示过滤条件。
  54978. * @param {JoinItem} [options.joinItems] - 连接信息类。
  54979. * @param {string} [options.representationField] - 存储制图表达信息的字段。
  54980. * @param {LayerType} [options.ugcLayerType] - 图层类型。
  54981. * @usage
  54982. */
  54983. class UGCSubLayer extends UGCMapLayer {
  54984. constructor(options) {
  54985. options = options || {};
  54986. super(options);
  54987. /**
  54988. * @member {DatasetInfo} UGCSubLayer.prototype.datasetInfo
  54989. * @description 数据集信息。
  54990. */
  54991. this.datasetInfo = null;
  54992. /**
  54993. * @member {string} UGCSubLayer.prototype.displayFilter
  54994. * @description 图层显示过滤条件。
  54995. */
  54996. this.displayFilter = null;
  54997. /**
  54998. * @member {JoinItem} UGCSubLayer.prototype.joinItems
  54999. * @description 连接信息类。
  55000. */
  55001. this.joinItems = null;
  55002. /**
  55003. * @member {string} UGCSubLayer.prototype.representationField
  55004. * @description 存储制图表达信息的字段。
  55005. */
  55006. this.representationField = null;
  55007. /**
  55008. * @member {LayerType} UGCSubLayer.prototype.ugcLayerType
  55009. * @description 图层类型。
  55010. */
  55011. this.ugcLayerType = null;
  55012. this.CLASS_NAME = "SuperMap.UGCSubLayer";
  55013. }
  55014. /**
  55015. * @function UGCSubLayer.prototype.fromJson
  55016. * @description 将服务端 JSON 对象转换成当前客户端对象。
  55017. * @param {Object} jsonObject - 要转换的 JSON 对象。
  55018. */
  55019. fromJson(jsonObject) {
  55020. super.fromJson(jsonObject);
  55021. if (this.datasetInfo) {
  55022. this.datasetInfo = new DatasetInfo(this.datasetInfo);
  55023. }
  55024. if (this.joinItems && this.joinItems.length) {
  55025. var newJoinItems = [];
  55026. for (var i = 0; i < this.joinItems.length; i++) {
  55027. newJoinItems[i] = new JoinItem(this.joinItems[i]);
  55028. }
  55029. this.joinItems = newJoinItems;
  55030. }
  55031. }
  55032. /**
  55033. * @function UGCSubLayer.prototype.destroy
  55034. * @override
  55035. */
  55036. destroy() {
  55037. super.destroy();
  55038. Util_Util.reset(this);
  55039. }
  55040. /**
  55041. * @function UGCSubLayer.prototype.toServerJSONObject
  55042. * @description 转换成对应的 JSON 格式对象。
  55043. * @returns {Object} 对应的 JSON 格式对象。
  55044. */
  55045. toServerJSONObject() {
  55046. var jsonObject = super.toServerJSONObject();
  55047. if (jsonObject.joinItems) {
  55048. var joinItems = [];
  55049. for (var i = 0; i < jsonObject.joinItems.length; i++) {
  55050. if (jsonObject.joinItems[i].toServerJSONObject) {
  55051. joinItems[i] = jsonObject.joinItems[i].toServerJSONObject();
  55052. }
  55053. }
  55054. jsonObject.joinItems = joinItems;
  55055. }
  55056. if (jsonObject.datasetInfo) {
  55057. if (jsonObject.datasetInfo.toServerJSONObject) {
  55058. jsonObject.datasetInfo = jsonObject.datasetInfo.toServerJSONObject();
  55059. }
  55060. }
  55061. return jsonObject;
  55062. }
  55063. }
  55064. ;// CONCATENATED MODULE: ./src/common/iServer/ServerTheme.js
  55065. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55066. * This program are made available under the terms of the Apache License, Version 2.0
  55067. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55068. /**
  55069. * @class ServerTheme
  55070. * @deprecatedclass SuperMap.ServerTheme
  55071. * @category iServer Map Theme
  55072. * @classdesc SuperMap 专题图图层类。
  55073. * @extends {UGCSubLayer}
  55074. * @param {CommonTheme} theme - 专题图对象。
  55075. * @param {LonLat} themeElementPosition - 专题图元素位置。
  55076. * @usage
  55077. */
  55078. class ServerTheme extends UGCSubLayer {
  55079. constructor(options) {
  55080. options = options || {};
  55081. super(options);
  55082. /**
  55083. * @member {CommonTheme} ServerTheme.prototype.theme
  55084. * @description 专题图对象。
  55085. */
  55086. this.theme = null;
  55087. /**
  55088. * @member {LonLat} ServerTheme.prototype.themeElementPosition
  55089. * @description 专题图元素位置。
  55090. */
  55091. this.themeElementPosition = null;
  55092. this.CLASS_NAME = "SuperMap.ServerTheme";
  55093. }
  55094. /**
  55095. * @function ServerTheme.prototype.destroy
  55096. * @description 释放资源,将引用资源的属性置空。
  55097. * @override
  55098. */
  55099. destroy() {
  55100. super.destroy();
  55101. Util_Util.reset(this);
  55102. }
  55103. /**
  55104. * @function ServerTheme.prototype.fromJson
  55105. * @description 将服务端 JSON 对象转换成当前客户端对象。
  55106. * @param {Object} jsonObject - 要转换的 JSON 对象。
  55107. */
  55108. fromJson(jsonObject) {
  55109. super.fromJson(jsonObject);
  55110. var themeObj = this.theme;
  55111. var themeT = themeObj && themeObj.type;
  55112. switch (themeT) {
  55113. case 'LABEL':
  55114. this.theme = ThemeLabel.fromObj(themeObj);
  55115. break;
  55116. case 'UNIQUE':
  55117. this.theme = ThemeUnique.fromObj(themeObj);
  55118. break;
  55119. case 'GRAPH':
  55120. this.theme = ThemeGraph.fromObj(themeObj);
  55121. break;
  55122. case 'DOTDENSITY':
  55123. this.theme = ThemeDotDensity.fromObj(themeObj);
  55124. break;
  55125. case 'GRADUATEDSYMBOL':
  55126. this.theme = ThemeGraduatedSymbol.fromObj(themeObj);
  55127. break;
  55128. case 'RANGE':
  55129. this.theme = ThemeRange.fromObj(themeObj);
  55130. break;
  55131. default:
  55132. break;
  55133. }
  55134. if (this.themeElementPosition) {
  55135. //待测试
  55136. this.themeElementPosition = new LonLat(this.themeElementPosition.x, this.themeElementPosition.y);
  55137. }
  55138. }
  55139. /**
  55140. * @function ServerTheme.prototype.toServerJSONObject
  55141. * @description 转换成对应的 JSON 格式对象。
  55142. */
  55143. toServerJSONObject() {
  55144. //普通属性直接赋值
  55145. var jsonObject = super.toServerJSONObject();
  55146. if (jsonObject.themeElementPosition) {
  55147. if (jsonObject.themeElementPosition.toServerJSONObject) {
  55148. jsonObject.themeElementPosition = jsonObject.themeElementPosition.toServerJSONObject();
  55149. }
  55150. }
  55151. if (jsonObject.theme) {
  55152. if (jsonObject.theme.toServerJSONObject) {
  55153. jsonObject.theme = jsonObject.theme.toServerJSONObject();
  55154. }
  55155. }
  55156. return jsonObject;
  55157. }
  55158. }
  55159. ;// CONCATENATED MODULE: ./src/common/iServer/ColorDictionary.js
  55160. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55161. * This program are made available under the terms of the Apache License, Version 2.0
  55162. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55163. /**
  55164. * @class ColorDictionary
  55165. * @deprecatedclass SuperMap.ColorDictionary
  55166. * @category iServer Map Theme
  55167. * @classdesc 颜色对照表类。颜色对照表中的键名为具体的高程值,键值表示该高程值要显示的颜色。
  55168. * 对于栅格图层中高程值小于颜色对照表中高程最小值的点使用颜色对照表中高程最小值对应的颜色,
  55169. * 对于栅格图层中高程值大于颜色对照表中高程最大值的点使用颜色对照表中高程最大值对应的颜色,
  55170. * 对于栅格图层中高程值在颜色对照表中没有对应颜色的点,则查找颜色对照表中与当前高程值相邻的两个高程对应的颜色,
  55171. * 然后通过渐变运算要显示的颜色。如果设置了颜色对照表的话,则颜色表设置无效。
  55172. * @param {Object} options - 参数。
  55173. * @param {number} options.elevation - 高程值。
  55174. * @param {ServerColor} options.color - 服务端颜色类。
  55175. * @usage
  55176. */
  55177. class ColorDictionary {
  55178. constructor(options) {
  55179. options = options || {};
  55180. /**
  55181. * @member {number} ColorDictionary.prototype.elevation
  55182. * @description 高程值。
  55183. */
  55184. this.elevation = null;
  55185. /**
  55186. * @member {ServerColor} ColorDictionary.prototype.color
  55187. * @description 服务端颜色类。
  55188. */
  55189. this.color = null;
  55190. Util_Util.extend(this, options);
  55191. var me = this,
  55192. c = me.color;
  55193. if (c) {
  55194. me.color = new ServerColor(c.red, c.green, c.blue);
  55195. }
  55196. this.CLASS_NAME = "SuperMap.ColorDictionary";
  55197. }
  55198. /**
  55199. * @function ColorDictionary.prototype.destroy
  55200. * @description 释放资源,将引用资源的属性置空。
  55201. */
  55202. destroy() {
  55203. Util_Util.reset(this);
  55204. }
  55205. /**
  55206. * @function ColorDictionary.prototype.toServerJSONObject
  55207. * @description 转换成对应的 JSON 格式对象。
  55208. * @returns {Object} JSON 对象。
  55209. */
  55210. toServerJSONObject() {
  55211. var dataObj = {};
  55212. dataObj = Util_Util.copyAttributes(dataObj, this);
  55213. return dataObj;
  55214. }
  55215. }
  55216. ;// CONCATENATED MODULE: ./src/common/iServer/Grid.js
  55217. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55218. * This program are made available under the terms of the Apache License, Version 2.0
  55219. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55220. /**
  55221. * @class Grid
  55222. * @deprecatedclass SuperMap.Grid
  55223. * @category iServer Map Layer
  55224. * @classdesc SuperMap 栅格图层类。
  55225. * @extends {UGCSubLayer}
  55226. * @param {Object} options - 可选参数。
  55227. * @param {Array.<Object>} [options.colorDictionary] - 颜色对照表对象。
  55228. * @param {number} [options.brightness] - Grid 图层的亮度。
  55229. * @param {ColorGradientType} [options.colorGradientType] - 颜色渐变枚举。
  55230. * @param {ServerColor} [options.colors] - 颜色表对象。
  55231. * @param {number} [options.contrast] - Grid 图层的对比度。
  55232. * @param {GridType} [options.gridType] - 格网类型。
  55233. * @param {number} [options.horizontalSpacing] - 格网水平间隔大小。
  55234. * @param {boolean} [options.sizeFixed] - 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
  55235. * @param {ServerStyle} [options.solidStyle] - 格网实线的样式。
  55236. * @param {ServerColor} [options.specialColor] - 栅格数据集无值数据的颜色。
  55237. * @param {number} [options.specialValue] - 图层的特殊值。
  55238. * @param {boolean} [options.specialValueTransparent] - 图层的特殊值(specialValue)所处区域是否透明。
  55239. * @param {number} [options.verticalSpacing] - 格网垂直间隔大小。
  55240. * @usage
  55241. */
  55242. class Grid extends UGCSubLayer {
  55243. constructor(options) {
  55244. options = options || {};
  55245. super(options);
  55246. /**
  55247. * @member {Array.<ColorDictionary>} Grid.prototype.colorDictionarys
  55248. * @description 颜色对照表对象。
  55249. */
  55250. this.colorDictionarys = null;
  55251. /**
  55252. * @member {number} Grid.prototype.brightness
  55253. * @description Grid 图层的亮度。
  55254. */
  55255. this.brightness = null;
  55256. /**
  55257. * @member {ColorGradientType} Grid.prototype.colorGradientType
  55258. * @description 渐变颜色枚举值。
  55259. */
  55260. this.colorGradientType = null;
  55261. /**
  55262. * @member {ServerColor} Grid.prototype.colors
  55263. * @description 颜色表对象。
  55264. */
  55265. this.colors = null;
  55266. /**
  55267. * @member {number} Grid.prototype.contrast
  55268. * @description Grid 图层的对比度。
  55269. */
  55270. this.contrast = null;
  55271. /**
  55272. * @member {ServerStyle} Grid.prototype.dashStyle
  55273. * @description 栅格数据集特殊值数据的颜色。
  55274. */
  55275. this.dashStyle = null;
  55276. /**
  55277. * @member {GridType} Grid.prototype.gridType
  55278. * @description 格网类型。
  55279. */
  55280. this.gridType = null;
  55281. /**
  55282. * @member {number} Grid.prototype.horizontalSpacing
  55283. * @description 格网水平间隔大小。
  55284. */
  55285. this.horizontalSpacing = null;
  55286. /**
  55287. * @member {boolean} Grid.prototype.sizeFixed
  55288. * @description 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
  55289. */
  55290. this.sizeFixed = null;
  55291. /**
  55292. * @member {ServerStyle} Grid.prototype.solidStyle
  55293. * @description 格网实线的样式。
  55294. */
  55295. this.solidStyle = null;
  55296. /**
  55297. * @member {ServerColor} Grid.prototype.specialColor
  55298. * @description 栅格数据集无值数据的颜色。
  55299. */
  55300. this.specialColor = null;
  55301. /**
  55302. * @member {number} Grid.prototype.specialValue
  55303. * @description 图层的特殊值。
  55304. */
  55305. this.specialValue = null;
  55306. /**
  55307. * @member {boolean} Grid.prototype.specialValueTransparent
  55308. * @description 图层的特殊值(specialValue)所处区域是否透明。
  55309. */
  55310. this.specialValueTransparent = null;
  55311. /**
  55312. * @member {number} Grid.prototype.verticalSpacing
  55313. * @description 格网垂直间隔大小。
  55314. */
  55315. this.verticalSpacing = null;
  55316. this.CLASS_NAME = "SuperMap.Grid";
  55317. }
  55318. /**
  55319. * @function Grid.prototype.destroy
  55320. * @description 释放资源,将引用资源的属性置空。
  55321. */
  55322. destroy() {
  55323. super.destroy();
  55324. Util_Util.reset(this);
  55325. }
  55326. /**
  55327. * @function Grid.prototype.fromJson
  55328. * @description 将服务端 JSON 对象转换成当前客户端对象。
  55329. * @param {Object} jsonObject - 要转换的 JSON 对象。
  55330. */
  55331. fromJson(jsonObject) {
  55332. super.fromJson(jsonObject);
  55333. if (this.specialColor) {
  55334. this.specialColor = new ServerColor(this.specialColor.red,
  55335. this.specialColor.green,
  55336. this.specialColor.blue);
  55337. }
  55338. if (this.colors) {
  55339. var colors = [],
  55340. color;
  55341. for (var i in this.colors) {
  55342. color = this.colors[i];
  55343. colors.push(new ServerColor(color.red, color.green, color.blue));
  55344. }
  55345. this.colors = colors;
  55346. }
  55347. if (this.dashStyle) {
  55348. this.dashStyle = new ServerStyle(this.dashStyle);
  55349. }
  55350. if (this.solidStyle) {
  55351. this.solidStyle = new ServerStyle(this.solidStyle);
  55352. }
  55353. if (this.colorDictionary) {
  55354. var colorDics = [],
  55355. colorDic;
  55356. for (var key in this.colorDictionary) {
  55357. colorDic = this.colorDictionary[key];
  55358. colorDics.push(new ColorDictionary({elevation: key, color: colorDic}));
  55359. }
  55360. this.colorDictionarys = colorDics;
  55361. }
  55362. delete this.colorDictionary;
  55363. }
  55364. /**
  55365. * @function Grid.prototype.toServerJSONObject
  55366. * @description 转换成对应的 JSON 对象。
  55367. * @returns JSON 对象。
  55368. */
  55369. toServerJSONObject() {
  55370. var jsonObject = super.toServerJSONObject();
  55371. if (jsonObject.dashStyle) {
  55372. if (jsonObject.dashStyle.toServerJSONObject) {
  55373. jsonObject.dashStyle = jsonObject.dashStyle.toServerJSONObject();
  55374. }
  55375. }
  55376. if (jsonObject.solidStyle) {
  55377. if (jsonObject.solidStyle.toServerJSONObject) {
  55378. jsonObject.solidStyle = jsonObject.solidStyle.toServerJSONObject();
  55379. }
  55380. }
  55381. return jsonObject;
  55382. }
  55383. }
  55384. ;// CONCATENATED MODULE: ./src/common/iServer/Image.js
  55385. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55386. * This program are made available under the terms of the Apache License, Version 2.0
  55387. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55388. /**
  55389. * @class UGCImage
  55390. * @deprecatedclass SuperMap.Image
  55391. * @category iServer Map Layer
  55392. * @classdesc SuperMap 影像图层类
  55393. * @extends {UGCSubLayer}
  55394. * @param {Object} options - 可选参数。
  55395. * @param {ColorSpaceType} [options.colorSpaceType] - 返回影像图层的色彩显示模式。
  55396. * @param {number} [options.brightness] - 影像图层的亮度。
  55397. * @param {Array.<number>} [options.displayBandIndexes] - 返回当前影像图层显示的波段索引。
  55398. * @param {number} [options.contrast] - 影像图层的对比度。
  55399. * @param {boolean} [options.transparent] - 是否背景透明。
  55400. * @param {ServerColor} [options.transparentColor] - 返回背景透明色。
  55401. * @param {number} [options.transparentColorTolerance] - 背景透明色容限。
  55402. * @usage
  55403. * @private
  55404. */
  55405. class UGCImage extends UGCSubLayer {
  55406. constructor(options) {
  55407. options = options || {};
  55408. super(options);
  55409. /**
  55410. * @member {number} UGCImage.prototype.brightness
  55411. * @description 影像图层的亮度。
  55412. */
  55413. this.brightness = null;
  55414. /**
  55415. * @member {ColorSpaceType} UGCImage.prototype.colorSpaceType
  55416. * @description 返回影像图层的色彩显示模式。
  55417. */
  55418. this.colorSpaceType = null;
  55419. /**
  55420. * @member {number} UGCImage.prototype.contrast
  55421. * @description 影像图层的对比度。
  55422. */
  55423. this.contrast = null;
  55424. /**
  55425. * @member {Array.<number>} UGCImage.prototype.displayBandIndexes
  55426. * @description 返回当前影像图层显示的波段索引。
  55427. */
  55428. this.displayBandIndexes = null;
  55429. /**
  55430. * @member {boolean} UGCImage.prototype.transparent
  55431. * @description 是否背景透明。
  55432. */
  55433. this.transparent = null;
  55434. /**
  55435. * @member {ServerColor} UGCImage.prototype.transparentColor
  55436. * @description 返回背景透明色。
  55437. */
  55438. this.transparentColor = null;
  55439. /**
  55440. * @member {number} UGCImage.prototype.transparentColorTolerance
  55441. * @description 背景透明色容限。
  55442. */
  55443. this.transparentColorTolerance = null;
  55444. this.CLASS_NAME = "SuperMap.Image";
  55445. }
  55446. /**
  55447. * @function UGCImage.prototype.destroy
  55448. * @override
  55449. */
  55450. destroy() {
  55451. super.destroy();
  55452. Util_Util.reset(this);
  55453. }
  55454. /**
  55455. * @function UGCImage.prototype.fromJson
  55456. * @description 将服务端 JSON 对象转换成当前客户端对象。
  55457. * @param {Object} jsonObject - 要转换的 JSON 对象。
  55458. */
  55459. fromJson(jsonObject) {
  55460. super.fromJson(jsonObject);
  55461. if (this.transparentColor) {
  55462. this.transparentColor = new ServerColor(this.transparentColor.red,
  55463. this.transparentColor.green,
  55464. this.transparentColor.blue);
  55465. }
  55466. }
  55467. /**
  55468. * @function UGCImage.prototype.toServerJSONObject
  55469. * @description 转换成对应的 JSON 格式对象。
  55470. */
  55471. toServerJSONObject() {
  55472. return super.toServerJSONObject();
  55473. }
  55474. }
  55475. ;// CONCATENATED MODULE: ./src/common/iServer/Vector.js
  55476. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55477. * This program are made available under the terms of the Apache License, Version 2.0
  55478. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55479. /**
  55480. * @class Vector
  55481. * @deprecatedclass SuperMap.Vector
  55482. * @category iServer Map Layer
  55483. * @classdesc SuperMap 矢量图层类。
  55484. * @extends {UGCSubLayer}
  55485. * @param {Object} options - 可选参数。
  55486. * @param {ServerStyle} [options.style] - 矢量图层的风格。
  55487. * @usage
  55488. */
  55489. class iServer_Vector_Vector extends UGCSubLayer {
  55490. constructor(options) {
  55491. options = options || {};
  55492. super(options);
  55493. /**
  55494. * @member {ServerStyle} Vector.prototype.style
  55495. * @description 矢量图层的风格。
  55496. */
  55497. this.style = null;
  55498. this.CLASS_NAME = "SuperMap.Vector";
  55499. }
  55500. /**
  55501. * @function Vector.prototype.destroy
  55502. * @description 销毁对象,将其属性置空。
  55503. * @override
  55504. */
  55505. destroy() {
  55506. super.destroy();
  55507. Util_Util.reset(this);
  55508. }
  55509. /**
  55510. * @function Vector.prototype.fromJson
  55511. * @description 将服务端 JSON 对象转换成当前客户端对象。
  55512. * @param {Object} jsonObject - 要转换的 JSON 对象。
  55513. */
  55514. fromJson(jsonObject) {
  55515. super.fromJson(jsonObject);
  55516. var sty = this.style;
  55517. if (sty) {
  55518. this.style = new ServerStyle(sty);
  55519. }
  55520. }
  55521. /**
  55522. * @function Vector.prototype.toServerJSONObject
  55523. * @description 转换成对应的 JSON 格式对象。
  55524. * @returns {Object} 对应的 JSON 格式对象
  55525. */
  55526. toServerJSONObject() {
  55527. var jsonObject = super.toServerJSONObject();
  55528. if (jsonObject.style) {
  55529. if (jsonObject.style.toServerJSONObject) {
  55530. jsonObject.style = jsonObject.style.toServerJSONObject();
  55531. }
  55532. }
  55533. return jsonObject;
  55534. }
  55535. }
  55536. ;// CONCATENATED MODULE: ./src/common/iServer/GetLayersInfoService.js
  55537. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55538. * This program are made available under the terms of the Apache License, Version 2.0
  55539. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55540. /**
  55541. * @class GetLayersInfoService
  55542. * @deprecatedclass SuperMap.GetLayersInfoService
  55543. * @category iServer Map Layer
  55544. * @classdesc 获取图层信息服务类构造函数。
  55545. * @extends {CommonServiceBase}
  55546. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  55547. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  55548. * 如 http://localhost:8090/iserver/services/map-world/rest/maps/World 。
  55549. * 如果查询临时图层的信息,请指定完成的url,包含临时图层ID信息,如:
  55550. * http://localhost:8090/iserver/services/map-world/rest/maps/World/tempLayersSet/resourceID
  55551. * @param {Object} options - 参数。
  55552. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  55553. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  55554. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  55555. * @param {Object} [options.headers] - 请求头。
  55556. * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
  55557. * @usage
  55558. */
  55559. class GetLayersInfoService extends CommonServiceBase {
  55560. constructor(url, options) {
  55561. super(url, options);
  55562. /**
  55563. * @member {boolean} GetLayersInfoService.prototype.isTempLayers
  55564. * @description 当前url对应的图层是否是临时图层。
  55565. */
  55566. this.isTempLayers = false;
  55567. if (options) {
  55568. Util_Util.extend(this, options);
  55569. }
  55570. this.CLASS_NAME = "SuperMap.GetLayersInfoService";
  55571. }
  55572. /**
  55573. * @function GetLayersInfoService.prototype.destroy
  55574. * @override
  55575. */
  55576. destroy() {
  55577. super.destroy();
  55578. Util_Util.reset(this);
  55579. }
  55580. /**
  55581. * @function GetLayersInfoService.prototype.processAsync
  55582. * @description 负责将客户端的更新参数传递到服务端。
  55583. */
  55584. processAsync() {
  55585. var me = this,
  55586. method = "GET";
  55587. if (!me.isTempLayers) {
  55588. me.url = Util_Util.urlPathAppend(me.url, 'layers');
  55589. }
  55590. me.request({
  55591. method: method,
  55592. params: null,
  55593. scope: me,
  55594. success: me.serviceProcessCompleted,
  55595. failure: me.serviceProcessFailed
  55596. });
  55597. }
  55598. /**
  55599. * @function GetLayersInfoService.prototype.serviceProcessCompleted
  55600. * @description 编辑完成,执行此方法。
  55601. * @param {Object} result - 服务器返回的结果对象。
  55602. */
  55603. serviceProcessCompleted(result, options) {
  55604. var me = this, existRes, layers, len;
  55605. result = Util_Util.transformResult(result);
  55606. existRes = !!result && result.length > 0;
  55607. layers = existRes ? result[0].subLayers.layers : null;
  55608. len = layers ? layers.length : 0;
  55609. me.handleLayers(len, layers);
  55610. me.events.triggerEvent("processCompleted", {result: result[0], options});
  55611. }
  55612. /**
  55613. * TODO 专题图时候可能会用到
  55614. * @function GetLayersInfoService.prototype.handleLayers
  55615. * @description 处理 iServer 新增图层组数据 (subLayers.layers 中可能还会含有 subLayers.layers)
  55616. * @param {number} len - subLayers.layers的长度
  55617. * @param {Array.<number>} layers - subLayers.layers的长度数组
  55618. */
  55619. handleLayers(len, layers) {
  55620. var me = this, tempLayer;
  55621. if (len) {
  55622. for (var i = 0; i < len; i++) {
  55623. if (layers[i].subLayers && layers[i].subLayers.layers && layers[i].subLayers.layers.length > 0) {
  55624. me.handleLayers(layers[i].subLayers.layers.length, layers[i].subLayers.layers);
  55625. } else {
  55626. var type = layers[i].ugcLayerType;
  55627. switch (type) {
  55628. case 'THEME':
  55629. tempLayer = new ServerTheme();
  55630. tempLayer.fromJson(layers[i]);
  55631. layers[i] = tempLayer;
  55632. break;
  55633. case 'GRID':
  55634. tempLayer = new Grid();
  55635. tempLayer.fromJson(layers[i]);
  55636. layers[i] = tempLayer;
  55637. break;
  55638. case 'IMAGE':
  55639. tempLayer = new UGCImage();
  55640. tempLayer.fromJson(layers[i]);
  55641. layers[i] = tempLayer;
  55642. break;
  55643. case 'VECTOR':
  55644. tempLayer = new iServer_Vector_Vector();
  55645. tempLayer.fromJson(layers[i]);
  55646. layers[i] = tempLayer;
  55647. break;
  55648. default:
  55649. break;
  55650. }
  55651. }
  55652. }
  55653. }
  55654. }
  55655. }
  55656. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoService.js
  55657. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55658. * This program are made available under the terms of the Apache License, Version 2.0
  55659. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55660. /**
  55661. * @class SetLayerInfoService
  55662. * @deprecatedclass SuperMap.SetLayerInfoService
  55663. * @category iServer Map TempLayersSet
  55664. * @classdesc 设置图层信息服务类。可以实现临时图层中子图层的修改
  55665. * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
  55666. * @extends {CommonServiceBase}
  55667. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  55668. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World";
  55669. * @param {Object} options - 参数。
  55670. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  55671. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  55672. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  55673. * @param {Object} [options.headers] - 请求头。
  55674. * @usage
  55675. */
  55676. class SetLayerInfoService extends CommonServiceBase {
  55677. constructor(url, options) {
  55678. super(url, options);
  55679. if (options) {
  55680. Util_Util.extend(this, options);
  55681. }
  55682. this.CLASS_NAME = "SuperMap.SetLayerInfoService";
  55683. }
  55684. /**
  55685. * @override
  55686. */
  55687. destroy() {
  55688. super.destroy();
  55689. Util_Util.reset(this);
  55690. }
  55691. /**
  55692. * @function SetLayerInfoService.prototype.processAsync
  55693. * @description 负责将客户端的更新参数传递到服务端。
  55694. * @param {Object} params - 修改后的图层资源信息。
  55695. * 该参数可以使用获取图层信息服务<{@link GetLayersInfoService}>返回图层信息,解析结果result.subLayers.layers[i],然后对其属性进行修改来获取。
  55696. */
  55697. processAsync(params) {
  55698. if (!params) {
  55699. return;
  55700. }
  55701. var me = this;
  55702. var jsonParamsStr = Util_Util.toJSON(params);
  55703. me.request({
  55704. method: "PUT",
  55705. data: jsonParamsStr,
  55706. scope: me,
  55707. success: me.serviceProcessCompleted,
  55708. failure: me.serviceProcessFailed
  55709. });
  55710. }
  55711. }
  55712. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoService.js
  55713. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55714. * This program are made available under the terms of the Apache License, Version 2.0
  55715. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55716. /**
  55717. * @class SetLayersInfoService
  55718. * @deprecatedclass SuperMap.SetLayersInfoService
  55719. * @category iServer Map TempLayersSet
  55720. * @classdesc 设置图层信息服务类。可以实现创建新的临时图层和对现有临时图层的修改,
  55721. * 当 isTempLayers 为 false的时候执行创建临时图层。当 isTempLayers 为 ture 并且临时图层资源 resourceID 被设置有效时执行对临时图层的编辑。
  55722. * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
  55723. * @extends {CommonServiceBase}
  55724. * @param url - {string} 服务地址。请求地图服务,URL 应为:
  55725. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  55726. * @param {Object} options - 参数。
  55727. * @param {string} options.resourceID - 图层资源ID,临时图层的资源ID标记。
  55728. * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
  55729. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  55730. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  55731. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  55732. * @param {Object} [options.headers] - 请求头。
  55733. * @usage
  55734. */
  55735. class SetLayersInfoService extends CommonServiceBase {
  55736. constructor(url, options) {
  55737. super(url, options);
  55738. /**
  55739. * @member {string} SetLayersInfoService.prototype.resourceID
  55740. * @description 图层资源ID,临时图层的资源ID标记。
  55741. */
  55742. this.resourceID = null;
  55743. /**
  55744. * @function {boolean} SetLayersInfoService.prototype.isTempLayers
  55745. * @description 当前url对应的图层是否是临时图层。
  55746. */
  55747. this.isTempLayers = false;
  55748. if (options) {
  55749. Util_Util.extend(this, options);
  55750. }
  55751. this.CLASS_NAME = "SuperMap.SetLayersInfoService";
  55752. }
  55753. /**
  55754. * @override
  55755. */
  55756. destroy() {
  55757. super.destroy();
  55758. Util_Util.reset(this);
  55759. }
  55760. /**
  55761. * @function SetLayersInfoService.prototype.processAsync
  55762. * @description 负责将客户端的更新参数传递到服务端。
  55763. * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务 <{@link GetLayersInfoService}>返回图层信息,然后对其属性进行修改来获取。
  55764. */
  55765. processAsync(params) {
  55766. if (!params) {
  55767. return;
  55768. }
  55769. var jsonParams,
  55770. subLayers = [],
  55771. me = this,
  55772. method = "";
  55773. //创建临时图层和设置修改临时图层信息对应不同的资源URL
  55774. if (me.isTempLayers) {
  55775. me.url = Util_Util.urlPathAppend(me.url, "tempLayersSet/" + me.resourceID);
  55776. method = "PUT";
  55777. } else {
  55778. me.url = Util_Util.urlPathAppend(me.url, "tempLayersSet");
  55779. method = "POST";
  55780. }
  55781. if (!params.subLayers) {
  55782. params.subLayers = {layers: []}
  55783. }
  55784. if (!params.subLayers.layers) {
  55785. params.subLayers.layers = [];
  55786. }
  55787. var layers = params.subLayers.layers,
  55788. len = layers.length;
  55789. for (let i in layers) {
  55790. if (layers[i].ugcLayerType === "GRID") {
  55791. var colorDictionary = {};
  55792. var colorDics = layers[i].colorDictionarys;
  55793. for (var j in colorDics) {
  55794. var key = colorDics[j].elevation;
  55795. colorDictionary[key] = colorDics[j].color;
  55796. }
  55797. }
  55798. layers[i].colorDictionary = colorDictionary;
  55799. delete layers[i].colorDictionarys;
  55800. }
  55801. for (let i = 0; i < len; i++) {
  55802. if (layers[i].toJsonObject) {
  55803. //将图层信息转换成服务端能识别的简单json对象
  55804. subLayers.push(layers[i].toJsonObject());
  55805. } else {
  55806. subLayers.push(layers[i]);
  55807. }
  55808. }
  55809. jsonParams = Util_Util.extend(jsonParams, params);
  55810. jsonParams.subLayers = {"layers": subLayers};
  55811. jsonParams.object = null;
  55812. var jsonParamsStr = Util_Util.toJSON([jsonParams]);
  55813. me.request({
  55814. method: method,
  55815. data: jsonParamsStr,
  55816. scope: me,
  55817. success: me.serviceProcessCompleted,
  55818. failure: me.serviceProcessFailed
  55819. });
  55820. }
  55821. }
  55822. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusParameters.js
  55823. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55824. * This program are made available under the terms of the Apache License, Version 2.0
  55825. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55826. /**
  55827. * @class SetLayerStatusParameters
  55828. * @deprecatedclass SuperMap.SetLayerStatusParameters
  55829. * @category iServer Map TempLayersSet
  55830. * @classdesc 子图层显示控制参数类,该类存储了各子图层是否可见的状态。
  55831. * 注意在 SuperMap iClient 系列产品中所说的图层与 SuperMap Deskpro 的地图对应,子图层与 SuperMap Deskpro 的图层对应。
  55832. * @param {Object} options - 参数。
  55833. * @param {Array.<LayerStatus>} options.layerStatusList - 获取或设置图层可见状态({@link LayerStatus})集合,
  55834. * 集合中的每个 {@link LayerStatus} 对象代表一个子图层的可视状态。
  55835. * @param {number} [options.holdTime=15] - 获取或设置资源在服务端保存的时间。
  55836. * @param {string} [options.resourceID] - 获取或设置资源服务 ID。
  55837. * @usage
  55838. */
  55839. class SetLayerStatusParameters {
  55840. constructor(options) {
  55841. /**
  55842. * @member {Array.<LayerStatus>} SetLayerStatusParameters.prototype.layerStatusList
  55843. * @description 获取或设置图层可见状态({@link LayerStatus})集合,集合中的每个 {@link LayerStatus} 对象代表一个子图层的可视状态。
  55844. */
  55845. this.layerStatusList = [];
  55846. /**
  55847. * @member {number} [SetLayerStatusParameters.prototype.holdTime=15]
  55848. * @description 获取或设置资源在服务端保存的时间。单位为分钟。
  55849. */
  55850. this.holdTime = 15;
  55851. /**
  55852. * @member {string} SetLayerStatusParameters.prototype.resourceID
  55853. * @description 获取或设置资源服务ID。如果设置该参数则会在指定的 TempLayer 中进行图层的显示控制;
  55854. * 如果不设置该参数,则会首先创建一个 TempLayer ,然后在新创建的 TempLayer 中进行图层的显示控制。
  55855. */
  55856. this.resourceID = null;
  55857. if (options) {
  55858. Util_Util.extend(this, options);
  55859. }
  55860. }
  55861. /**
  55862. * @function SetLayerStatusParameters.prototype.destroy
  55863. * @description 释放资源,将引用资源的属性置空。
  55864. */
  55865. destroy() {
  55866. var me = this;
  55867. me.layerStatusList = null;
  55868. me.holdTime = null;
  55869. me.resourceID = null;
  55870. }
  55871. /**
  55872. * @function SetLayerStatusParameters.prototype.toJSON
  55873. * @description 生成 JSON。
  55874. * @returns {Object} 对应的 JSON 对象。
  55875. */
  55876. toJSON() {
  55877. var json = '{';
  55878. json += '"layers":[';
  55879. var v = [];
  55880. for (var i = 0, len = this.layerStatusList.length; i < len; i++) {
  55881. v.push(this.layerStatusList[i].toJSON());
  55882. }
  55883. json += v;
  55884. json += ']';
  55885. json += '}';
  55886. return json;
  55887. }
  55888. }
  55889. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusService.js
  55890. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55891. * This program are made available under the terms of the Apache License, Version 2.0
  55892. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55893. /**
  55894. * @class SetLayerStatusService
  55895. * @deprecatedclass SuperMap.SetLayerStatusService
  55896. * @category iServer Map TempLayersSet
  55897. * @classdesc 子图层显示控制服务类。该类负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  55898. * 用户获取服务端返回的各子图层显示状态有两种方式:
  55899. * 一种是通过监听 SetLayerEvent.PROCESS_COMPLETE 事件;
  55900. * 一种是使用 AsyncResponder 类实现异步处理。
  55901. * @extends {CommonServiceBase}
  55902. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  55903. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  55904. * @param {Object} options - 参数。
  55905. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  55906. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  55907. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  55908. * @param {Object} [options.headers] - 请求头。
  55909. * @usage
  55910. */
  55911. class SetLayerStatusService extends CommonServiceBase {
  55912. constructor(url, options) {
  55913. super(url, options);
  55914. this.lastparams = null;
  55915. this.mapUrl = url;
  55916. if (options) {
  55917. Util_Util.extend(this, options);
  55918. }
  55919. this.CLASS_NAME = "SuperMap.SetLayerStatusService";
  55920. }
  55921. /**
  55922. * @override
  55923. */
  55924. destroy() {
  55925. super.destroy();
  55926. Util_Util.reset(this);
  55927. }
  55928. /**
  55929. * @function SetLayerStatusService.prototype.processAsync
  55930. * @description 负责将客户端的更新参数传递到服务端。
  55931. * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务{@link SetLayerStatusParameters}
  55932. * 返回图层信息,然后对其属性进行修改来获取。
  55933. */
  55934. processAsync(params) {
  55935. if (!(params instanceof SetLayerStatusParameters)) {
  55936. return;
  55937. }
  55938. var me = this,
  55939. method = "POST";
  55940. me.url = me.mapUrl;
  55941. if (params.resourceID == null) {
  55942. me.url = Util_Util.urlPathAppend(me.url, 'tempLayersSet');
  55943. me.lastparams = params;
  55944. me.request({
  55945. method: method,
  55946. scope: me,
  55947. success: me.createTempLayerComplete,
  55948. failure: me.serviceProcessFailed
  55949. });
  55950. } else {
  55951. me.url = Util_Util.urlPathAppend(me.url, "tempLayersSet/" + params.resourceID);
  55952. me.url = Util_Util.urlAppend(me.url, "elementRemain=true&reference=" + params.resourceID + "&holdTime=" + params.holdTime.toString());
  55953. var jsonParameters = '[{';
  55954. jsonParameters += '"type":"UGC",';
  55955. if (params.layerStatusList != null && params.layerStatusList.length > 0) {
  55956. jsonParameters += '"subLayers":' + params.toJSON();
  55957. }
  55958. jsonParameters += ',"visible":' + true + ',';
  55959. jsonParameters += '"name":"' + this.getMapName(this.mapUrl) + '"';
  55960. jsonParameters += '}]';
  55961. me.request({
  55962. method: "PUT",
  55963. data: jsonParameters,
  55964. scope: me,
  55965. success: me.serviceProcessCompleted,
  55966. failure: me.serviceProcessFailed
  55967. });
  55968. }
  55969. }
  55970. /**
  55971. * @function SetLayerStatusService.prototype.createTempLayerComplete
  55972. * @description 设置完成,执行此方法。
  55973. * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
  55974. */
  55975. createTempLayerComplete(result) {
  55976. var me = this;
  55977. result = Util_Util.transformResult(result);
  55978. if (result.succeed) {
  55979. me.lastparams.resourceID = result.newResourceID;
  55980. }
  55981. me.processAsync(me.lastparams);
  55982. }
  55983. /**
  55984. * @function SetLayerStatusService.prototype.getMapName
  55985. * @description 获取地图名称。
  55986. * @param {Object} url - 服务地址。
  55987. */
  55988. getMapName(url) {
  55989. var mapUrl = url;
  55990. if (mapUrl.charAt(mapUrl.length - 1) === "/") {
  55991. mapUrl = mapUrl.substr(0, mapUrl.length - 1);
  55992. }
  55993. var index = mapUrl.lastIndexOf("/");
  55994. var mapName = mapUrl.substring(index + 1, mapUrl.length);
  55995. return mapName;
  55996. }
  55997. /**
  55998. * @function SetLayerStatusService.prototype.setLayerCompleted
  55999. * @description 设置完成,执行此方法。
  56000. * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
  56001. */
  56002. serviceProcessCompleted(result, options) {
  56003. var me = this;
  56004. result = Util_Util.transformResult(result);
  56005. if (result != null && me.lastparams != null) {
  56006. result.newResourceID = me.lastparams.resourceID;
  56007. }
  56008. me.events.triggerEvent("processCompleted", {result: result, options});
  56009. }
  56010. }
  56011. ;// CONCATENATED MODULE: ./src/common/iServer/LayerInfoService.js
  56012. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56013. * This program are made available under the terms of the Apache License, Version 2.0
  56014. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56015. /**
  56016. * @class LayerInfoService
  56017. * @category iServer Map Layer
  56018. * @classdesc 图层信息服务类。
  56019. * @extends {ServiceBase}
  56020. * @example
  56021. * new LayerInfoService(url).getLayersInfo(function(result){
  56022. * //doSomething
  56023. * })
  56024. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  56025. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World"。
  56026. * @param {Object} options - 参数。
  56027. * @param {string} [options.proxy] - 服务代理地址。
  56028. * @param {boolean} [options.withCredentials=false] - 请求是否携带cookie。
  56029. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  56030. * @param {Object} [options.headers] - 请求头。
  56031. * @usage
  56032. */
  56033. class LayerInfoService_LayerInfoService {
  56034. constructor(url, options) {
  56035. this.url = url;
  56036. this.options = options || {};
  56037. }
  56038. /**
  56039. * @function LayerInfoService.prototype.getLayersInfo
  56040. * @description 获取图层信息服务。
  56041. * @param {RequestCallback} callback - 回调函数。
  56042. */
  56043. getLayersInfo(callback) {
  56044. var me = this;
  56045. var getLayersInfoService = new GetLayersInfoService(me.url, {
  56046. proxy: me.options.proxy,
  56047. withCredentials: me.options.withCredentials,
  56048. crossOrigin: me.options.crossOrigin,
  56049. headers: me.options.headers,
  56050. eventListeners: {
  56051. processCompleted: callback,
  56052. processFailed: callback
  56053. }
  56054. });
  56055. getLayersInfoService.processAsync();
  56056. }
  56057. /**
  56058. * @function LayerInfoService.prototype.setLayerInfo
  56059. * @description 设置图层信息服务。可以实现临时图层中子图层的修改。
  56060. * @param {SetLayerInfoParameters} params - 设置图层信息参数类。
  56061. * @param {RequestCallback} callback - 回调函数。
  56062. */
  56063. setLayerInfo(params, callback) {
  56064. if (!params) {
  56065. return;
  56066. }
  56067. var me = this,
  56068. resourceID = params.resourceID,
  56069. tempLayerName = params.tempLayerName,
  56070. layerInfoParams = params.layerInfo;
  56071. if (!resourceID || !tempLayerName) {
  56072. return;
  56073. }
  56074. var url = Util_Util.urlPathAppend(me.url, "tempLayersSet/" + resourceID + "/" + tempLayerName);
  56075. var setLayerInfoService = new SetLayerInfoService(url, {
  56076. proxy: me.options.proxy,
  56077. withCredentials: me.options.withCredentials,
  56078. crossOrigin: me.options.crossOrigin,
  56079. headers: me.options.headers,
  56080. eventListeners: {
  56081. processCompleted: callback,
  56082. processFailed: callback
  56083. }
  56084. });
  56085. setLayerInfoService.processAsync(layerInfoParams);
  56086. }
  56087. /**
  56088. * @function LayerInfoService.prototype.setLayersInfo
  56089. * @description 设置图层信息服务。可以创建新的临时图层和修改现有的临时图层。
  56090. * @param {SetLayersInfoParameters} params - 设置图层信息参数类。
  56091. * @param {RequestCallback} callback - 回调函数。
  56092. */
  56093. setLayersInfo(params, callback) {
  56094. if (!params) {
  56095. return;
  56096. }
  56097. var me = this,
  56098. resourceID = params.resourceID,
  56099. isTempLayers = params.isTempLayers ? params.isTempLayers : false,
  56100. layersInfo = params.layersInfo;
  56101. if ((isTempLayers && !resourceID) || !layersInfo) {
  56102. return;
  56103. }
  56104. var setLayersInfoService = new SetLayersInfoService(me.url, {
  56105. proxy: me.options.proxy,
  56106. withCredentials: me.options.withCredentials,
  56107. crossOrigin: me.options.crossOrigin,
  56108. headers: me.options.headers,
  56109. eventListeners: {
  56110. processCompleted: callback,
  56111. processFailed: callback
  56112. },
  56113. resourceID: resourceID,
  56114. isTempLayers: isTempLayers
  56115. });
  56116. setLayersInfoService.processAsync(layersInfo);
  56117. }
  56118. /**
  56119. * @function LayerInfoService.prototype.setLayerStatus
  56120. * @description 子图层显示控制服务。负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  56121. * @param {SetLayerStatusParameters} params - 子图层显示控制参数类。
  56122. * @param {RequestCallback} callback - 回调函数。
  56123. */
  56124. setLayerStatus(params, callback) {
  56125. if (!params) {
  56126. return;
  56127. }
  56128. var me = this;
  56129. var setLayerStatusService = new SetLayerStatusService(me.url, {
  56130. proxy: me.options.proxy,
  56131. withCredentials: me.options.withCredentials,
  56132. crossOrigin: me.options.crossOrigin,
  56133. headers: me.options.headers,
  56134. eventListeners: {
  56135. processCompleted: callback,
  56136. processFailed: callback
  56137. }
  56138. });
  56139. setLayerStatusService.processAsync(params);
  56140. }
  56141. }
  56142. ;// CONCATENATED MODULE: ./src/mapboxgl/services/LayerInfoService.js
  56143. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56144. * This program are made available under the terms of the Apache License, Version 2.0
  56145. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56146. /**
  56147. * @class LayerInfoService
  56148. * @category iServer Map Layer
  56149. * @classdesc 图层信息服务类。
  56150. * @modulecategory Services
  56151. * @extends {ServiceBase}
  56152. * @example
  56153. * new LayerInfoService(url).getLayersInfo(function(result){
  56154. * //doSomething
  56155. * })
  56156. * @param {string} url - 服务地址。请求地图服务,URL 应为:</br>
  56157. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World"。
  56158. * @param {Object} options - 参数。
  56159. * @param {string} [options.proxy] - 服务代理地址。
  56160. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  56161. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  56162. * @param {Object} [options.headers] - 请求头。
  56163. * @usage
  56164. */
  56165. class LayerInfoService extends ServiceBase {
  56166. constructor(url, options) {
  56167. super(url, options);
  56168. this._layerInfoService = new LayerInfoService_LayerInfoService(url, options);
  56169. }
  56170. /**
  56171. * @function LayerInfoService.prototype.getLayersInfo
  56172. * @description 获取图层信息服务。
  56173. * @param {RequestCallback} callback - 回调函数。
  56174. * @returns {LayerInfoService} 返回图层信息类。
  56175. */
  56176. getLayersInfo(callback) {
  56177. this._layerInfoService.getLayersInfo(callback);
  56178. }
  56179. /**
  56180. * @function LayerInfoService.prototype.setLayerInfo
  56181. * @description 设置图层信息服务。可以实现临时图层中子图层的修改。
  56182. * @param {SetLayerInfoParameters} params - 设置图层信息参数类。
  56183. * @param {RequestCallback} callback - 回调函数。
  56184. */
  56185. setLayerInfo(params, callback) {
  56186. this._layerInfoService.setLayerInfo(params, callback);
  56187. }
  56188. /**
  56189. * @function LayerInfoService.prototype.setLayersInfo
  56190. * @description 设置图层信息服务。可以实现创建新的临时图层和对现有临时图层的修改。
  56191. * @param {SetLayersInfoParameters} params - 设置图层信息参数类,包括临时图层。
  56192. * @param {RequestCallback} callback - 回调函数。
  56193. */
  56194. setLayersInfo(params, callback) {
  56195. this._layerInfoService.setLayersInfo(params, callback);
  56196. }
  56197. /**
  56198. * @function LayerInfoService.prototype.setLayerStatus
  56199. * @description 子图层显示控制服务。负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  56200. * @param {SetLayerStatusParameters} params - 子图层显示控制参数类。
  56201. * @param {RequestCallback} callback 回调函数。
  56202. */
  56203. setLayerStatus(params, callback) {
  56204. this._layerInfoService.setLayerStatus(params, callback);
  56205. }
  56206. }
  56207. ;// CONCATENATED MODULE: ./src/common/iServer/MapService.js
  56208. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56209. * This program are made available under the terms of the Apache License, Version 2.0
  56210. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56211. /**
  56212. * @class MapService
  56213. * @deprecatedclass SuperMap.MapService
  56214. * @category iServer Map
  56215. * @classdesc 地图信息服务类。
  56216. * @extends {CommonServiceBase}
  56217. * @example
  56218. * var myMapService = new MapService(url, {
  56219. * eventListeners:{
  56220. * "processCompleted": MapServiceCompleted,
  56221. * "processFailed": MapServiceFailed
  56222. * }
  56223. * });
  56224. *
  56225. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  56226. * @param {Object} options - 参数。
  56227. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  56228. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  56229. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  56230. * @param {Object} [options.headers] - 请求头。
  56231. * @usage
  56232. */
  56233. class MapService_MapService extends CommonServiceBase {
  56234. constructor(url, options) {
  56235. super(url, options);
  56236. /**
  56237. * @member {string} MapService.prototype.projection
  56238. * @description 根据投影参数获取地图状态信息。如"EPSG:4326"
  56239. */
  56240. this.projection = null;
  56241. this.CLASS_NAME = "SuperMap.MapService";
  56242. if (options) {
  56243. Util_Util.extend(this, options);
  56244. }
  56245. var me = this;
  56246. if (me.projection) {
  56247. var arr = me.projection.split(":");
  56248. if (arr instanceof Array) {
  56249. if (arr.length === 2) {
  56250. me.url = Util_Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[1]}"}`)}`)
  56251. }
  56252. if (arr.length === 1) {
  56253. me.url = Util_Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[0]}"}`)}`)
  56254. }
  56255. }
  56256. }
  56257. this.eventCount = 0;
  56258. }
  56259. /**
  56260. * @function destroy
  56261. * @description 释放资源,将引用的资源属性置空。
  56262. */
  56263. destroy() {
  56264. super.destroy();
  56265. var me = this;
  56266. if (me.events) {
  56267. me.events.un(me.eventListeners);
  56268. me.events.listeners = null;
  56269. me.events.destroy();
  56270. me.events = null;
  56271. me.eventListeners = null;
  56272. }
  56273. }
  56274. /**
  56275. * @function MapService.prototype.processAsync
  56276. * @description 负责将客户端的设置的参数传递到服务端,与服务端完成异步通讯。
  56277. */
  56278. processAsync(callback) {
  56279. let eventId = ++this.eventCount;
  56280. let eventListeners = {
  56281. scope: this,
  56282. processCompleted: function(result) {
  56283. if (eventId === result.result.eventId && callback) {
  56284. delete result.result.eventId;
  56285. callback(result);
  56286. this.events && this.events.un(eventListeners);
  56287. return false;
  56288. }
  56289. },
  56290. processFailed: function(result) {
  56291. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  56292. callback(result);
  56293. this.events && this.events.un(eventListeners);
  56294. return false;
  56295. }
  56296. }
  56297. }
  56298. this.events.on(eventListeners);
  56299. var me = this;
  56300. me.request({
  56301. method: "GET",
  56302. scope: me,
  56303. success(result, options) {
  56304. result.eventId = eventId;
  56305. this.serviceProcessCompleted(result, options);
  56306. },
  56307. failure(result, options) {
  56308. if (result.error) {
  56309. result.error.eventId = eventId;
  56310. }
  56311. result.eventId = eventId;
  56312. this.serviceProcessFailed(result, options);
  56313. }
  56314. });
  56315. }
  56316. /*
  56317. * Method: getMapStatusCompleted
  56318. * 获取地图状态完成,执行此方法。
  56319. *
  56320. * Parameters:
  56321. * {Object} result - 服务器返回的结果对象。
  56322. */
  56323. serviceProcessCompleted(result, options) {
  56324. var me = this;
  56325. result = Util_Util.transformResult(result);
  56326. var codeStatus = (result.code >= 200 && result.code < 300) || result.code == 0 || result.code === 304;
  56327. var isCodeValid = result.code && codeStatus;
  56328. if (!result.code || isCodeValid) {
  56329. me.events && me.events.triggerEvent("processCompleted", {result: result, options});
  56330. } else {
  56331. ////在没有token是返回的是200,但是其实是没有权限,所以这里也应该是触发失败事件
  56332. me.events.triggerEvent("processFailed", {error: result, options});
  56333. }
  56334. }
  56335. }
  56336. ;// CONCATENATED MODULE: ./src/common/iServer/TilesetsService.js
  56337. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56338. * This program are made available under the terms of the Apache License, Version 2.0
  56339. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56340. /**
  56341. * @class TilesetsService
  56342. * @deprecatedclass SuperMap.TilesetsService
  56343. * @category iServer Map Tilesets
  56344. * @classdesc 切片列表信息查询服务类;即查询切片地图服务的切片列表,返回切片集名称、地图切片元数据信息、切片版本集信息。
  56345. * @extends {CommonServiceBase}
  56346. * @param {string} url - 服务地址。URL 应为:
  56347. * http://{服务器地址}:{服务端口号}/iserver/services/{服务名}/rest/maps/map;
  56348. * 例如: "http://localhost:8090/iserver/services/test/rest/maps/tianlocal"。
  56349. * @param {Object} options - 参数。
  56350. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  56351. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  56352. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  56353. * @param {Object} [options.headers] - 请求头。
  56354. * @usage
  56355. */
  56356. class TilesetsService extends CommonServiceBase {
  56357. constructor(url, options) {
  56358. super(url, options);
  56359. this.CLASS_NAME = "SuperMap.TilesetsService";
  56360. }
  56361. /**
  56362. * @override
  56363. */
  56364. destroy() {
  56365. super.destroy();
  56366. }
  56367. /**
  56368. * @function TilesetsService.prototype.processAsync
  56369. * @description 负责将客户端的查询参数传递到服务端。
  56370. */
  56371. processAsync() {
  56372. if (!this.url) {
  56373. return;
  56374. }
  56375. var me = this;
  56376. me.url = Util_Util.urlPathAppend(me.url, 'tilesets');
  56377. me.request({
  56378. method: "GET",
  56379. scope: me,
  56380. success: me.serviceProcessCompleted,
  56381. failure: me.serviceProcessFailed
  56382. });
  56383. }
  56384. }
  56385. ;// CONCATENATED MODULE: ./src/mapboxgl/services/MapService.js
  56386. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56387. * This program are made available under the terms of the Apache License, Version 2.0
  56388. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56389. /**
  56390. * @class MapService
  56391. * @category iServer Map
  56392. * @classdesc 地图信息服务类。
  56393. * @modulecategory Services
  56394. * @extends {ServiceBase}
  56395. * @param {string} url - 服务地址。
  56396. * @param {Object} options - 参数。
  56397. * @param {string} [options.proxy] - 服务代理地址。
  56398. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  56399. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  56400. * @param {Object} [options.headers] - 请求头。
  56401. * @example
  56402. * new MapService(url)
  56403. * .getMapInfo(function(result){
  56404. * //doSomething
  56405. * })
  56406. * @usage
  56407. */
  56408. class MapService extends ServiceBase {
  56409. constructor(url, options) {
  56410. super(url, options);
  56411. }
  56412. /**
  56413. * @function MapService.prototype.getMapInfo
  56414. * @description 地图信息查询服务。
  56415. * @param {RequestCallback} callback 回调函数。
  56416. * @returns {MapService} 获取服务信息。
  56417. */
  56418. getMapInfo(callback) {
  56419. var me = this;
  56420. var getMapStatusService = new MapService_MapService(me.url, {
  56421. proxy: me.options.proxy,
  56422. withCredentials: me.options.withCredentials,
  56423. crossOrigin: me.options.crossOrigin,
  56424. headers: me.options.headers,
  56425. projection: me.options.projection
  56426. });
  56427. getMapStatusService.processAsync(callback);
  56428. }
  56429. /**
  56430. * @function MapService.prototype.getTilesets
  56431. * @description 切片列表信息查询服务。
  56432. * @param {RequestCallback} callback - 回调函数 。
  56433. * @returns {MapService} 获取服务信息。
  56434. */
  56435. getTilesets(callback) {
  56436. var me = this;
  56437. var tilesetsService = new TilesetsService(me.url, {
  56438. proxy: me.options.proxy,
  56439. withCredentials: me.options.withCredentials,
  56440. crossOrigin: me.options.crossOrigin,
  56441. headers: me.options.headers,
  56442. eventListeners: {
  56443. scope: me,
  56444. processCompleted: callback,
  56445. processFailed: callback
  56446. }
  56447. });
  56448. tilesetsService.processAsync();
  56449. }
  56450. }
  56451. ;// CONCATENATED MODULE: ./src/common/iServer/MeasureParameters.js
  56452. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56453. * This program are made available under the terms of the Apache License, Version 2.0
  56454. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56455. /**
  56456. * @class MeasureParameters
  56457. * @deprecatedclass SuperMap.MeasureParameters
  56458. * @category iServer Map Measure
  56459. * @classdesc 量算参数类。
  56460. * @param {GeoJSONObject} geometry - 要量算的几何对象。
  56461. * @param {Object} options - 可选参数。
  56462. * @param {Unit} [options.unit=Unit.METER] - 量算单位。
  56463. * @param {string} [options.prjCoordSys] - 用来指定该量算操作所使用的投影。
  56464. * @param {string} [options.distanceMode="Geodesic"] - 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
  56465. * @usage
  56466. */
  56467. class MeasureParameters {
  56468. constructor(geometry, options) {
  56469. if (!geometry) {
  56470. return;
  56471. }
  56472. /**
  56473. * @member {GeoJSONObject} MeasureParameters.prototype.geometry
  56474. * @description 要量算的几何对象。<br>
  56475. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  56476. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  56477. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。
  56478. */
  56479. this.geometry = geometry;
  56480. /**
  56481. * @member {Unit} [MeasureParameters.prototype.unit=Unit.METER]
  56482. * @description 量算单位。即量算结果以米为单位。
  56483. */
  56484. this.unit = Unit.METER;
  56485. /**
  56486. * @member {string} [MeasureParameters.prototype.prjCoordSys]
  56487. * @description 用来指定该量算操作所使用的投影。
  56488. */
  56489. this.prjCoordSys = null;
  56490. /**
  56491. * @member {string} [MeasureParameters.prototype.distanceMode="Geodesic"]
  56492. * @description 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
  56493. * @example
  56494. * var param = new MeasureParameters(getmetry,{distanceMode:'Planar'});
  56495. */
  56496. this.distanceMode = null;
  56497. if (options) {
  56498. Util_Util.extend(this, options);
  56499. }
  56500. this.CLASS_NAME = "SuperMap.MeasureParameters";
  56501. }
  56502. /**
  56503. * @function MeasureParameters.prototype.destroy
  56504. * @description 释放资源,将引用资源的属性置空。
  56505. */
  56506. destroy() {
  56507. var me = this;
  56508. me.geometry = null;
  56509. me.unit = null;
  56510. me.prjCoordSys = null;
  56511. }
  56512. }
  56513. ;// CONCATENATED MODULE: ./src/common/iServer/MeasureService.js
  56514. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56515. * This program are made available under the terms of the Apache License, Version 2.0
  56516. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56517. /**
  56518. * @class MeasureService
  56519. * @deprecatedclass SuperMap.MeasureService
  56520. * @category iServer Map Measure
  56521. * @classdesc 量算服务类。
  56522. * 该类负责将量算参数传递到服务端,并获取服务端返回的量算结果。
  56523. * @extends {CommonServiceBase}
  56524. * @example
  56525. * var myMeasuerService = new MeasureService(url, {
  56526. * measureMode: MeasureMode.DISTANCE,
  56527. * eventListeners:{
  56528. * "processCompleted": measureCompleted
  56529. * }
  56530. * });
  56531. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  56532. * @param {Object} options - 参数。
  56533. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  56534. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  56535. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  56536. * @param {Object} [options.headers] - 请求头。
  56537. * @param {MeasureMode} options.measureMode - 量算模式,包括距离量算模式和面积量算模式。
  56538. * @usage
  56539. */
  56540. class MeasureService_MeasureService extends CommonServiceBase {
  56541. constructor(url, options) {
  56542. super(url, options);
  56543. /**
  56544. * @member {MeasureMode} [MeasureService.prototype.measureMode=MeasureMode.DISTANCE]
  56545. * @description 量算模式,包括距离量算模式和面积量算模式。
  56546. */
  56547. this.measureMode = MeasureMode.DISTANCE;
  56548. if (options) {
  56549. Util_Util.extend(this, options);
  56550. }
  56551. this.eventCount = 0;
  56552. this.CLASS_NAME = "SuperMap.MeasureService";
  56553. }
  56554. /**
  56555. * @override
  56556. */
  56557. destroy() {
  56558. super.destroy();
  56559. var me = this;
  56560. me.measureMode = null;
  56561. }
  56562. /**
  56563. * @function MeasureService.prototype.processAsync
  56564. * @description 负责将客户端的量算参数传递到服务端。
  56565. * @param {MeasureParameters} params - 量算参数。
  56566. */
  56567. processAsync(params, callback) {
  56568. if (!(params instanceof MeasureParameters)) {
  56569. return;
  56570. }
  56571. let eventId = ++this.eventCount;
  56572. let eventListeners = {
  56573. scope: this,
  56574. processCompleted: function(result) {
  56575. if (eventId === result.result.eventId && callback) {
  56576. delete result.result.eventId;
  56577. callback(result);
  56578. this.events && this.events.un(eventListeners);
  56579. return false;
  56580. }
  56581. },
  56582. processFailed: function(result) {
  56583. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  56584. callback(result);
  56585. this.events && this.events.un(eventListeners);
  56586. return false;
  56587. }
  56588. }
  56589. }
  56590. this.events.on(eventListeners);
  56591. var me = this,
  56592. geometry = params.geometry,
  56593. pointsCount = 0,
  56594. point2ds = null;
  56595. if (!geometry) {
  56596. return;
  56597. }
  56598. me.url = Util_Util.urlPathAppend(me.url, me.measureMode === MeasureMode.AREA ? 'area' : 'distance');
  56599. var serverGeometry = ServerGeometry.fromGeometry(geometry);
  56600. if (!serverGeometry) {
  56601. return;
  56602. }
  56603. pointsCount = serverGeometry.parts[0];
  56604. point2ds = serverGeometry.points.splice(0, pointsCount);
  56605. var prjCoordSysTemp, prjCodeTemp, paramsTemp;
  56606. if (params.prjCoordSys) {
  56607. if (typeof (params.prjCoordSys) === "object") {
  56608. prjCodeTemp = params.prjCoordSys.projCode;
  56609. prjCoordSysTemp = '{"epsgCode"' + prjCodeTemp.substring(prjCodeTemp.indexOf(":"), prjCodeTemp.length) + "}";
  56610. } else if (typeof (params.prjCoordSys) === "string") {
  56611. prjCoordSysTemp = '{"epsgCode"' + params.prjCoordSys.substring(params.prjCoordSys.indexOf(":"), params.prjCoordSys.length) + "}";
  56612. }
  56613. paramsTemp = {
  56614. "point2Ds": Util_Util.toJSON(point2ds),
  56615. "unit": params.unit,
  56616. "prjCoordSys": prjCoordSysTemp,
  56617. "distanceMode": params.distanceMode || 'Geodesic'
  56618. };
  56619. } else {
  56620. paramsTemp = {"point2Ds": Util_Util.toJSON(point2ds), "unit": params.unit, "distanceMode": params.distanceMode || 'Geodesic'};
  56621. }
  56622. me.request({
  56623. method: "GET",
  56624. params: paramsTemp,
  56625. scope: me,
  56626. success(result, options) {
  56627. result.eventId = eventId;
  56628. this.serviceProcessCompleted(result, options);
  56629. },
  56630. failure(result, options) {
  56631. if (result.error) {
  56632. result.error.eventId = eventId;
  56633. }
  56634. result.eventId = eventId;
  56635. this.serviceProcessFailed(result, options);
  56636. }
  56637. });
  56638. }
  56639. }
  56640. ;// CONCATENATED MODULE: ./src/mapboxgl/services/MeasureService.js
  56641. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56642. * This program are made available under the terms of the Apache License, Version 2.0
  56643. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56644. /**
  56645. * @class MeasureService
  56646. * @category iServer Map Measure
  56647. * @classdesc 量算服务类。
  56648. * @modulecategory Services
  56649. * @extends {ServiceBase}
  56650. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map。
  56651. * @param {Object} options - 参数。
  56652. * @param {string} [options.proxy] - 服务代理地址。
  56653. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  56654. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  56655. * @param {Object} [options.headers] - 请求头。
  56656. * @param {MeasureMode} [options.measureMode=MeasureMode.DISTANCE] - 量算模式,包括距离量算模式和面积量算模式。
  56657. * @usage
  56658. */
  56659. class MeasureService extends ServiceBase {
  56660. constructor(url, options) {
  56661. super(url, options);
  56662. }
  56663. /**
  56664. * @function MeasureService.prototype.measureDistance
  56665. * @description 距离量算。
  56666. * @param {MeasureParameters} params - 量算参数类。
  56667. * @param {RequestCallback} callback 回调函数。
  56668. */
  56669. measureDistance(params, callback) {
  56670. this.measure(params, 'DISTANCE', callback);
  56671. }
  56672. /**
  56673. * @function MeasureService.prototype.measureArea
  56674. * @description 面积量算。
  56675. * @param {MeasureParameters} params - 量算参数类。
  56676. * @param {RequestCallback} callback 回调函数。
  56677. */
  56678. measureArea(params, callback) {
  56679. this.measure(params, 'AREA', callback);
  56680. }
  56681. /**
  56682. * @function MeasureService.prototype.measure
  56683. * @description 量算。
  56684. * @param {MeasureParameters} params - 量算参数类。
  56685. * @param {string} type - 量算类型。
  56686. * @param {RequestCallback} callback - 回调函数。
  56687. * @returns {MeasureService} 量算服务。
  56688. */
  56689. measure(params, type, callback) {
  56690. var me = this;
  56691. var measureService = new MeasureService_MeasureService(me.url, {
  56692. proxy: me.options.proxy,
  56693. withCredentials: me.options.withCredentials,
  56694. crossOrigin: me.options.crossOrigin,
  56695. headers: me.options.headers,
  56696. measureMode: type
  56697. });
  56698. measureService.processAsync(me._processParam(params), callback);
  56699. }
  56700. _processParam(params) {
  56701. if (params && !(params.geometry instanceof Geometry_Geometry)) {
  56702. params.geometry = core_Util_Util.toSuperMapGeometry(params.geometry);
  56703. }
  56704. return params;
  56705. }
  56706. }
  56707. ;// CONCATENATED MODULE: ./src/common/iServer/NetworkAnalystServiceBase.js
  56708. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56709. * This program are made available under the terms of the Apache License, Version 2.0
  56710. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56711. /**
  56712. * @class NetworkAnalystServiceBase
  56713. * @deprecatedclass SuperMap.NetworkAnalystServiceBase
  56714. * @category iServer Core
  56715. * @classdesc 网络分析服务基类。
  56716. * @extends {CommonServiceBase}
  56717. * @param {string} url - 服务地址。
  56718. * @param {Object} options - 可选参数。
  56719. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  56720. * @param {Object} [options.headers] - 请求头。
  56721. * @usage
  56722. */
  56723. class NetworkAnalystServiceBase extends CommonServiceBase {
  56724. constructor(url, options) {
  56725. super(url, options);
  56726. /**
  56727. * @member {DataFormat} [NetworkAnalystServiceBase.prototype.format=DataFormat.GEOJSON]
  56728. * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为 "ISERVER","GEOJSON"
  56729. */
  56730. this.format = DataFormat.GEOJSON;
  56731. this.CLASS_NAME = "SuperMap.NetworkAnalystServiceBase";
  56732. }
  56733. /**
  56734. * @function NetworkAnalystServiceBase.prototype.destroy
  56735. * @description 释放资源,将引用的资源属性置空。
  56736. */
  56737. destroy() {
  56738. super.destroy();
  56739. this.format = null;
  56740. }
  56741. /**
  56742. * @function NetworkAnalystServiceBase.prototype.serviceProcessCompleted
  56743. * @description 分析完成,执行此方法。
  56744. * @param {Object} result - 服务器返回的结果对象。
  56745. */
  56746. serviceProcessCompleted(result, options) {
  56747. var me = this, analystResult;
  56748. result = Util_Util.transformResult(result);
  56749. if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
  56750. analystResult = me.toGeoJSONResult(result);
  56751. }
  56752. if (!analystResult) {
  56753. analystResult = result;
  56754. }
  56755. me.events.triggerEvent("processCompleted", {result: analystResult, options});
  56756. }
  56757. /**
  56758. * @function NetworkAnalystServiceBase.prototype.toGeoJSONResult
  56759. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。只处理结果中的路由,由子类实现。
  56760. * @param {Object} result - 服务器返回的结果对象。
  56761. * @returns {GeoJSONObject} GeoJSON 对象。
  56762. */
  56763. toGeoJSONResult(result) { // eslint-disable-line no-unused-vars
  56764. return null;
  56765. }
  56766. }
  56767. ;// CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystParameters.js
  56768. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56769. * This program are made available under the terms of the Apache License, Version 2.0
  56770. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56771. /**
  56772. * @class BurstPipelineAnalystParameters
  56773. * @deprecatedclass SuperMap.BurstPipelineAnalystParameters
  56774. * @category iServer NetworkAnalyst BurstAnalyse
  56775. * @classdesc 爆管分析参数类。
  56776. * @param {Object} options - 参数。
  56777. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  56778. * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
  56779. * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
  56780. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
  56781. * @usage
  56782. */
  56783. class BurstPipelineAnalystParameters {
  56784. constructor(options) {
  56785. var me = this;
  56786. /**
  56787. * @member {Array.<number>} BurstPipelineAnalystParameters.prototype.sourceNodeIDs
  56788. * @description 指定的设施点 ID 数组。
  56789. */
  56790. this.sourceNodeIDs = null;
  56791. /**
  56792. * @member {number} [BurstPipelineAnalystParameters.prototype.edgeID]
  56793. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  56794. */
  56795. this.edgeID = null;
  56796. /**
  56797. * @member {number} [BurstPipelineAnalystParameters.prototype.nodeID]
  56798. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  56799. */
  56800. this.nodeID = null;
  56801. /**
  56802. * @member {boolean} [BurstPipelineAnalystParameters.prototype.isUncertainDirectionValid=false]
  56803. * @description 指定不确定流向是否有效。
  56804. * 指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行。
  56805. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  56806. */
  56807. this.isUncertainDirectionValid = false;
  56808. Util_Util.extend(me, options);
  56809. this.CLASS_NAME = "SuperMap.BurstPipelineAnalystParameters";
  56810. }
  56811. /**
  56812. * @function BurstPipelineAnalystParameters.prototype.destroy
  56813. * @description 释放资源,将引用资源的属性置空。
  56814. */
  56815. destroy() {
  56816. var me = this;
  56817. me.sourceNodeIDs = null;
  56818. me.edgeID = null;
  56819. me.nodeID = null;
  56820. me.isUncertainDirectionValid = null;
  56821. }
  56822. }
  56823. ;// CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystService.js
  56824. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56825. * This program are made available under the terms of the Apache License, Version 2.0
  56826. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56827. /**
  56828. * @class BurstPipelineAnalystService
  56829. * @deprecatedclass SuperMap.BurstPipelineAnalystService
  56830. * @category iServer NetworkAnalyst BurstAnalyse
  56831. * @classdesc 爆管分析服务类。即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组、普通结点 ID 数组及其上下游弧段 ID 数组。
  56832. * @extends {NetworkAnalystServiceBase}
  56833. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  56834. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源},
  56835. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  56836. * @param {Object} options - 参数。
  56837. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  56838. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  56839. * @param {Object} [options.headers] - 请求头。
  56840. * @usage
  56841. */
  56842. class BurstPipelineAnalystService extends NetworkAnalystServiceBase {
  56843. constructor(url, options) {
  56844. super(url, options);
  56845. this.CLASS_NAME = "SuperMap.BurstPipelineAnalystService";
  56846. }
  56847. /**
  56848. * @function BurstPipelineAnalystService.prototype.destroy
  56849. * @override
  56850. */
  56851. destroy() {
  56852. super.destroy();
  56853. }
  56854. /**
  56855. * @function BurstPipelineAnalystService.prototype.processAsync
  56856. * @description 负责将客户端的查询参数传递到服务端。
  56857. * @params {BurstPipelineAnalystParameters} params - 爆管分析参数类
  56858. */
  56859. processAsync(params) {
  56860. if (!(params instanceof BurstPipelineAnalystParameters)) {
  56861. return null;
  56862. }
  56863. var me = this, jsonObject;
  56864. me.url = Util_Util.urlPathAppend(me.url, 'burstAnalyse');
  56865. jsonObject = {
  56866. sourceNodeIDs: params.sourceNodeIDs,
  56867. isUncertainDirectionValid: params.isUncertainDirectionValid
  56868. };
  56869. //必传参数不正确,就终止
  56870. if (params.edgeID !== null && params.nodeID !== null) {
  56871. throw new Error('edgeID and nodeID cannot be null at the same time.');
  56872. }
  56873. if (params.edgeID === null && params.nodeID === null) {
  56874. throw new Error('edgeID and nodeID cannot be null at the same time.');
  56875. }
  56876. if (params.edgeID !== null) {
  56877. jsonObject.edgeID = params.edgeID;
  56878. } else {
  56879. jsonObject.nodeID = params.nodeID;
  56880. }
  56881. me.request({
  56882. method: "GET",
  56883. params: jsonObject,
  56884. scope: me,
  56885. success: me.serviceProcessCompleted,
  56886. failure: me.serviceProcessFailed
  56887. });
  56888. }
  56889. }
  56890. ;// CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystResultSetting.js
  56891. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56892. * This program are made available under the terms of the Apache License, Version 2.0
  56893. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56894. /**
  56895. * @class TransportationAnalystResultSetting
  56896. * @deprecatedclass SuperMap.TransportationAnalystResultSetting
  56897. * @category iServer NetworkAnalyst
  56898. * @classdesc 交通网络分析结果参数类。通过该类设置交通网络分析返回的结果,包括是否返回图片、是否返回弧段空间信息、是否返回结点空间信息等。
  56899. * @param {Object} options - 可选参数。
  56900. * @param {boolean} [options.returnEdgeFeatures=false] - 是否在分析结果中包含弧段要素集合。
  56901. * @param {boolean} [options.returnEdgeGeometry=false] - 返回的弧段要素集合中是否包含几何对象信息。
  56902. * @param {boolean} [options.returnEdgeIDs=false] - 返回结果中是否包含经过弧段 ID 集合。
  56903. * @param {boolean} [options.returnNodeFeatures=false] - 是否在分析结果中包含结点要素集合。
  56904. * @param {boolean} [options.returnNodeGeometry=false] - 返回的结点要素集合中是否包含几何对象信息。
  56905. * @param {boolean} [options.returnNodeIDs=false] - 返回结果中是否包含经过结点 ID 集合。
  56906. * @param {boolean} [options.returnPathGuides=false] - 返回分析结果中是否包含行驶导引集合。
  56907. * @param {boolean} [options.returnRoutes=false] - 返回分析结果中是否包含路由对象的集合。
  56908. * @usage
  56909. */
  56910. class TransportationAnalystResultSetting {
  56911. constructor(options) {
  56912. if (!options) {
  56913. return;
  56914. }
  56915. /**
  56916. * @member {boolean} TransportationAnalystResultSetting.prototype.returnEdgeFeatures
  56917. * @description 是否在分析结果中包含弧段要素集合。弧段要素包括弧段的空间信息和属性信息。
  56918. */
  56919. this.returnEdgeFeatures = false;
  56920. /**
  56921. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnEdgeGeometry=false]
  56922. * @description 返回的弧段要素集合中是否包含几何对象信息。
  56923. */
  56924. this.returnEdgeGeometry = false;
  56925. /**
  56926. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnEdgeIDs=false]
  56927. * @description 返回结果中是否包含经过弧段 ID 集合。
  56928. */
  56929. this.returnEdgeIDs = false;
  56930. /**
  56931. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnNodeFeatures=false]
  56932. * @description 是否在分析结果中包含结点要素集合。
  56933. * 结点要素包括结点的空间信息和属性信息。其中返回的结点要素是否包含空间信息可通过 returnNodeGeometry 字段设置。
  56934. */
  56935. this.returnNodeFeatures = false;
  56936. /**
  56937. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnNodeGeometry=false]
  56938. * @description 返回的结点要素集合中是否包含几何对象信息。
  56939. */
  56940. this.returnNodeGeometry = false;
  56941. /**
  56942. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnNodeIDs=false]
  56943. * @description 返回结果中是否包含经过结点 ID 集合。
  56944. */
  56945. this.returnNodeIDs = false;
  56946. /**
  56947. * @member {boolean} TransportationAnalystResultSetting.prototype.returnPathGuides
  56948. * @description 返回分析结果中是否包含行驶导引集合。
  56949. */
  56950. this.returnPathGuides = false;
  56951. /**
  56952. * @member {boolean} TransportationAnalystResultSetting.prototype.returnRoutes
  56953. * @description 返回分析结果中是否包含路由对象的集合。
  56954. */
  56955. this.returnRoutes = false;
  56956. Util_Util.extend(this, options);
  56957. this.CLASS_NAME = "SuperMap.TransportationAnalystResultSetting";
  56958. }
  56959. /**
  56960. * @function TransportationAnalystResultSetting.prototype.destroy
  56961. * @description 释放资源,将引用资源的属性置空。
  56962. */
  56963. destroy() {
  56964. var me = this;
  56965. me.returnEdgeFeatures = null;
  56966. me.returnEdgeGeometry = null;
  56967. me.returnEdgeIDs = null;
  56968. me.returnNodeFeatures = null;
  56969. me.returnNodeGeometry = null;
  56970. me.returnNodeIDs = null;
  56971. me.returnPathGuides = null;
  56972. me.returnRoutes = null;
  56973. }
  56974. }
  56975. ;// CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystParameter.js
  56976. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56977. * This program are made available under the terms of the Apache License, Version 2.0
  56978. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56979. /**
  56980. * @class TransportationAnalystParameter
  56981. * @deprecatedclass SuperMap.TransportationAnalystParameter
  56982. * @category iServer NetworkAnalyst
  56983. * @classdesc 交通网络分析通用参数类。该类主要用来提供交通网络分析所需的通用参数。
  56984. * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息,还可以对分析结果包含的内容进行一些设置。
  56985. * @param {Object} options - 参数。
  56986. * @param {Array.<number>} options.barrierEdgeIDs - 网络分析中障碍弧段的 ID 数组。
  56987. * @param {Array.<number>} options.barrierNodeIDs - 网络分析中障碍点的 ID 数组。
  56988. * @param {string} options.turnWeightField - 转向权重字段的名称。
  56989. * @param {TransportationAnalystResultSetting} options.resultSetting - 分析结果返回内容。
  56990. * @param {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} [options.barrierPoints] - 网络分析中 Point2D 类型的障碍点数组。
  56991. * @param {string} [options.weightFieldName] - 阻力字段的名称。
  56992. * @usage
  56993. */
  56994. class TransportationAnalystParameter {
  56995. constructor(options) {
  56996. if (!options) {
  56997. return;
  56998. }
  56999. /**
  57000. * @member {Array.<number>} TransportationAnalystParameter.prototype.barrierEdgeIDs
  57001. * @description 网络分析中障碍弧段的 ID 数组。弧段设置为障碍边之后,表示双向都不通。
  57002. */
  57003. this.barrierEdgeIDs = null;
  57004. /**
  57005. * @member {Array.<number>} TransportationAnalystParameter.prototype.barrierNodeIDs
  57006. * @description 网络分析中障碍点的 ID 数组。结点设置为障碍点之后,表示任何方向都不能通过此结点。
  57007. */
  57008. this.barrierNodeIDs = null;
  57009. /**
  57010. * @member {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} TransportationAnalystParameter.prototype.barrierPoints
  57011. * @description 网络分析中 Point2D 类型的障碍点数组。障碍点表示任何方向都不能通过此点。</br>
  57012. * 当各网络分析参数类中的 isAnalyzeById 属性设置为 false 时,该属性才生效。
  57013. */
  57014. this.barrierPoints = null;
  57015. /**
  57016. * @member {string} [TransportationAnalystParameter.prototype.weightFieldName]
  57017. * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段,例如表示时间、长度等的字段都可以用作阻力字段。
  57018. * 该字段默值为服务器发布的所有耗费字段的第一个字段。
  57019. */
  57020. this.weightFieldName = null;
  57021. /**
  57022. * @member {string} TransportationAnalystParameter.prototype.turnWeightField
  57023. * @description 转向权重字段的名称。
  57024. */
  57025. this.turnWeightField = null;
  57026. /**
  57027. * @member {TransportationAnalystResultSetting} TransportationAnalystParameter.prototype.resultSetting
  57028. * @description 分析结果返回内容。
  57029. */
  57030. this.resultSetting = new TransportationAnalystResultSetting();
  57031. Util_Util.extend(this, options);
  57032. this.CLASS_NAME = "SuperMap.TransportationAnalystParameter";
  57033. }
  57034. /**
  57035. * @function TransportationAnalystParameter.prototype.destroy
  57036. * @description 释放资源,将引用资源的属性置空。
  57037. */
  57038. destroy() {
  57039. var me = this;
  57040. me.barrierEdgeIDs = null;
  57041. me.barrierNodeIDs = null;
  57042. me.weightFieldName = null;
  57043. me.turnWeightField = null;
  57044. if (me.resultSetting) {
  57045. me.resultSetting.destroy();
  57046. me.resultSetting = null;
  57047. }
  57048. if (me.barrierPoints && me.barrierPoints.length) {
  57049. for (var i in me.barrierPoints) {
  57050. me.barrierPoints[i].destroy();
  57051. }
  57052. }
  57053. me.barrierPoints = null;
  57054. }
  57055. }
  57056. ;// CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixParameters.js
  57057. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57058. * This program are made available under the terms of the Apache License, Version 2.0
  57059. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57060. /**
  57061. * @class ComputeWeightMatrixParameters
  57062. * @deprecatedclass SuperMap.ComputeWeightMatrixParameters
  57063. * @category iServer NetworkAnalyst WeightMatrix
  57064. * @classdesc 耗费矩阵分析参数类。根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  57065. * @param {Object} options - 参数。
  57066. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  57067. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} options.nodes - 要计算耗费矩阵的点数组。
  57068. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  57069. * @usage
  57070. */
  57071. class ComputeWeightMatrixParameters {
  57072. constructor(options) {
  57073. /**
  57074. * @member {boolean} [ComputeWeightMatrixParameters.prototype.isAnalyzeById=false]
  57075. * @description 是否通过节点 ID 指定路径分析的结点,即通过坐标点指定。
  57076. */
  57077. this.isAnalyzeById = false;
  57078. /**
  57079. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} ComputeWeightMatrixParameters.prototype.nodes
  57080. * @description 要计算耗费矩阵的点数组。
  57081. * 当 {@link ComputeWeightMatrixParameters.isAnalyzeById} = false 时,nodes 应为点的坐标数组;
  57082. * 当 {@link ComputeWeightMatrixParameters.isAnalyzeById} = true 时,nodes 应为点的 ID 数组。
  57083. */
  57084. this.nodes = null;
  57085. /**
  57086. * @member {TransportationAnalystParameter} ComputeWeightMatrixParameters.prototype.parameter
  57087. * @description 交通网络分析通用参数。
  57088. */
  57089. this.parameter = new TransportationAnalystParameter();
  57090. Util_Util.extend(this, options);
  57091. this.CLASS_NAME = "SuperMap.ComputeWeightMatrixParameters";
  57092. }
  57093. /**
  57094. * @function ComputeWeightMatrixParameters.prototype.destroy
  57095. * @description 释放资源,将引用资源的属性置空。
  57096. */
  57097. destroy() {
  57098. var me = this;
  57099. me.isAnalyzeById = null;
  57100. me.nodes = null;
  57101. if (me.parameter) {
  57102. me.parameter.destroy();
  57103. me.parameter = null;
  57104. }
  57105. }
  57106. }
  57107. ;// CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixService.js
  57108. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57109. * This program are made available under the terms of the Apache License, Version 2.0
  57110. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57111. /**
  57112. * @class ComputeWeightMatrixService
  57113. * @deprecatedclass SuperMap.ComputeWeightMatrixService
  57114. * @category iServer NetworkAnalyst WeightMatrix
  57115. * @classdesc 耗费矩阵分析服务类。
  57116. * 耗费矩阵是根据交通网络分析参数中的耗费字段来计算一个二维数组,
  57117. * 用来存储指定的任意两点间的资源消耗。
  57118. * 耗费矩阵分析结果通过该类支持的事件的监听函数参数获取
  57119. * @extends {NetworkAnalystServiceBase}
  57120. * @example
  57121. * var mycomputeWeightMatrixService = new ComputeWeightMatrixService(url,{
  57122. * eventListeners: {
  57123. * "processCompleted": computeWeightMatrixCompleted,
  57124. * "processFailed": computeWeightMatrixnError
  57125. * }
  57126. * });
  57127. * @param {string} url - 耗费矩阵分析服务地址。请求服务的URL应为:
  57128. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  57129. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  57130. * @param {Object} options - 参数。
  57131. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  57132. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  57133. * @param {Object} [options.headers] - 请求头。
  57134. * @usage
  57135. */
  57136. class ComputeWeightMatrixService extends NetworkAnalystServiceBase {
  57137. constructor(url, options) {
  57138. super(url, options);
  57139. this.CLASS_NAME = "SuperMap.ComputeWeightMatrixService";
  57140. }
  57141. /**
  57142. * @function ComputeWeightMatrixService.prototype.destroy
  57143. * @override
  57144. */
  57145. destroy() {
  57146. super.destroy();
  57147. }
  57148. /**
  57149. * @function ComputeWeightMatrixService.prototype.processAsync
  57150. * @description 负责将客户端的查询参数传递到服务端。
  57151. * @param {ComputeWeightMatrixParameters} params - 耗费矩阵分析参数类
  57152. */
  57153. processAsync(params) {
  57154. if (!(params instanceof ComputeWeightMatrixParameters)) {
  57155. return;
  57156. }
  57157. var me = this,
  57158. jsonObject;
  57159. me.url = Util_Util.urlPathAppend(me.url, 'weightmatrix');
  57160. jsonObject = {
  57161. parameter: Util_Util.toJSON(params.parameter),
  57162. nodes: me.getJson(params.isAnalyzeById, params.nodes)
  57163. };
  57164. me.request({
  57165. method: "GET",
  57166. params: jsonObject,
  57167. scope: me,
  57168. success: me.serviceProcessCompleted,
  57169. failure: me.serviceProcessFailed
  57170. });
  57171. }
  57172. /**
  57173. * @function ComputeWeightMatrixService.prototype.getJson
  57174. * @description 将对象转化为JSON字符串。
  57175. * @param {boolean} isAnalyzeById - 是否通过id分析
  57176. * @param {Array.<ComputeWeightMatrixParameters>} params - 分析参数数组
  57177. * @returns {string} 转化后的JSON字符串。
  57178. */
  57179. getJson(isAnalyzeById, params) {
  57180. var jsonString = "[",
  57181. len = params ? params.length : 0;
  57182. if (isAnalyzeById === false) {
  57183. for (let i = 0; i < len; i++) {
  57184. if (i > 0) {
  57185. jsonString += ",";
  57186. }
  57187. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  57188. }
  57189. } else if (isAnalyzeById === true) {
  57190. for (let i = 0; i < len; i++) {
  57191. if (i > 0) {
  57192. jsonString += ",";
  57193. }
  57194. jsonString += params[i];
  57195. }
  57196. }
  57197. jsonString += ']';
  57198. return jsonString;
  57199. }
  57200. }
  57201. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamParameters.js
  57202. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57203. * This program are made available under the terms of the Apache License, Version 2.0
  57204. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57205. /**
  57206. * @class FacilityAnalystStreamParameters
  57207. * @deprecatedclass SuperMap.FacilityAnalystStreamParameters
  57208. * @category iServer NetworkAnalyst UpstreamCirticalFaclilities
  57209. * @classdesc 上游/下游关键设施查找资源参数类。
  57210. * @param {Object} options - 参数。
  57211. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  57212. * @param {number} options.queryType - 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
  57213. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  57214. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  57215. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
  57216. * @usage
  57217. */
  57218. class FacilityAnalystStreamParameters {
  57219. constructor(options) {
  57220. /**
  57221. * @member {Array.<number>} [FacilityAnalystStreamParameters.prototype.sourceNodeIDs]
  57222. * @description 指定的设施点 ID 数组。
  57223. */
  57224. this.sourceNodeIDs = null;
  57225. /**
  57226. * @member {number} [FacilityAnalystStreamParameters.prototype.edgeID]
  57227. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  57228. */
  57229. this.edgeID = null;
  57230. /**
  57231. * @member {number} [FacilityAnalystStreamParameters.prototype.nodeID]
  57232. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  57233. */
  57234. this.nodeID = null;
  57235. /**
  57236. * @member {boolean} [FacilityAnalystStreamParameters.prototype.isUncertainDirectionValid=false]
  57237. * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  57238. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  57239. */
  57240. this.isUncertainDirectionValid = false;
  57241. /**
  57242. * @member {number} FacilityAnalystStreamParameters.prototype.queryType
  57243. * @description 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
  57244. */
  57245. this.queryType = null;
  57246. Util_Util.extend(this, options);
  57247. this.CLASS_NAME = "SuperMap.FacilityAnalystStreamParameters";
  57248. }
  57249. /**
  57250. * @function FacilityAnalystStreamParameters.prototype.destroy
  57251. * @description 释放资源,将引用资源的属性置空。
  57252. */
  57253. destroy() {
  57254. var me = this;
  57255. me.edgeID = null;
  57256. me.nodeID = null;
  57257. me.weightName = null;
  57258. me.isUncertainDirectionValid = null;
  57259. me.type = null;
  57260. }
  57261. }
  57262. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamService.js
  57263. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57264. * This program are made available under the terms of the Apache License, Version 2.0
  57265. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57266. /**
  57267. * @class FacilityAnalystStreamService
  57268. * @deprecatedclass SuperMap.FacilityAnalystStreamService
  57269. * @category iServer NetworkAnalyst UpstreamCirticalFaclilities
  57270. * @classdesc 上游/下游 关键设施查找资源服务类:即查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  57271. * @extends NetworkAnalystServiceBase
  57272. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  57273. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  57274. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet";
  57275. * @param {Object} options - 参数。
  57276. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  57277. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  57278. * @param {Object} [options.headers] - 请求头。
  57279. * @usage
  57280. */
  57281. class FacilityAnalystStreamService extends NetworkAnalystServiceBase {
  57282. constructor(url, options) {
  57283. super(url, options);
  57284. this.CLASS_NAME = "SuperMap.FacilityAnalystStreamService";
  57285. }
  57286. /**
  57287. * @function FacilityAnalystStreamService.prototype.destroy
  57288. * @override
  57289. */
  57290. destroy() {
  57291. super.destroy();
  57292. }
  57293. /**
  57294. * @function FacilityAnalystStreamService.prototype.processAsync
  57295. * @description 负责将客户端的查询参数传递到服务端。
  57296. * @param {FacilityAnalystStreamParameters} params - 上游/下游关键设施查找资源参数类。
  57297. */
  57298. processAsync(params) {
  57299. if (!(params instanceof FacilityAnalystStreamParameters)) {
  57300. return;
  57301. }
  57302. var me = this,
  57303. jsonObject;
  57304. //URL 通过参数类型来判断是 上游 还是下游 查询
  57305. if (params.queryType === 0) {
  57306. me.url = Util_Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
  57307. } else if (params.queryType === 1) {
  57308. me.url = Util_Util.urlPathAppend(me.url, 'downstreamcirticalfaclilities');
  57309. } else {
  57310. return;
  57311. }
  57312. jsonObject = {
  57313. sourceNodeIDs: params.sourceNodeIDs,
  57314. isUncertainDirectionValid: params.isUncertainDirectionValid
  57315. };
  57316. if (params.edgeID !== null && params.nodeID !== null) {
  57317. return;
  57318. }
  57319. if (params.edgeID === null && params.nodeID === null) {
  57320. return;
  57321. }
  57322. if (params.edgeID !== null) {
  57323. jsonObject.edgeID = params.edgeID;
  57324. } else {
  57325. jsonObject.nodeID = params.nodeID;
  57326. }
  57327. me.request({
  57328. method: "GET",
  57329. params: jsonObject,
  57330. scope: me,
  57331. success: me.serviceProcessCompleted,
  57332. failure: me.serviceProcessFailed
  57333. });
  57334. }
  57335. }
  57336. ;// CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesParameters.js
  57337. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57338. * This program are made available under the terms of the Apache License, Version 2.0
  57339. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57340. /**
  57341. * @class FindClosestFacilitiesParameters
  57342. * @deprecatedclass SuperMap.FindClosestFacilitiesParameters
  57343. * @category iServer NetworkAnalyst ClosestFacility
  57344. * @classdesc 最近设施分析参数类。
  57345. * @param {Object} options - 参数。
  57346. * @param {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} options.event - 事件点,一般为需要获得服务设施服务的事件位置。
  57347. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.facilities - 设施点集合,一般为提供服务的服务设施位置。
  57348. * @param {number} [options.expectFacilityCount=1] - 要查找的设施点数量。
  57349. * @param {boolean} [options.fromEvent=false] - 是否从事件点到设施点进行查找。
  57350. * @param {boolean} [options.isAnalyzeById=false] - 事件点和设施点是否通过节点 ID 号来指定。
  57351. * @param {number} [options.maxWeight=0] - 权值的最大限值。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
  57352. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  57353. * @usage
  57354. */
  57355. class FindClosestFacilitiesParameters {
  57356. constructor(options) {
  57357. /**
  57358. * @member {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} FindClosestFacilitiesParameters.prototype.event
  57359. * @description 事件点,一般为需要获得服务设施服务的事件位置。
  57360. * 可以通过两种方式赋予事件点:当该类中字段 isAnalyzeById = true 时,应输入事件点 ID 号;当 isAnalyzeById = false 时,应输入事件点坐标。
  57361. */
  57362. this.event = null;
  57363. /**
  57364. * @member {number} [FindClosestFacilitiesParameters.prototype.expectFacilityCount=1]
  57365. * @description 要查找的设施点数量。
  57366. */
  57367. this.expectFacilityCount = 1;
  57368. /**
  57369. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} [FindClosestFacilitiesParameters.prototype.facilities=false]
  57370. * @description 设施点集合,一般为提供服务的服务设施位置。
  57371. * 可以通过两种方式赋予设施点:当该类中字段 isAnalyzeById = true 时,应输入设施点 ID 号;当 isAnalyzeById = false 时,应输入设施点坐标。
  57372. */
  57373. this.facilities = null;
  57374. /**
  57375. * @member {boolean} [FindClosestFacilitiesParameters.prototype.fromEvent=false]
  57376. * @description 是否从事件点到设施点进行查找。最近设施分析主要是通过设施点和事件点之间最优的路线来分析在一定范围内哪个或哪些设施与事件点有最优路线的关系。
  57377. * 这个行走线路是通过网络图层进行网络分析算法计算出来的两点间的最优路线。由于存在从 A 点到 B 点与从 B 点到 A 点的耗费不一样的情况,因此起止点不同可能会得到不同的最优路线。因此在进行最近设施分析之前,需要设置获取的最优路线的方向,即是以事件点作为起点到最近设施点的方向分析,还是以最近设施点为起点到事件点的方向分析。如果需要以事件点作为起点到设施点方向进行查找,设置该字段值为 true;设置为 false,表示从设施点到事件点进行查找。
  57378. */
  57379. this.fromEvent = false;
  57380. /**
  57381. * @member {boolean} [FindClosestFacilitiesParameters.prototype.isAnalyzeById=false]
  57382. * @description 事件点和设施点是否通过节点 ID 号来指定,设置为 false,表示通过坐标点指定事件点和设施点。
  57383. */
  57384. this.isAnalyzeById = false;
  57385. /**
  57386. * @member {number} [FindClosestFacilitiesParameters.prototype.maxWeight=0]
  57387. * @description 权值的最大限值。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
  57388. * 例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,超过 10 分钟能到达的都不予考虑。
  57389. * 那么需要将网络分析参数中 parameter.weightFieldName 设置为表示时间的字段,然后设置查找范围的半径值为10。
  57390. */
  57391. this.maxWeight = 0;
  57392. /**
  57393. * @member {TransportationAnalystParameter} [FindClosestFacilitiesParameters.prototype.parameter]
  57394. * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  57395. * 它为 TransportationAnalystParameter 类型,虽然为可选参数,但是如果不设置其中的 resultSetting 字段,
  57396. * 则返回结果空间信息等都为空。
  57397. */
  57398. this.parameter = new TransportationAnalystParameter();
  57399. Util_Util.extend(this, options);
  57400. this.CLASS_NAME = "SuperMap.FindClosestFacilitiesParameters";
  57401. }
  57402. /**
  57403. * @function FindClosestFacilitiesParameters.prototype.destroy
  57404. * @description 释放资源,将引用资源的属性置空。
  57405. */
  57406. destroy() {
  57407. var me = this;
  57408. me.event = null;
  57409. me.expectFacilityCount = null;
  57410. me.facilities = null;
  57411. me.fromEvent = null;
  57412. me.isAnalyzeById = null;
  57413. me.maxWeight = null;
  57414. if (me.parameter) {
  57415. me.parameter.destroy();
  57416. me.parameter = null;
  57417. }
  57418. }
  57419. }
  57420. ;// CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesService.js
  57421. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57422. * This program are made available under the terms of the Apache License, Version 2.0
  57423. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57424. /**
  57425. * @class FindClosestFacilitiesService
  57426. * @deprecatedclass SuperMap.FindClosestFacilitiesService
  57427. * @category iServer NetworkAnalyst ClosestFacility
  57428. * @classdesc 最近设施分析服务类。
  57429. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  57430. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  57431. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  57432. * 最近设施分析结果通过该类支持的事件的监听函数参数获取
  57433. * @extends {NetworkAnalystServiceBase}
  57434. * @example
  57435. * var myfindClosestFacilitiesService = new FindClosestFacilitiesService(url, {
  57436. * eventListeners: {
  57437. * "processCompleted": findClosestFacilitiesCompleted,
  57438. * "processFailed": findClosestFacilitiesError
  57439. * }
  57440. * });
  57441. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  57442. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  57443. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  57444. * @param {Object} options - 参数。
  57445. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  57446. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  57447. * @param {Object} [options.headers] - 请求头。
  57448. * @usage
  57449. */
  57450. class FindClosestFacilitiesService extends NetworkAnalystServiceBase {
  57451. constructor(url, options) {
  57452. super(url, options);
  57453. this.CLASS_NAME = "SuperMap.FindClosestFacilitiesService";
  57454. }
  57455. /**
  57456. * @function FindClosestFacilitiesService.prototype.destroy
  57457. * @override
  57458. */
  57459. destroy() {
  57460. super.destroy();
  57461. }
  57462. /**
  57463. * @function FindClosestFacilitiesService.prototype.processAsync
  57464. * @description 负责将客户端的查询参数传递到服务端。
  57465. * @param {FindClosestFacilitiesParameters} params - 最近设施分析服务参数类
  57466. */
  57467. processAsync(params) {
  57468. if (!(params instanceof FindClosestFacilitiesParameters)) {
  57469. return;
  57470. }
  57471. var me = this,
  57472. jsonObject;
  57473. me.url = Util_Util.urlPathAppend(me.url, 'closestfacility');
  57474. jsonObject = {
  57475. expectFacilityCount: params.expectFacilityCount,
  57476. fromEvent: params.fromEvent,
  57477. maxWeight: params.maxWeight,
  57478. parameter: Util_Util.toJSON(params.parameter),
  57479. event: Util_Util.toJSON(params.event),
  57480. facilities: me.getJson(params.isAnalyzeById, params.facilities)
  57481. };
  57482. me.request({
  57483. method: "GET",
  57484. params: jsonObject,
  57485. scope: me,
  57486. success: me.serviceProcessCompleted,
  57487. failure: me.serviceProcessFailed
  57488. });
  57489. }
  57490. /**
  57491. * @function FindClosestFacilitiesService.prototype.getJson
  57492. * @description 将对象转化为JSON字符串。
  57493. * @param {boolean} isAnalyzeById - 是否通过ID来分析
  57494. * @param {Array.<Object>} params - 分析参数数组
  57495. * @returns {Object} 转化后的JSON字符串。
  57496. */
  57497. getJson(isAnalyzeById, params) {
  57498. var jsonString = "[",
  57499. len = params ? params.length : 0;
  57500. if (isAnalyzeById === false) {
  57501. for (let i = 0; i < len; i++) {
  57502. if (i > 0) {
  57503. jsonString += ",";
  57504. }
  57505. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  57506. }
  57507. } else if (isAnalyzeById === true) {
  57508. for (let i = 0; i < len; i++) {
  57509. if (i > 0) {
  57510. jsonString += ",";
  57511. }
  57512. jsonString += params[i];
  57513. }
  57514. }
  57515. jsonString += ']';
  57516. return jsonString;
  57517. }
  57518. /**
  57519. * @function FindClosestFacilitiesService.prototype.toGeoJSONResult
  57520. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  57521. * @param {Object} result - 服务器返回的结果对象。
  57522. */
  57523. toGeoJSONResult(result) {
  57524. if (!result || !result.facilityPathList) {
  57525. return result;
  57526. }
  57527. var geoJSONFormat = new GeoJSON();
  57528. result.facilityPathList.map(function (path) {
  57529. if (path.route) {
  57530. path.route = geoJSONFormat.toGeoJSON(path.route);
  57531. }
  57532. if (path.pathGuideItems) {
  57533. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  57534. }
  57535. if (path.edgeFeatures) {
  57536. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  57537. }
  57538. if (path.nodeFeatures) {
  57539. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  57540. }
  57541. return path;
  57542. });
  57543. return result;
  57544. }
  57545. }
  57546. ;// CONCATENATED MODULE: ./src/common/iServer/FindLocationParameters.js
  57547. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57548. * This program are made available under the terms of the Apache License, Version 2.0
  57549. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57550. /**
  57551. * @class FindLocationParameters
  57552. * @deprecatedclass SuperMap.FindLocationParameters
  57553. * @category iServer NetworkAnalyst Location
  57554. * @classdesc 选址分区分析参数类。
  57555. * @param {Object} options - 参数。
  57556. * @param {string} options.turnWeightField - 转向权值字段的名称。
  57557. * @param {string} options.weightName - 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
  57558. * @param {Array.<SupplyCenter>} options.supplyCenters - 资源供给中心集合。
  57559. * @param {number} [options.expectedSupplyCenterCount=1] - 期望用于最终设施选址的资源供给中心数量。
  57560. * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分配资源。
  57561. * @usage
  57562. */
  57563. class FindLocationParameters {
  57564. constructor(options) {
  57565. /**
  57566. * @member {number} [FindLocationParameters.prototype.expectedSupplyCenterCount=1]
  57567. * @description 期望用于最终设施选址的资源供给中心数量。
  57568. * 当输入值为 0 时,最终设施选址的资源供给中心数量默认为覆盖分析区域内的所需最少的供给中心数。
  57569. */
  57570. this.expectedSupplyCenterCount = null;
  57571. /**
  57572. * @member {boolean} [FindLocationParameters.prototype.isFromCenter=false]
  57573. * @description 是否从中心点开始分配资源。
  57574. * 由于网路数据中的弧段具有正反阻力,即弧段的正向阻力值与其反向阻力值可能不同,
  57575. * 因此,在进行分析时,从资源供给中心开始分配资源到需求点与从需求点向资源供给中心分配这两种分配形式下,所得的分析结果会不同。
  57576. */
  57577. this.isFromCenter = false;
  57578. /**
  57579. * @member {Array.<SupplyCenter>} FindLocationParameters.prototype.supplyCenters
  57580. * @description 资源供给中心集合。
  57581. * 资源供给中心是提供资源和服务的设施,对应于网络结点,
  57582. * 资源供给中心的相关信息包括资源量、最大阻力值、资源供给中心类型,资源供给中心在网络中所处结点的 ID 等,以便在进行选址分区分析时使用。
  57583. */
  57584. this.supplyCenters = null;
  57585. /**
  57586. * @member {string} FindLocationParameters.prototype.turnWeightField
  57587. * @description 转向权值字段的名称。
  57588. */
  57589. this.turnWeightField = null;
  57590. /**
  57591. * @member {string} FindLocationParameters.prototype.weightName
  57592. * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
  57593. */
  57594. this.weightName = null;
  57595. Util_Util.extend(this, options);
  57596. this.CLASS_NAME = "SuperMap.FindLocationParameters";
  57597. }
  57598. /**
  57599. * @function FindLocationParameters.prototype.destroy
  57600. * @description 释放资源,将引用资源的属性置空。
  57601. */
  57602. destroy() {
  57603. var me = this;
  57604. me.expectedSupplyCenterCount = null;
  57605. me.isFromCenter = null;
  57606. me.turnWeightField = null;
  57607. me.weightName = null;
  57608. if (me.supplyCenters) {
  57609. for (var i = 0, supplyCenters = me.supplyCenters, len = supplyCenters.length; i < len; i++) {
  57610. supplyCenters[i].destroy();
  57611. }
  57612. me.supplyCenters = null;
  57613. }
  57614. }
  57615. }
  57616. ;// CONCATENATED MODULE: ./src/common/iServer/FindLocationService.js
  57617. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57618. * This program are made available under the terms of the Apache License, Version 2.0
  57619. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57620. /**
  57621. * @class FindLocationService
  57622. * @deprecatedclass SuperMap.FindLocationService
  57623. * @category iServer NetworkAnalyst Location
  57624. * @classdesc 选址分区分析服务类。
  57625. * 选址分区分析是为了确定一个或多个待建设施的最佳或最优位置,使得设施可以用一种最经济有效的方式为需求方提供服务或者商品。
  57626. * 选址分区不仅仅是一个选址过程,还要将需求点的需求分配到相应的新建设施的服务区中,因此称之为选址与分区。
  57627. * 选址分区分析结果通过该类支持的事件的监听函数参数获取
  57628. * @extends {NetworkAnalystServiceBase}
  57629. * @example
  57630. * (start code)
  57631. * var findLocationService = new FindLocationService(url, {
  57632. * eventListeners: {
  57633. * "processCompleted": findLocationCompleted,
  57634. * "processFailed": findLocationError
  57635. * }
  57636. * });
  57637. * (end)
  57638. * @param {string} url - 服务地址。
  57639. * 如 http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  57640. * @param {Object} options - 参数。
  57641. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  57642. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  57643. * @param {Object} [options.headers] - 请求头。
  57644. * @usage
  57645. */
  57646. class FindLocationService extends NetworkAnalystServiceBase {
  57647. constructor(url, options) {
  57648. super(url, options);
  57649. this.CLASS_NAME = "SuperMap.FindLocationService";
  57650. }
  57651. /**
  57652. * @function FindLocationService.prototype.destroy
  57653. * @override
  57654. */
  57655. destroy() {
  57656. super.destroy();
  57657. }
  57658. /**
  57659. * @function FindLocationService.prototype.processAsync
  57660. * @description 负责将客户端的查询参数传递到服务端。
  57661. * @param {FindLocationParameters} params - 选址分区分析服务参数类
  57662. */
  57663. processAsync(params) {
  57664. if (!(params instanceof FindLocationParameters)) {
  57665. return;
  57666. }
  57667. var me = this,
  57668. jsonObject;
  57669. me.url = Util_Util.urlPathAppend(me.url, 'location');
  57670. jsonObject = {
  57671. isFromCenter: params.isFromCenter,
  57672. expectedSupplyCenterCount: params.expectedSupplyCenterCount,
  57673. weightName: params.weightName,
  57674. turnWeightField: params.turnWeightField,
  57675. returnEdgeFeature: true,
  57676. returnEdgeGeometry: true,
  57677. returnNodeFeature: true,
  57678. mapParameter: Util_Util.toJSON(params.mapParameter),
  57679. supplyCenters: me.getCentersJson(params.supplyCenters)
  57680. };
  57681. me.request({
  57682. method: "GET",
  57683. params: jsonObject,
  57684. scope: me,
  57685. success: me.serviceProcessCompleted,
  57686. failure: me.serviceProcessFailed
  57687. });
  57688. }
  57689. /**
  57690. * @function FindLocationService.prototype.getCentersJson
  57691. * @description 将数组对象转化为JSON字符串。
  57692. * @param {Array} params - 需要转换的参数
  57693. * @returns {string} 转化后的JSON字符串。
  57694. */
  57695. getCentersJson(params) {
  57696. var json = "[",
  57697. len = params ? params.length : 0;
  57698. for (var i = 0; i < len; i++) {
  57699. if (i > 0) {
  57700. json += ",";
  57701. }
  57702. json += Util_Util.toJSON(params[i]);
  57703. }
  57704. json += "]";
  57705. return json;
  57706. }
  57707. /**
  57708. * @function FindLocationService.prototype.toGeoJSONResult
  57709. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  57710. * @param {Object} result - 服务器返回的结果对象。
  57711. */
  57712. toGeoJSONResult(result) {
  57713. if (!result) {
  57714. return null;
  57715. }
  57716. var geoJSONFormat = new GeoJSON();
  57717. if (result.demandResults) {
  57718. result.demandResults = geoJSONFormat.toGeoJSON(result.demandResults);
  57719. }
  57720. if (result.supplyResults) {
  57721. result.supplyResults = geoJSONFormat.toGeoJSON(result.supplyResults);
  57722. }
  57723. return result;
  57724. }
  57725. }
  57726. ;// CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsParameters.js
  57727. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57728. * This program are made available under the terms of the Apache License, Version 2.0
  57729. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57730. /**
  57731. * @class FindMTSPPathsParameters
  57732. * @deprecatedclass SuperMap.FindMTSPPathsParameters
  57733. * @category iServer NetworkAnalyst MTSPPath
  57734. * @classdesc 多旅行商分析参数类。
  57735. * @param {Object} options - 参数。
  57736. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.centers - 配送中心集合。
  57737. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.nodes - 配送目标集合。
  57738. * @param {boolean} [options.hasLeastTotalCost=false] - 配送模式是否为总花费最小方案。
  57739. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
  57740. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  57741. * @usage
  57742. */
  57743. class FindMTSPPathsParameters {
  57744. constructor(options) {
  57745. /**
  57746. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindMTSPPathsParameters.prototype.centers
  57747. * @description 配送中心集合。
  57748. * 当 FindMTSPPathsParameters.isAnalyzeById = false 时,centers 应为点的坐标数组;
  57749. * 当 FindMTSPPathsParameters.isAnalyzeById = true 时,centers 应为点的 ID 数组。
  57750. */
  57751. this.centers = null;
  57752. /**
  57753. * @member {boolean} [FindMTSPPathsParameters.prototype.hasLeastTotalCost=false]
  57754. * @description 配送模式是否为总花费最小方案。
  57755. * 若为 true,则按照总花费最小的模式进行配送,此时可能会出现某几个配送中心点配送的花费较多而其他配送中心点的花费很少的情况。
  57756. * 若为 false,则为局部最优,此方案会控制每个配送中心点的花费,使各个中心点花费相对平均,此时总花费不一定最小。
  57757. */
  57758. this.hasLeastTotalCost = false;
  57759. /**
  57760. * @member {boolean} [FindMTSPPathsParameters.prototype.isAnalyzeById=false]
  57761. * @description 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
  57762. */
  57763. this.isAnalyzeById = false;
  57764. /**
  57765. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindMTSPPathsParameters.prototype.nodes
  57766. * @description 配送目标集合。
  57767. * 当 FindMTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  57768. * 当 FindMTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  57769. */
  57770. this.nodes = null;
  57771. /**
  57772. * @member {TransportationAnalystParameter} [FindMTSPPathsParameters.prototype.parameter]
  57773. * @description 交通网络分析通用参数。
  57774. * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  57775. * TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting 字段,则返回结果空间信息等都为空。
  57776. */
  57777. this.parameter = new TransportationAnalystParameter();
  57778. Util_Util.extend(this, options);
  57779. this.CLASS_NAME = "SuperMap.FindMTSPPathsParameters";
  57780. }
  57781. /**
  57782. * @function FindMTSPPathsParameters.prototype.destroy
  57783. * @description 释放资源,将引用资源的属性置空。
  57784. */
  57785. destroy() {
  57786. var me = this;
  57787. me.centers = null;
  57788. me.hasLeastTotalCost = null;
  57789. me.isAnalyzeById = null;
  57790. me.nodes = null;
  57791. me.maxWeight = null;
  57792. if (me.parameter) {
  57793. me.parameter.destroy();
  57794. me.parameter = null;
  57795. }
  57796. }
  57797. }
  57798. ;// CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsService.js
  57799. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57800. * This program are made available under the terms of the Apache License, Version 2.0
  57801. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57802. /**
  57803. * @class FindMTSPPathsService
  57804. * @deprecatedclass SuperMap.FindMTSPPathsService
  57805. * @category iServer NetworkAnalyst MTSPPath
  57806. * @classdesc 多旅行商分析服务类
  57807. * 多旅行商分析也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。
  57808. * 查找经济有效的配送路径,并给出相应的行走路线。
  57809. * 物流配送功能就是解决如何合理分配配送次序和送货路线,使配送总花费达到最小或每个配送中心的花费达到最小。
  57810. * 该类负责将客户端指定的多旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
  57811. * 多旅行商分析结果通过该类支持的事件的监听函数参数获取。
  57812. * @extends {NetworkAnalystServiceBase}
  57813. * @example
  57814. * var myFindMTSPPathsService = new FindMTSPPathsService(url, {
  57815. * eventListeners: {
  57816. * "processCompleted": findMTSPPathsCompleted,
  57817. * "processFailed": findMTSPPathsError
  57818. * }
  57819. * });
  57820. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  57821. * http://{服务器地址}:{服务端口号}/iserver/services/网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  57822. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  57823. * @param {Object} options - 互服务时所需可选参数。如:
  57824. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  57825. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  57826. * @param {Object} [options.headers] - 请求头。
  57827. * @usage
  57828. */
  57829. class FindMTSPPathsService extends NetworkAnalystServiceBase {
  57830. constructor(url, options) {
  57831. super(url, options);
  57832. this.CLASS_NAME = "SuperMap.FindMTSPPathsService";
  57833. }
  57834. /**
  57835. * @function FindMTSPPathsService.prototype.destroy
  57836. * @override
  57837. */
  57838. destroy() {
  57839. super.destroy();
  57840. }
  57841. /**
  57842. * @function FindMTSPPathsService..prototype.processAsync
  57843. * @description 负责将客户端的查询参数传递到服务端。
  57844. * @param {FindMTSPPathsParameters} params - 多旅行商分析服务参数类
  57845. */
  57846. processAsync(params) {
  57847. if (!(params instanceof FindMTSPPathsParameters)) {
  57848. return;
  57849. }
  57850. var me = this,
  57851. jsonObject,
  57852. //end = me.url.substr(me.url.length - 1, 1),
  57853. centers = me.getJson(params.isAnalyzeById, params.centers),
  57854. nodes = me.getJson(params.isAnalyzeById, params.nodes);
  57855. me.url = Util_Util.urlPathAppend(me.url, 'mtsppath');
  57856. jsonObject = {
  57857. centers: centers,
  57858. nodes: nodes,
  57859. parameter: Util_Util.toJSON(params.parameter),
  57860. hasLeastTotalCost: params.hasLeastTotalCost
  57861. };
  57862. me.request({
  57863. method: "GET",
  57864. params: jsonObject,
  57865. scope: me,
  57866. success: me.serviceProcessCompleted,
  57867. failure: me.serviceProcessFailed
  57868. });
  57869. }
  57870. /**
  57871. * @function FindMTSPPathsService.prototype.getJson
  57872. * @description 将对象转化为JSON字符串。
  57873. * @param {boolean} isAnalyzeById - 是否通过id分析
  57874. * @param {Array} params - 需要转换的数字
  57875. * @returns {Object} 转化后的JSON字符串。
  57876. */
  57877. getJson(isAnalyzeById, params) {
  57878. var jsonString = "[",
  57879. len = params ? params.length : 0;
  57880. if (isAnalyzeById === false) {
  57881. for (let i = 0; i < len; i++) {
  57882. if (i > 0) {
  57883. jsonString += ",";
  57884. }
  57885. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  57886. }
  57887. } else if (isAnalyzeById === true) {
  57888. for (let i = 0; i < len; i++) {
  57889. if (i > 0) {
  57890. jsonString += ",";
  57891. }
  57892. jsonString += params[i];
  57893. }
  57894. }
  57895. jsonString += ']';
  57896. return jsonString;
  57897. }
  57898. /**
  57899. * @function FindMTSPPathsService.prototype.toGeoJSONResult
  57900. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  57901. * @param {Object} result - 服务器返回的结果对象。
  57902. */
  57903. toGeoJSONResult(result) {
  57904. if (!result || !result.pathList) {
  57905. return null;
  57906. }
  57907. var geoJSONFormat = new GeoJSON();
  57908. result.pathList.map(function (path) {
  57909. if (path.route) {
  57910. path.route = geoJSONFormat.toGeoJSON(path.route);
  57911. }
  57912. if (path.pathGuideItems) {
  57913. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  57914. }
  57915. if (path.edgeFeatures) {
  57916. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  57917. }
  57918. if (path.nodeFeatures) {
  57919. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  57920. }
  57921. return path;
  57922. });
  57923. return result;
  57924. }
  57925. }
  57926. ;// CONCATENATED MODULE: ./src/common/iServer/FindPathParameters.js
  57927. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57928. * This program are made available under the terms of the Apache License, Version 2.0
  57929. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57930. /**
  57931. * @class FindPathParameters
  57932. * @deprecatedclass SuperMap.FindPathParameters
  57933. * @category iServer NetworkAnalyst Path
  57934. * @classdesc 最佳路径分析参数类。最佳路径是在网络数据集中指定一些结点,按照顺序访问结点从而求解起止点之间阻抗最小的路径。
  57935. * 例如如果要顺序访问 1、2、3、4 四个结点,则需要分别找到1、2结点间的最佳路径 R1—2,2、3 间的最佳路径 R2—3 和 3、4 结点间的最佳路径 R3—4,
  57936. * 顺序访问 1、2、3、4 四个结点的最佳路径就是 R = R1—2 + R2—3 + R3—4。
  57937. * 阻抗就是指从一点到另一点的耗费,在实际应用中我们可以将距离、时间、花费等作为阻抗条件。
  57938. * 阻抗最小也就可以理解为从一点到另一点距离最短、时间最少、花费最低等。当两点间距离最短时为最短路径,它是最佳路径问题的一个特例。
  57939. * 阻抗值通过 {@link TransportationAnalystParameter#weightFieldName}设置。
  57940. * 计算最佳路径除了受阻抗影响外,还受转向字段的影响。转向值通过 {@link TransportationAnalystParameter#turnWeightField} 设置。
  57941. *
  57942. * @param {Object} options - 参数。
  57943. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.nodes - 最佳路径分析经过的结点或设施点数组。该字段至少包含两个点。
  57944. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  57945. * @param {boolean} [options.hasLeastEdgeCount=false] - 是否按照弧段数最少的进行最佳路径分析。
  57946. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  57947. * @usage
  57948. */
  57949. class FindPathParameters {
  57950. constructor(options) {
  57951. /**
  57952. * @member {boolean} [FindPathParameters.prototype.isAnalyzeById=false]
  57953. * @description 是否通过节点 ID 指定路径分析的结点。
  57954. * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
  57955. * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 FindPathParameters.nodes = [ID1,ID2,...];
  57956. * 反之表示通过结点坐标指定途经点,即 FindPathParameters.nodes = [{x1,y1},{x2,y2},...] 。
  57957. */
  57958. this.isAnalyzeById = false;
  57959. /**
  57960. * @member {boolean} [FindPathParameters.prototype.hasLeastEdgeCount=false]
  57961. * @description 是否按照弧段数最少的进行最佳路径分析。
  57962. * true 表示按照弧段数最少进行分析,返回弧段数最少的路径中一个阻抗最小的最佳路径;
  57963. * false 表示直接返回阻抗最小的路径,而不考虑弧段的多少。
  57964. */
  57965. this.hasLeastEdgeCount = null;
  57966. /**
  57967. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindPathParameters.prototype.nodes
  57968. * @description 最佳路径分析经过的结点或设施点数组,必设字段。该字段至少包含两个点。
  57969. * 当 FindPathParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  57970. * 当 FindPathParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  57971. */
  57972. this.nodes = null;
  57973. /**
  57974. * @member {TransportationAnalystParameter} FindPathParameters.prototype.parameter
  57975. * @description 交通网络分析通用参数。
  57976. */
  57977. this.parameter = new TransportationAnalystParameter();
  57978. Util_Util.extend(this, options);
  57979. this.CLASS_NAME = "SuperMap.FindPathParameters";
  57980. }
  57981. /**
  57982. * @function FindPathParameters.prototype.destroy
  57983. * @description 释放资源,将引用资源的属性置空。
  57984. */
  57985. destroy() {
  57986. var me = this;
  57987. me.isAnalyzeById = null;
  57988. me.hasLeastEdgeCount = null;
  57989. me.nodes = null;
  57990. if (me.parameter) {
  57991. me.parameter.destroy();
  57992. me.parameter = null;
  57993. }
  57994. }
  57995. }
  57996. ;// CONCATENATED MODULE: ./src/common/iServer/FindPathService.js
  57997. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57998. * This program are made available under the terms of the Apache License, Version 2.0
  57999. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58000. /**
  58001. * @class FindPathService
  58002. * @deprecatedclass SuperMap.FindPathService
  58003. * @category iServer NetworkAnalyst Path
  58004. * @classdesc 最佳路径分析服务类。
  58005. * 最佳路径是在网络数据集中指定一些节点,按照节点的选择顺序,
  58006. * 顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  58007. * 该类负责将客户端指定的最佳路径分析参数传递给服务端,并接收服务端返回的结果数据。
  58008. * 最佳路径分析结果通过该类支持的事件的监听函数参数获取
  58009. * @extends {NetworkAnalystServiceBase}
  58010. * @example
  58011. * var myFindPathService = new FindPathService(url, {
  58012. * eventListeners: {
  58013. * "processCompleted": findPathCompleted,
  58014. * "processFailed": findPathError
  58015. * }
  58016. * });
  58017. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  58018. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  58019. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  58020. * @param {Object} options - 参数。
  58021. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  58022. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  58023. * @param {Object} [options.headers] - 请求头。
  58024. * @usage
  58025. */
  58026. class FindPathService extends NetworkAnalystServiceBase {
  58027. constructor(url, options) {
  58028. super(url, options);
  58029. this.CLASS_NAME = "SuperMap.FindPathService";
  58030. }
  58031. /**
  58032. * @function FindPathService.prototype.destroy
  58033. * @override
  58034. */
  58035. destroy() {
  58036. super.destroy();
  58037. }
  58038. /**
  58039. * @function FindPathService.prototype.processAsync
  58040. * @description 负责将客户端的查询参数传递到服务端。
  58041. * @param {FindPathParameters} params - 最佳路径分析服务参数类
  58042. */
  58043. processAsync(params) {
  58044. if (!(params instanceof FindPathParameters)) {
  58045. return;
  58046. }
  58047. var me = this, jsonObject;
  58048. me.url = Util_Util.urlPathAppend(me.url, 'path');
  58049. jsonObject = {
  58050. hasLeastEdgeCount: params.hasLeastEdgeCount,
  58051. parameter: Util_Util.toJSON(params.parameter),
  58052. nodes: me.getJson(params.isAnalyzeById, params.nodes)
  58053. };
  58054. me.request({
  58055. method: "GET",
  58056. params: jsonObject,
  58057. scope: me,
  58058. success: me.serviceProcessCompleted,
  58059. failure: me.serviceProcessFailed
  58060. });
  58061. }
  58062. /**
  58063. * @function FindPathService.prototype.getJson
  58064. * @description 将对象转化为JSON字符串。
  58065. * @param {boolean} isAnalyzeById - 是否通过id分析
  58066. * @param {Array} params - 需要转换的数字
  58067. * @returns {Object} 转化后的JSON字符串。
  58068. */
  58069. getJson(isAnalyzeById, params) {
  58070. var jsonString = "[",
  58071. len = params ? params.length : 0;
  58072. if (isAnalyzeById === false) {
  58073. for (let i = 0; i < len; i++) {
  58074. if (i > 0) {
  58075. jsonString += ",";
  58076. }
  58077. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  58078. }
  58079. } else if (isAnalyzeById === true) {
  58080. for (let i = 0; i < len; i++) {
  58081. if (i > 0) {
  58082. jsonString += ",";
  58083. }
  58084. jsonString += params[i];
  58085. }
  58086. }
  58087. jsonString += ']';
  58088. return jsonString;
  58089. }
  58090. /**
  58091. * @function FindMTSPPathsService.prototype.toGeoJSONResult
  58092. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  58093. * @param {Object} result - 服务器返回的结果对象。
  58094. */
  58095. toGeoJSONResult(result) {
  58096. if (!result || !result.pathList || result.pathList.length < 1) {
  58097. return null;
  58098. }
  58099. var geoJSONFormat = new GeoJSON();
  58100. result.pathList.forEach(function (path) {
  58101. if (path.route) {
  58102. path.route = geoJSONFormat.toGeoJSON(path.route);
  58103. }
  58104. if (path.pathGuideItems) {
  58105. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  58106. }
  58107. if (path.edgeFeatures) {
  58108. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  58109. }
  58110. if (path.nodeFeatures) {
  58111. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  58112. }
  58113. });
  58114. return result;
  58115. }
  58116. }
  58117. ;// CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasParameters.js
  58118. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58119. * This program are made available under the terms of the Apache License, Version 2.0
  58120. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58121. /**
  58122. * @class FindServiceAreasParameters
  58123. * @deprecatedclass SuperMap.FindServiceAreasParameters
  58124. * @category iServer NetworkAnalyst ServiceArea
  58125. * @classdesc 服务区分析参数类。
  58126. * 服务区分析是以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  58127. * 例如:计算某快餐店能够在30分钟内送达快餐的区域。
  58128. * @param {Object} options - 参数。
  58129. * @param {Array.<number>} options.weights - 每个服务站点提供服务的阻力半径,超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
  58130. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.centers - 服务站点数组。
  58131. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  58132. * @param {boolean} [options.isCenterMutuallyExclusive=false] - 是否中心点互斥。
  58133. * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分析。
  58134. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  58135. * @usage
  58136. */
  58137. class FindServiceAreasParameters {
  58138. constructor(options) {
  58139. /**
  58140. * @member {boolean} [FindServiceAreasParameters.prototype.isAnalyzeById=false]
  58141. * @description 是否通过节点 ID 指定路径分析的结点。
  58142. * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
  58143. * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 FindServiceAreasParameters.centers = [ID1,ID2,...];
  58144. * 反之表示通过结点坐标指定途经点,即 FindServiceAreasParameters.centers = [{x1,y1},{x2,y2},...]。
  58145. */
  58146. this.isAnalyzeById = false;
  58147. /**
  58148. * @member {boolean} [FindServiceAreasParameters.prototype.isCenterMutuallyExclusive=false]
  58149. * @description 是否中心点互斥,即按照中心点的距离进行判断是否要进行互斥处理。
  58150. * 若分析出的服务区有重叠的部分,则通过设置该参数进行互斥处理。
  58151. */
  58152. this.isCenterMutuallyExclusive = false;
  58153. /**
  58154. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindServiceAreasParameters.prototype.centers
  58155. * @description 服务站点数组。
  58156. * 当该类的 iSAnalyzeById = true 时,通过结点 ID 号指定服务站点;当 iSAnalyzeById = false 时,通过点坐标指定服务站点。
  58157. */
  58158. this.centers = null;
  58159. /**
  58160. * @member {boolean} [FindServiceAreasParameters.prototype.isFromCenter=false]
  58161. * @description 是否从中心点开始分析。
  58162. * 从中心点开始分析和不从中心点开始分析,体现了服务中心和需要该服务的需求地的关系模式。
  58163. * 从中心点开始分析,是一个服务中心向服务需求地提供服务;
  58164. * 而不从中心点开始分析,是一个服务需求地主动到服务中心获得服务。
  58165. */
  58166. this.isFromCenter = false;
  58167. /**
  58168. * APIProperty: weights
  58169. * @member {Array.<number>} FindServiceAreasParameters.prototype.weights
  58170. * @description 每个服务站点提供服务的阻力半径,即超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
  58171. * 该字段为一个数组,数组长度跟服务中心个数一致,按照索引顺序与站点一一对应,每个元素表示了在对每个服务中心进行服务区分析时,所用的服务半径。
  58172. */
  58173. this.weights = null;
  58174. /**
  58175. * @member {TransportationAnalystParameter} FindServiceAreasParameters.prototype.parameter
  58176. * @description 交通网络分析通用参数。
  58177. */
  58178. this.parameter = new TransportationAnalystParameter();
  58179. Util_Util.extend(this, options);
  58180. this.CLASS_NAME = "SuperMap.FindServiceAreasParameters";
  58181. }
  58182. /**
  58183. * @function FindServiceAreasParameters.prototype.destroy
  58184. * @description 释放资源,将引用资源的属性置空。
  58185. */
  58186. destroy() {
  58187. var me = this;
  58188. me.isAnalyzeById = null;
  58189. me.isCenterMutuallyExclusive = null;
  58190. me.centers = null;
  58191. me.isFromCenter = null;
  58192. me.weights = null;
  58193. if (me.parameter) {
  58194. me.parameter.destroy();
  58195. me.parameter = null;
  58196. }
  58197. }
  58198. }
  58199. ;// CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasService.js
  58200. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58201. * This program are made available under the terms of the Apache License, Version 2.0
  58202. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58203. /**
  58204. * @class FindServiceAreasService
  58205. * @deprecatedclass SuperMap.FindServiceAreasService
  58206. * @category iServer NetworkAnalyst ServiceArea
  58207. * @classdesc 服务区分析服务类。
  58208. * 服务区分析是以指定服务站点为中心,
  58209. * 在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  58210. * 该类负责将客户端指定的服务区分析参数传递给服务端,并接收服务端返回的结果数据。
  58211. * 服务区分析结果通过该类支持的事件的监听函数参数获取
  58212. * @extends {NetworkAnalystServiceBase}
  58213. * @example
  58214. * var myFindServiceAreasService = new FindServiceAreasService(url, {
  58215. * eventListeners: {
  58216. * "processCompleted": findServiceAreasCompleted,
  58217. * "processFailed": findServiceAreasError
  58218. * }
  58219. * });
  58220. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  58221. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  58222. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  58223. * @param {Object} options - 互服务时所需可选参数。如:
  58224. * @param {Object} options.eventListeners - 需要被注册的监听器对象
  58225. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  58226. * @param {Object} [options.headers] - 请求头。
  58227. * @usage
  58228. */
  58229. class FindServiceAreasService extends NetworkAnalystServiceBase {
  58230. constructor(url, options) {
  58231. super(url, options);
  58232. this.CLASS_NAME = "SuperMap.FindServiceAreasService";
  58233. }
  58234. /**
  58235. * @function FindServiceAreasService.prototype.destroy
  58236. * @override
  58237. */
  58238. destroy() {
  58239. super.destroy();
  58240. }
  58241. /**
  58242. * @function FindServiceAreasService.prototype.processAsync
  58243. * @description 负责将客户端的查询参数传递到服务端。
  58244. * @param {FindServiceAreasParameters} params - 服务区分析服务参数类
  58245. */
  58246. processAsync(params) {
  58247. if (!(params instanceof FindServiceAreasParameters)) {
  58248. return;
  58249. }
  58250. var me = this, jsonObject;
  58251. me.url = Util_Util.urlPathAppend(me.url, 'servicearea');
  58252. jsonObject = {
  58253. isFromCenter: params.isFromCenter,
  58254. isCenterMutuallyExclusive: params.isCenterMutuallyExclusive,
  58255. parameter: Util_Util.toJSON(params.parameter),
  58256. centers: me.getJson(params.isAnalyzeById, params.centers),
  58257. weights: me.getJson(true, params.weights)
  58258. };
  58259. me.request({
  58260. method: "GET",
  58261. params: jsonObject,
  58262. scope: me,
  58263. success: me.serviceProcessCompleted,
  58264. failure: me.serviceProcessFailed
  58265. });
  58266. }
  58267. /**
  58268. * @function FindServiceAreasService.prototype.getJson
  58269. * @description 将对象转化为JSON字符串。
  58270. * @param {boolean} isAnalyzeById - 是否通过id分析
  58271. * @param {Array} params - 需要转换的数字
  58272. * @returns {Object} 转化后的JSON字符串。
  58273. */
  58274. getJson(isAnalyzeById, params) {
  58275. var jsonString = "[",
  58276. len = params ? params.length : 0;
  58277. if (isAnalyzeById === false) {
  58278. for (let i = 0; i < len; i++) {
  58279. if (i > 0) {
  58280. jsonString += ",";
  58281. }
  58282. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  58283. }
  58284. } else if (isAnalyzeById === true) {
  58285. for (let i = 0; i < len; i++) {
  58286. if (i > 0) {
  58287. jsonString += ",";
  58288. }
  58289. jsonString += params[i];
  58290. }
  58291. }
  58292. jsonString += ']';
  58293. return jsonString;
  58294. }
  58295. /**
  58296. * @function FindServiceAreasService.prototype.toGeoJSONResult
  58297. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  58298. * @param {Object} result - 服务器返回的结果对象。
  58299. */
  58300. toGeoJSONResult(result) {
  58301. if (!result || !result.serviceAreaList) {
  58302. return result;
  58303. }
  58304. var geoJSONFormat = new GeoJSON();
  58305. result.serviceAreaList.map(function (serviceArea) {
  58306. if (serviceArea.serviceRegion) {
  58307. serviceArea.serviceRegion = geoJSONFormat.toGeoJSON(serviceArea.serviceRegion);
  58308. }
  58309. if (serviceArea.edgeFeatures) {
  58310. serviceArea.edgeFeatures = geoJSONFormat.toGeoJSON(serviceArea.edgeFeatures);
  58311. }
  58312. if (serviceArea.nodeFeatures) {
  58313. serviceArea.nodeFeatures = geoJSONFormat.toGeoJSON(serviceArea.nodeFeatures);
  58314. }
  58315. if (serviceArea.routes) {
  58316. serviceArea.routes = geoJSONFormat.toGeoJSON(serviceArea.routes);
  58317. }
  58318. return serviceArea;
  58319. });
  58320. return result;
  58321. }
  58322. }
  58323. ;// CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsParameters.js
  58324. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58325. * This program are made available under the terms of the Apache License, Version 2.0
  58326. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58327. /**
  58328. * @class FindTSPPathsParameters
  58329. * @deprecatedclass SuperMap.FindTSPPathsParameters
  58330. * @category iServer NetworkAnalyst TSPPath
  58331. * @classdesc 旅行商分析参数类。
  58332. * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  58333. * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
  58334. * 旅行商分析和最佳路径分析都是在网络中寻找遍历所有站点的最经济的路径,区别是在遍历网络所有站点的过程中对结点访问顺序不同。
  58335. * 最佳路径分析必须按照指定顺序对站点进行访问,而旅行商分析是无序的路径分析。
  58336. * @param {Object} options - 参数。
  58337. * @param {boolean} [options.endNodeAssigned=false] - 是否指定终止点,将指定的途经点的最后一个点作为终止点。true 表示指定终止点,则旅行商必须最后一个访问终止点。
  58338. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点。
  58339. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.nodes - 配送目标集合。
  58340. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  58341. * @usage
  58342. */
  58343. class FindTSPPathsParameters {
  58344. constructor(options) {
  58345. /**
  58346. * @member {boolean} [FindTSPPathsParameters.prototype.endNodeAssigned=false]
  58347. * @description 是否指定终止点,将指定的途经点的最后一个点作为终止点。
  58348. * true 表示指定终止点,则旅行商必须最后一个访问终止点。
  58349. */
  58350. this.endNodeAssigned = false;
  58351. /**
  58352. * @member {boolean} [FindTSPPathsParameters.prototype.isAnalyzeById=false]
  58353. * @description 是否通过节点 ID 号来指定途经点。
  58354. */
  58355. this.isAnalyzeById = false;
  58356. /**
  58357. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindTSPPathsParameters.prototype.nodes
  58358. * @description 旅行商分析途经点数组。
  58359. * 当 FindTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  58360. * 当 FindTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  58361. */
  58362. this.nodes = null;
  58363. /**
  58364. * @member {TransportationAnalystParameter} [FindTSPPathsParameters.prototype.parameter]
  58365. * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  58366. * TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting
  58367. * 字段,则返回结果空间信息等都为空。
  58368. */
  58369. this.parameter = new TransportationAnalystParameter();
  58370. Util_Util.extend(this, options);
  58371. this.CLASS_NAME = "SuperMap.FindTSPPathsParameters";
  58372. }
  58373. /**
  58374. * @function FindTSPPathsParameters.prototype.destroy
  58375. * @description 释放资源,将引用资源的属性置空。
  58376. */
  58377. destroy() {
  58378. var me = this;
  58379. me.endNodeAssigned = null;
  58380. me.isAnalyzeById = null;
  58381. me.nodes = null;
  58382. if (me.parameter) {
  58383. me.parameter.destroy();
  58384. me.parameter = null;
  58385. }
  58386. }
  58387. }
  58388. ;// CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsService.js
  58389. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58390. * This program are made available under the terms of the Apache License, Version 2.0
  58391. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58392. /**
  58393. * @class FindTSPPathsService
  58394. * @deprecatedclass SuperMap.FindTSPPathsService
  58395. * @category iServer NetworkAnalyst TSPPath
  58396. * @classdesc 旅行商分析服务类
  58397. * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  58398. * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
  58399. * 该类负责将客户端指定的旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
  58400. * 旅行商分析结果通过该类支持的事件的监听函数参数获取
  58401. * @extends {NetworkAnalystServiceBase}
  58402. * @example
  58403. * (start code)
  58404. * var myFindTSPPathsService = new FindTSPPathsService(url, {
  58405. * eventListeners: {
  58406. * "processCompleted": findTSPPathsCompleted,
  58407. * "processFailed": findTSPPathsError
  58408. * }
  58409. * });
  58410. * (end)
  58411. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  58412. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  58413. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  58414. * @param {Object} options - 参数。
  58415. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  58416. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  58417. * @param {Object} [options.headers] - 请求头。
  58418. * @usage
  58419. */
  58420. class FindTSPPathsService extends NetworkAnalystServiceBase {
  58421. constructor(url, options) {
  58422. super(url, options);
  58423. this.CLASS_NAME = "SuperMap.FindTSPPathsService";
  58424. }
  58425. /**
  58426. * @function FindTSPPathsService.prototype.destroy
  58427. * @override
  58428. */
  58429. destroy() {
  58430. super.destroy();
  58431. }
  58432. /**
  58433. * @function FindTSPPathsService.prototype.processAsync
  58434. * @description 负责将客户端的查询参数传递到服务端。
  58435. * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
  58436. */
  58437. processAsync(params) {
  58438. if (!(params instanceof FindTSPPathsParameters)) {
  58439. return;
  58440. }
  58441. var me = this, jsonObject;
  58442. me.url = Util_Util.urlPathAppend(me.url, 'tsppath');
  58443. jsonObject = {
  58444. parameter: Util_Util.toJSON(params.parameter),
  58445. endNodeAssigned: params.endNodeAssigned,
  58446. nodes: me.getNodesJson(params)
  58447. };
  58448. me.request({
  58449. method: "GET",
  58450. params: jsonObject,
  58451. scope: me,
  58452. success: me.serviceProcessCompleted,
  58453. failure: me.serviceProcessFailed
  58454. });
  58455. }
  58456. /**
  58457. * @function FindTSPPathsService.prototype.getNodesJson
  58458. * @description 将节点对象转化为JSON字符串。
  58459. * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
  58460. * @returns {string} 转化后的JSON字符串。
  58461. */
  58462. getNodesJson(params) {
  58463. var jsonParameters = "", nodesString, i, len, nodes;
  58464. if (params.isAnalyzeById === false) {
  58465. for (nodesString = "[", i = 0, nodes = params.nodes, len = nodes.length; i < len; i++) {
  58466. if (i > 0) {
  58467. nodesString += ",";
  58468. }
  58469. nodesString += '{"x":' + nodes[i].x + ',"y":' + nodes[i].y + '}';
  58470. }
  58471. nodesString += ']';
  58472. jsonParameters += nodesString;
  58473. } else if (params.isAnalyzeById === true) {
  58474. let nodeIDsString = "[", nodes = params.nodes, len = nodes.length;
  58475. for (let i = 0; i < len; i++) {
  58476. if (i > 0) {
  58477. nodeIDsString += ",";
  58478. }
  58479. nodeIDsString += nodes[i];
  58480. }
  58481. nodeIDsString += ']';
  58482. jsonParameters += nodeIDsString;
  58483. }
  58484. return jsonParameters;
  58485. }
  58486. /**
  58487. * @function FindTSPPathsService.prototype.toGeoJSONResult
  58488. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  58489. * @param {Object} result - 服务器返回的结果对象。
  58490. */
  58491. toGeoJSONResult(result) {
  58492. if (!result || !result.tspPathList) {
  58493. return null;
  58494. }
  58495. var geoJSONFormat = new GeoJSON();
  58496. result.tspPathList.forEach(function (path) {
  58497. if (path.route) {
  58498. path.route = geoJSONFormat.toGeoJSON(path.route);
  58499. }
  58500. if (path.pathGuideItems) {
  58501. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  58502. }
  58503. if (path.edgeFeatures) {
  58504. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  58505. }
  58506. if (path.nodeFeatures) {
  58507. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  58508. }
  58509. });
  58510. return result;
  58511. }
  58512. }
  58513. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightParameters.js
  58514. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58515. * This program are made available under the terms of the Apache License, Version 2.0
  58516. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58517. /**
  58518. * @class UpdateEdgeWeightParameters
  58519. * @deprecatedclass SuperMap.UpdateEdgeWeightParameters
  58520. * @category iServer NetworkAnalyst EdgeWeight
  58521. * @classdesc 边的耗费权重更新服务参数类。
  58522. * @param {Object} options - 参数。
  58523. * @param {string} options.edgeId - 所在边的 ID。
  58524. * @param {string} options.fromNodeId - 起始转向点的 ID。
  58525. * @param {string} options.toNodeId - 终止转向点的 ID。
  58526. * @param {string} options.weightField - 边的耗费字段。
  58527. * @param {string} options.edgeWeight - 耗费权重。
  58528. * @usage
  58529. */
  58530. class UpdateEdgeWeightParameters {
  58531. constructor(options) {
  58532. if (!options) {
  58533. return;
  58534. }
  58535. /**
  58536. * @member {string} UpdateEdgeWeightParameters.prototype.edgeId
  58537. * @description 所在边的 ID。
  58538. */
  58539. this.edgeId = "";
  58540. /**
  58541. * @member {string} UpdateEdgeWeightParameters.prototype.fromNodeId
  58542. * @description 起始转向点的 ID。
  58543. */
  58544. this.fromNodeId = "";
  58545. /**
  58546. * @member {string} UpdateEdgeWeightParameters.prototype.toNodeId
  58547. * @description 终止转向点的 ID。
  58548. */
  58549. this.toNodeId = "";
  58550. /**
  58551. * @member {string} UpdateEdgeWeightParameters.prototype.weightField
  58552. * @description 边的耗费字段。
  58553. */
  58554. this.weightField = "";
  58555. /**
  58556. * @member {string} UpdateEdgeWeightParameters.prototype.edgeWeight
  58557. * @description 耗费权重。
  58558. */
  58559. this.edgeWeight = "";
  58560. Util_Util.extend(this, options);
  58561. this.CLASS_NAME = "SuperMap.UpdateEdgeWeightParameters";
  58562. }
  58563. /**
  58564. * @function UpdateEdgeWeightParameters.prototype.destroy
  58565. * @description 释放资源,将引用资源的属性置空。
  58566. */
  58567. destroy() {
  58568. this.edgeId = null;
  58569. this.fromNodeId = null;
  58570. this.toNodeId = null;
  58571. this.weightField = null;
  58572. this.edgeWeight = null;
  58573. }
  58574. }
  58575. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightService.js
  58576. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58577. * This program are made available under the terms of the Apache License, Version 2.0
  58578. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58579. /**
  58580. * @class UpdateEdgeWeightService
  58581. * @deprecatedclass SuperMap.UpdateEdgeWeightService
  58582. * @category iServer NetworkAnalyst EdgeWeight
  58583. * @classdesc 更新边的边的耗费权重服务
  58584. * @extends {NetworkAnalystServiceBase}
  58585. * @example
  58586. *(start code)
  58587. * var updateEdgeWeightService = new UpdateEdgeWeightService(url, {
  58588. * eventListeners: {
  58589. * "processCompleted": UpdateEdgeWeightCompleted,
  58590. * "processFailed": UpdateEdgeWeightError
  58591. * }
  58592. * });
  58593. * (end)
  58594. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  58595. * @param {Object} options - 参数。
  58596. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  58597. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  58598. * @param {Object} [options.headers] - 请求头。
  58599. * @usage
  58600. */
  58601. class UpdateEdgeWeightService extends NetworkAnalystServiceBase {
  58602. constructor(url, options) {
  58603. super(url, options);
  58604. this.CLASS_NAME = "SuperMap.UpdateEdgeWeightService";
  58605. }
  58606. /**
  58607. * @override
  58608. */
  58609. destroy() {
  58610. super.destroy();
  58611. }
  58612. /**
  58613. * @function UpdateEdgeWeightService.prototype.processAsync
  58614. * @description 开始异步执行边的边的耗费权重的更新
  58615. * @param {UpdateEdgeWeightParameters} params - 边的耗费权重更新服务参数类
  58616. * @example
  58617. * (code)
  58618. * var updateEdgeWeightParam=new SuperMapUpdateEdgeWeightParameters({
  58619. * edgeId:"20",
  58620. * fromNodeId:"26",
  58621. * toNodeId:"109",
  58622. * weightField:"time",
  58623. * edgeWeight:"25"
  58624. * });
  58625. * updateEdgeWeightService.processAsync(updateEdgeWeightParam);
  58626. * (end)
  58627. */
  58628. processAsync(params) {
  58629. if (!(params instanceof UpdateEdgeWeightParameters)) {
  58630. return;
  58631. }
  58632. var me = this;
  58633. var paramStr = me.parse(params);
  58634. me.url = Util_Util.urlPathAppend(me.url, paramStr);
  58635. var data = params.edgeWeight ? params.edgeWeight : null;
  58636. me.request({
  58637. method: "PUT",
  58638. scope: me,
  58639. data: data,
  58640. success: me.serviceProcessCompleted,
  58641. failure: me.serviceProcessFailed
  58642. });
  58643. }
  58644. /**
  58645. * @function UpdateEdgeWeightService.prototype.parse
  58646. * @description 将更新服务参数解析为用‘/’做分隔的字符串
  58647. */
  58648. parse(params) {
  58649. if (!params) {
  58650. return;
  58651. }
  58652. var paramStr = "";
  58653. for (var attr in params) {
  58654. if (params[attr] === "" || params[attr] === "edgeWeight") {
  58655. continue;
  58656. }
  58657. switch (attr) {
  58658. case "edgeId":
  58659. paramStr += "/edgeweight/" + params[attr];
  58660. break;
  58661. case "fromNodeId":
  58662. paramStr += "/fromnode/" + params[attr];
  58663. break;
  58664. case "toNodeId":
  58665. paramStr += "/tonode/" + params[attr];
  58666. break;
  58667. case "weightField":
  58668. paramStr += "/weightfield/" + params[attr];
  58669. break;
  58670. default :
  58671. break;
  58672. }
  58673. }
  58674. return paramStr;
  58675. }
  58676. }
  58677. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightParameters.js
  58678. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58679. * This program are made available under the terms of the Apache License, Version 2.0
  58680. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58681. /**
  58682. * @class UpdateTurnNodeWeightParameters
  58683. * @deprecatedclass SuperMap.UpdateTurnNodeWeightParameters
  58684. * @category iServer NetworkAnalyst TurnNodeWeight
  58685. * @classdesc 转向耗费权重更新服务参数类。
  58686. * @param {Object} options - 参数。
  58687. * @param {string} options.nodeId - 转向结点的 ID。
  58688. * @param {string} options.fromEdgeId - 起始边的 ID。
  58689. * @param {string} options.toEdgeId - 终止边的 ID。
  58690. * @param {string} options.weightField - 转向结点的耗费字段。
  58691. * @param {string} options.turnNodeWeight - 耗费权重。
  58692. * @usage
  58693. */
  58694. class UpdateTurnNodeWeightParameters {
  58695. constructor(options) {
  58696. if (!options) {
  58697. return;
  58698. }
  58699. /**
  58700. * @member {string} UpdateTurnNodeWeightParameters.prototype.nodeId
  58701. * @description 转向结点的 ID。
  58702. */
  58703. this.nodeId = "";
  58704. /**
  58705. * @member {string} UpdateTurnNodeWeightParameters.prototype.fromEdgeId
  58706. * @description 起始边的 ID。
  58707. */
  58708. this.fromEdgeId = "";
  58709. /**
  58710. * @member {string} UpdateTurnNodeWeightParameters.prototype.toEdgeId
  58711. * @description 终止边的 ID。
  58712. */
  58713. this.toEdgeId = "";
  58714. /**
  58715. * @member {string} UpdateTurnNodeWeightParameters.prototype.weightField
  58716. * @description 转向结点的耗费字段。
  58717. */
  58718. this.weightField = "";
  58719. /**
  58720. * @member {string} UpdateTurnNodeWeightParameters.prototype.turnNodeWeight
  58721. * @description 耗费权重。
  58722. */
  58723. this.turnNodeWeight = "";
  58724. Util_Util.extend(this, options);
  58725. this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightParameters";
  58726. }
  58727. /**
  58728. * @function UpdateTurnNodeWeightParameters.prototype.destroy
  58729. * @description 释放资源,将引用资源的属性置空。
  58730. */
  58731. destroy() {
  58732. this.nodeId = null;
  58733. this.fromEdgeId = null;
  58734. this.toEdgeId = null;
  58735. this.weightField = null;
  58736. this.turnNodeWeight = null;
  58737. }
  58738. }
  58739. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightService.js
  58740. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58741. * This program are made available under the terms of the Apache License, Version 2.0
  58742. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58743. /**
  58744. * @class UpdateTurnNodeWeightService
  58745. * @deprecatedclass SuperMap.UpdateTurnNodeWeightService
  58746. * @category iServer NetworkAnalyst TurnNodeWeight
  58747. * @classdesc 转向耗费权重更新服务类
  58748. * @extends {NetworkAnalystServiceBase}
  58749. * @example
  58750. * var UpdateTurnNodeWeightService = new UpdateTurnNodeWeightService(url, {
  58751. * eventListeners: {
  58752. * "processCompleted": UpdateTurnNodeWeightCompleted,
  58753. * "processFailed": UpdateTurnNodeWeightError
  58754. * }
  58755. * });
  58756. * @param {string} url - 服务地址。如:
  58757. * http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  58758. * @param {Object} options - 参数。
  58759. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  58760. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  58761. * @param {Object} [options.headers] - 请求头。
  58762. * @usage
  58763. */
  58764. class UpdateTurnNodeWeightService extends NetworkAnalystServiceBase {
  58765. constructor(url, options) {
  58766. super(url, options);
  58767. this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightService";
  58768. }
  58769. /**
  58770. * @override
  58771. */
  58772. destroy() {
  58773. super.destroy();
  58774. }
  58775. /**
  58776. * @function UpdateTurnNodeWeightService.prototype.processAsync
  58777. * @description 开始异步执行转向耗费权重的更新
  58778. * @param {UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类
  58779. * @example
  58780. * (code)
  58781. * var updateTurnNodeWeightParam=new UpdateTurnNodeWeightParameters({
  58782. * nodeId:"106",
  58783. * fromEdgeId:"6508",
  58784. * toEdgeId:"6504",
  58785. * weightField:"TurnCost",
  58786. * turnNodeWeight:"50"
  58787. * });
  58788. * updateTurnNodeWeightService.processAsync(updateTurnNodeWeightParam);
  58789. * (end)
  58790. **/
  58791. processAsync(params) {
  58792. if (!(params instanceof UpdateTurnNodeWeightParameters)) {
  58793. return;
  58794. }
  58795. var me = this;
  58796. var paramStr = me.parse(params);
  58797. me.url = Util_Util.urlPathAppend(me.url, paramStr);
  58798. var data = params.turnNodeWeight ? params.turnNodeWeight : null;
  58799. me.request({
  58800. method: "PUT",
  58801. scope: me,
  58802. data: data,
  58803. success: me.serviceProcessCompleted,
  58804. failure: me.serviceProcessFailed
  58805. });
  58806. }
  58807. /**
  58808. * @function UpdateTurnNodeWeightService.prototype.parse
  58809. * @description 将更新服务参数解析为用‘/’做分隔的字符串
  58810. */
  58811. parse(params) {
  58812. if (!params) {
  58813. return;
  58814. }
  58815. var paramStr = "";
  58816. for (var attr in params) {
  58817. if (params[attr] === "" || params[attr] === "turnNodeWeight") {
  58818. continue;
  58819. }
  58820. switch (attr) {
  58821. case "nodeId":
  58822. paramStr += "/turnnodeweight/" + params[attr];
  58823. break;
  58824. case "fromEdgeId":
  58825. paramStr += "/fromedge/" + params[attr];
  58826. break;
  58827. case "toEdgeId":
  58828. paramStr += "/toedge/" + params[attr];
  58829. break;
  58830. case "weightField":
  58831. paramStr += "/weightfield/" + params[attr];
  58832. break;
  58833. default :
  58834. break;
  58835. }
  58836. }
  58837. return paramStr;
  58838. }
  58839. }
  58840. ;// CONCATENATED MODULE: ./src/common/iServer/NetworkAnalystService.js
  58841. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58842. * This program are made available under the terms of the Apache License, Version 2.0
  58843. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58844. /**
  58845. * @class NetworkAnalystService
  58846. * @category iServer NetworkAnalyst
  58847. * @classdesc 网络分析服务类。
  58848. * @extends {ServiceBase}
  58849. * @example
  58850. * new NetworkAnalystService(url)
  58851. * .findPath(params,function(result){
  58852. * //doSomething
  58853. * })
  58854. * @param {string} url - 服务地址。请求网络分析服务,URL应为:</br>
  58855. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源}。
  58856. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  58857. * @param {Object} options - 参数。
  58858. * @param {string} [options.proxy] - 服务代理地址。
  58859. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  58860. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  58861. * @param {Object} [options.headers] - 请求头。
  58862. * @usage
  58863. */
  58864. class NetworkAnalystService_NetworkAnalystService {
  58865. constructor(url, options) {
  58866. this.url = url;
  58867. this.options = options || {};
  58868. }
  58869. /**
  58870. * @function NetworkAnalystService.prototype.burstPipelineAnalyst
  58871. * @description 爆管分析服务:即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组,普通结点 ID 数组及其上下游弧段 ID 数组。
  58872. * @param {BurstPipelineAnalystParameters} params - 爆管分析服务参数类。
  58873. * @param {RequestCallback} callback 回调函数。
  58874. */
  58875. burstPipelineAnalyst(params, callback) {
  58876. var me = this;
  58877. var burstPipelineAnalystService = new BurstPipelineAnalystService(me.url, {
  58878. proxy: me.options.proxy,
  58879. withCredentials: me.options.withCredentials,
  58880. crossOrigin: me.options.crossOrigin,
  58881. headers: me.options.headers,
  58882. eventListeners: {
  58883. scope: me,
  58884. processCompleted: callback,
  58885. processFailed: callback
  58886. }
  58887. });
  58888. burstPipelineAnalystService.processAsync(params);
  58889. }
  58890. /**
  58891. * @function NetworkAnalystService.prototype.computeWeightMatrix
  58892. * @description 耗费矩阵分析服务:根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  58893. * @param {ComputeWeightMatrixParameters} params - 耗费矩阵分析服务参数类。
  58894. * @param {RequestCallback} callback - 回调函数。
  58895. */
  58896. computeWeightMatrix(params, callback) {
  58897. var me = this;
  58898. var computeWeightMatrixService = new ComputeWeightMatrixService(me.url, {
  58899. proxy: me.options.proxy,
  58900. withCredentials: me.options.withCredentials,
  58901. crossOrigin: me.options.crossOrigin,
  58902. headers: me.options.headers,
  58903. eventListeners: {
  58904. scope: me,
  58905. processCompleted: callback,
  58906. processFailed: callback
  58907. }
  58908. });
  58909. computeWeightMatrixService.processAsync(params);
  58910. }
  58911. /**
  58912. * @function NetworkAnalystService.prototype.findClosestFacilities
  58913. * @description 最近设施分析服务:指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  58914. * @param {FindClosestFacilitiesParameters} params - 最近设施分析服务参数类。
  58915. * @param {RequestCallback} callback 回调函数。
  58916. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  58917. */
  58918. findClosestFacilities(params, callback, resultFormat) {
  58919. var me = this;
  58920. var findClosestFacilitiesService = new FindClosestFacilitiesService(me.url, {
  58921. proxy: me.options.proxy,
  58922. withCredentials: me.options.withCredentials,
  58923. crossOrigin: me.options.crossOrigin,
  58924. headers: me.options.headers,
  58925. eventListeners: {
  58926. scope: me,
  58927. processCompleted: callback,
  58928. processFailed: callback
  58929. },
  58930. format: me._processFormat(resultFormat)
  58931. });
  58932. findClosestFacilitiesService.processAsync(params);
  58933. }
  58934. /**
  58935. * @function NetworkAnalystService.prototype.streamFacilityAnalyst
  58936. * @description 上游/下游 关键设施查找资源服务:查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  58937. * @param {FacilityAnalystStreamParameters} params - 上游/下游 关键设施查找资源服务参数类。
  58938. * @param {RequestCallback} callback 回调函数。
  58939. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  58940. */
  58941. streamFacilityAnalyst(params, callback, resultFormat) {
  58942. var me = this;
  58943. var facilityAnalystStreamService = new FacilityAnalystStreamService(me.url, {
  58944. proxy: me.options.proxy,
  58945. withCredentials: me.options.withCredentials,
  58946. crossOrigin: me.options.crossOrigin,
  58947. headers: me.options.headers,
  58948. eventListeners: {
  58949. scope: me,
  58950. processCompleted: callback,
  58951. processFailed: callback
  58952. },
  58953. format: me._processFormat(resultFormat)
  58954. });
  58955. facilityAnalystStreamService.processAsync(params);
  58956. }
  58957. /**
  58958. * @function NetworkAnalystService.prototype.findLocation
  58959. * @description 选址分区分析服务:确定一个或多个待建设施的最佳或最优位置。
  58960. * @param {FindLocationParameters} params - 选址分区分析服务参数类。
  58961. * @param {RequestCallback} callback 回调函数。
  58962. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  58963. */
  58964. findLocation(params, callback, resultFormat) {
  58965. var me = this;
  58966. var findLocationService = new FindLocationService(me.url, {
  58967. proxy: me.options.proxy,
  58968. withCredentials: me.options.withCredentials,
  58969. crossOrigin: me.options.crossOrigin,
  58970. headers: me.options.headers,
  58971. eventListeners: {
  58972. scope: me,
  58973. processCompleted: callback,
  58974. processFailed: callback
  58975. },
  58976. format: me._processFormat(resultFormat)
  58977. });
  58978. findLocationService.processAsync(params);
  58979. }
  58980. /**
  58981. * @function NetworkAnalystService.prototype.findPath
  58982. * @description 最佳路径分析服务:在网络数据集中指定一些节点,按照节点的选择顺序,顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  58983. * @param {FindPathParameters} params - 最佳路径分析服务参数类。
  58984. * @param {RequestCallback} callback - 回调函数。
  58985. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  58986. */
  58987. findPath(params, callback, resultFormat) {
  58988. var me = this;
  58989. var findPathService = new FindPathService(me.url, {
  58990. proxy: me.options.proxy,
  58991. withCredentials: me.options.withCredentials,
  58992. crossOrigin: me.options.crossOrigin,
  58993. headers: me.options.headers,
  58994. eventListeners: {
  58995. scope: me,
  58996. processCompleted: callback,
  58997. processFailed: callback
  58998. },
  58999. format: me._processFormat(resultFormat)
  59000. });
  59001. findPathService.processAsync(params);
  59002. }
  59003. /**
  59004. * @function NetworkAnalystService.prototype.findTSPPaths
  59005. * @description 旅行商分析服务:路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  59006. * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
  59007. * @param {RequestCallback} callback - 回调函数。
  59008. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  59009. */
  59010. findTSPPaths(params, callback, resultFormat) {
  59011. var me = this;
  59012. var findTSPPathsService = new FindTSPPathsService(me.url, {
  59013. proxy: me.options.proxy,
  59014. withCredentials: me.options.withCredentials,
  59015. crossOrigin: me.options.crossOrigin,
  59016. headers: me.options.headers,
  59017. eventListeners: {
  59018. scope: me,
  59019. processCompleted: callback,
  59020. processFailed: callback
  59021. },
  59022. format: me._processFormat(resultFormat)
  59023. });
  59024. findTSPPathsService.processAsync(params);
  59025. }
  59026. /**
  59027. * @function NetworkAnalystService.prototype.findMTSPPaths
  59028. * @description 多旅行商分析服务:也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。查找经济有效的配送路径,并给出相应的行走路线。
  59029. * @param {FindMTSPPathsParameters} params - 多旅行商分析服务参数类。
  59030. * @param {RequestCallback} callback - 回调函数。
  59031. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  59032. */
  59033. findMTSPPaths(params, callback, resultFormat) {
  59034. var me = this;
  59035. var findMTSPPathsService = new FindMTSPPathsService(me.url, {
  59036. proxy: me.options.proxy,
  59037. withCredentials: me.options.withCredentials,
  59038. crossOrigin: me.options.crossOrigin,
  59039. headers: me.options.headers,
  59040. eventListeners: {
  59041. scope: me,
  59042. processCompleted: callback,
  59043. processFailed: callback
  59044. },
  59045. format: me._processFormat(resultFormat)
  59046. });
  59047. findMTSPPathsService.processAsync(params);
  59048. }
  59049. /**
  59050. * @function NetworkAnalystService.prototype.findServiceAreas
  59051. * @description 服务区分析服务:以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  59052. * @param {FindServiceAreasParameters} params - 服务区分析服务参数类。
  59053. * @param {RequestCallback} callback 回调函数。
  59054. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  59055. */
  59056. findServiceAreas(params, callback, resultFormat) {
  59057. var me = this;
  59058. var findServiceAreasService = new FindServiceAreasService(me.url, {
  59059. proxy: me.options.proxy,
  59060. withCredentials: me.options.withCredentials,
  59061. crossOrigin: me.options.crossOrigin,
  59062. headers: me.options.headers,
  59063. eventListeners: {
  59064. scope: me,
  59065. processCompleted: callback,
  59066. processFailed: callback
  59067. },
  59068. format: me._processFormat(resultFormat)
  59069. });
  59070. findServiceAreasService.processAsync(params);
  59071. }
  59072. /**
  59073. * @function NetworkAnalystService.prototype.updateEdgeWeight
  59074. * @description 更新边的耗费权重服务。
  59075. * @param {UpdateEdgeWeightParameters} params - 更新边的耗费权重服务参数类。
  59076. * @param {RequestCallback} callback 回调函数。
  59077. */
  59078. updateEdgeWeight(params, callback) {
  59079. var me = this;
  59080. var updateEdgeWeightService = new UpdateEdgeWeightService(me.url, {
  59081. proxy: me.options.proxy,
  59082. withCredentials: me.options.withCredentials,
  59083. crossOrigin: me.options.crossOrigin,
  59084. headers: me.options.headers,
  59085. eventListeners: {
  59086. scope: me,
  59087. processCompleted: callback,
  59088. processFailed: callback
  59089. }
  59090. });
  59091. updateEdgeWeightService.processAsync(params);
  59092. }
  59093. /**
  59094. * @function NetworkAnalystService.prototype.updateTurnNodeWeight
  59095. * @description 转向耗费权重更新服务。
  59096. * @param {UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类。
  59097. * @param {RequestCallback} callback - 回调函数。
  59098. */
  59099. updateTurnNodeWeight(params, callback) {
  59100. var me = this;
  59101. var updateTurnNodeWeightService = new UpdateTurnNodeWeightService(me.url, {
  59102. proxy: me.options.proxy,
  59103. withCredentials: me.options.withCredentials,
  59104. crossOrigin: me.options.crossOrigin,
  59105. headers: me.options.headers,
  59106. eventListeners: {
  59107. scope: me,
  59108. processCompleted: callback,
  59109. processFailed: callback
  59110. }
  59111. });
  59112. updateTurnNodeWeightService.processAsync(params);
  59113. }
  59114. _processFormat(resultFormat) {
  59115. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  59116. }
  59117. }
  59118. ;// CONCATENATED MODULE: ./src/mapboxgl/services/NetworkAnalystService.js
  59119. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59120. * This program are made available under the terms of the Apache License, Version 2.0
  59121. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59122. /**
  59123. * @class NetworkAnalystService
  59124. * @category iServer NetworkAnalyst
  59125. * @classdesc 网络分析服务类。
  59126. * @modulecategory Services
  59127. * @extends {ServiceBase}
  59128. * @example
  59129. * new NetworkAnalystService(url)
  59130. * .findPath(params,function(result){
  59131. * //doSomething
  59132. * })
  59133. * @param {string} url - 服务地址。请求网络分析服务,URL应为:</br>
  59134. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源}。
  59135. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  59136. * @param {Object} options - 参数。
  59137. * @param {string} [options.proxy] - 服务代理地址。
  59138. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  59139. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  59140. * @param {Object} [options.headers] - 请求头。
  59141. * @usage
  59142. */
  59143. class NetworkAnalystService extends ServiceBase {
  59144. constructor(url, options) {
  59145. super(url, options);
  59146. this._networkAnalystService = new NetworkAnalystService_NetworkAnalystService(url, options);
  59147. }
  59148. /**
  59149. * @function NetworkAnalystService.prototype.burstPipelineAnalyst
  59150. * @description 爆管分析服务:即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组,普通结点 ID 数组及其上下游弧段 ID 数组。
  59151. * @param {BurstPipelineAnalystParameters} params - 爆管分析服务参数类。
  59152. * @param {RequestCallback} callback 回调函数。
  59153. */
  59154. burstPipelineAnalyst(params, callback) {
  59155. params = this._processParams(params);
  59156. this._networkAnalystService.burstPipelineAnalyst(params, callback);
  59157. }
  59158. /**
  59159. * @function NetworkAnalystService.prototype.computeWeightMatrix
  59160. * @description 耗费矩阵分析服务:根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  59161. * @param {ComputeWeightMatrixParameters} params - 耗费矩阵分析服务参数类。
  59162. * @param {RequestCallback} callback - 回调函数。
  59163. */
  59164. computeWeightMatrix(params, callback) {
  59165. params = this._processParams(params);
  59166. this._networkAnalystService.computeWeightMatrix(params, callback);
  59167. }
  59168. /**
  59169. * @function NetworkAnalystService.prototype.findClosestFacilities
  59170. * @description 最近设施分析服务:指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  59171. * @param {FindClosestFacilitiesParameters} params - 最近设施分析服务参数类。
  59172. * @param {RequestCallback} callback 回调函数。
  59173. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  59174. */
  59175. findClosestFacilities(params, callback, resultFormat) {
  59176. params = this._processParams(params);
  59177. this._networkAnalystService.findClosestFacilities(params, callback, resultFormat);
  59178. }
  59179. /**
  59180. * @function NetworkAnalystService.prototype.streamFacilityAnalyst
  59181. * @description 上游/下游 关键设施查找资源服务:查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  59182. * @param {FacilityAnalystStreamParameters} params - 上游/下游 关键设施查找资源服务参数类。
  59183. * @param {RequestCallback} callback 回调函数。
  59184. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  59185. */
  59186. streamFacilityAnalyst(params, callback, resultFormat) {
  59187. params = this._processParams(params);
  59188. this._networkAnalystService.streamFacilityAnalyst(params, callback, resultFormat);
  59189. }
  59190. /**
  59191. * @function NetworkAnalystService.prototype.findLocation
  59192. * @description 选址分区分析服务:确定一个或多个待建设施的最佳或最优位置。
  59193. * @param {FindLocationParameters} params - 选址分区分析服务参数类。
  59194. * @param {RequestCallback} callback 回调函数。
  59195. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  59196. */
  59197. findLocation(params, callback, resultFormat) {
  59198. params = this._processParams(params);
  59199. this._networkAnalystService.findLocation(params, callback, resultFormat);
  59200. }
  59201. /**
  59202. * @function NetworkAnalystService.prototype.findPath
  59203. * @description 最佳路径分析服务:在网络数据集中指定一些节点,按照节点的选择顺序,顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  59204. * @param {FindPathParameters} params - 最佳路径分析服务参数类。
  59205. * @param {RequestCallback} callback - 回调函数。
  59206. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  59207. */
  59208. findPath(params, callback, resultFormat) {
  59209. params = this._processParams(params);
  59210. this._networkAnalystService.findPath(params, callback, resultFormat);
  59211. }
  59212. /**
  59213. * @function NetworkAnalystService.prototype.findTSPPaths
  59214. * @description 旅行商分析服务:路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  59215. * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
  59216. * @param {RequestCallback} callback - 回调函数。
  59217. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  59218. */
  59219. findTSPPaths(params, callback, resultFormat) {
  59220. params = this._processParams(params);
  59221. this._networkAnalystService.findTSPPaths(params, callback, resultFormat);
  59222. }
  59223. /**
  59224. * @function NetworkAnalystService.prototype.findMTSPPaths
  59225. * @description 多旅行商分析服务:也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。查找经济有效的配送路径,并给出相应的行走路线。
  59226. * @param {FindMTSPPathsParameters} params - 多旅行商分析服务参数类。
  59227. * @param {RequestCallback} callback - 回调函数。
  59228. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  59229. */
  59230. findMTSPPaths(params, callback, resultFormat) {
  59231. params = this._processParams(params);
  59232. this._networkAnalystService.findMTSPPaths(params, callback, resultFormat);
  59233. }
  59234. /**
  59235. * @function NetworkAnalystService.prototype.findServiceAreas
  59236. * @description 服务区分析服务:以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  59237. * @param {FindServiceAreasParameters} params - 服务区分析服务参数类。
  59238. * @param {RequestCallback} callback 回调函数。
  59239. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  59240. */
  59241. findServiceAreas(params, callback, resultFormat) {
  59242. params = this._processParams(params);
  59243. this._networkAnalystService.findServiceAreas(params, callback, resultFormat);
  59244. }
  59245. /**
  59246. * @function NetworkAnalystService.prototype.updateEdgeWeight
  59247. * @description 更新边的耗费权重服务。
  59248. * @param {UpdateEdgeWeightParameters} params - 更新边的耗费权重服务参数类。
  59249. * @param {RequestCallback} callback 回调函数。
  59250. */
  59251. updateEdgeWeight(params, callback) {
  59252. this._networkAnalystService.updateEdgeWeight(params, callback);
  59253. }
  59254. /**
  59255. * @function NetworkAnalystService.prototype.updateTurnNodeWeight
  59256. * @description 转向耗费权重更新服务。
  59257. * @param {UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类。
  59258. * @param {RequestCallback} callback - 回调函数。
  59259. */
  59260. updateTurnNodeWeight(params, callback) {
  59261. this._networkAnalystService.updateTurnNodeWeight(params, callback);
  59262. }
  59263. /**
  59264. * @description 所有 Point 考虑 mapboxgl.lnglat、mapboxgl.Point、[]三种形式。
  59265. * @param {Object} params - 待转换参数。
  59266. * @returns {Object}
  59267. * @private
  59268. */
  59269. _processParams(params) {
  59270. if (!params) {
  59271. return {};
  59272. }
  59273. var me = this;
  59274. if (params.centers && core_Util_Util.isArray(params.centers)) {
  59275. params.centers.map(function (point, key) {
  59276. params.centers[key] = me._toPointObject(point);
  59277. return params.centers[key];
  59278. });
  59279. }
  59280. if (params.nodes && core_Util_Util.isArray(params.nodes)) {
  59281. params.nodes.map(function (point, key) {
  59282. params.nodes[key] = me._toPointObject(point);
  59283. return params.nodes[key];
  59284. });
  59285. }
  59286. if (params.event) {
  59287. params.event = me._toPointObject(params.event);
  59288. }
  59289. if (params.facilities && core_Util_Util.isArray(params.facilities)) {
  59290. params.facilities.map(function (point, key) {
  59291. params.facilities[key] = me._toPointObject(point);
  59292. return params.facilities[key];
  59293. });
  59294. }
  59295. if (params.parameter && params.parameter.barrierPoints) {
  59296. var barrierPoints = params.parameter.barrierPoints;
  59297. if (core_Util_Util.isArray(barrierPoints)) {
  59298. barrierPoints.map(function (point, key) {
  59299. params.parameter[key] = me._toPointObject(point);
  59300. return params.parameter.barrierPoints[key];
  59301. });
  59302. } else {
  59303. params.parameter.barrierPoints = [(barrierPoints instanceof (external_mapboxgl_default()).LngLat) ? {
  59304. x: barrierPoints.lng,
  59305. y: barrierPoints.lat
  59306. } : barrierPoints];
  59307. }
  59308. }
  59309. return params;
  59310. }
  59311. _toPointObject(point) {
  59312. if (core_Util_Util.isArray(point)) {
  59313. return {
  59314. x: point[0],
  59315. y: point[1]
  59316. };
  59317. }
  59318. if (point instanceof (external_mapboxgl_default()).LngLat) {
  59319. return {
  59320. x: point.lng,
  59321. y: point.lat
  59322. };
  59323. }
  59324. return (point instanceof (external_mapboxgl_default()).Point) ? {
  59325. x: point.x,
  59326. y: point.y
  59327. } : point;
  59328. }
  59329. _processFormat(resultFormat) {
  59330. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  59331. }
  59332. }
  59333. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalyst3DParameters.js
  59334. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59335. * This program are made available under the terms of the Apache License, Version 2.0
  59336. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59337. /**
  59338. * @class FacilityAnalyst3DParameters
  59339. * @deprecatedclass SuperMap.FacilityAnalyst3DParameters
  59340. * @category iServer FacilityAnalyst3D
  59341. * @classdesc 最近设施分析参数基类。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  59342. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,
  59343. * 超过 10 分钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍点、转向表、耗费等属性在最近设施分析时同样可设置。
  59344. * @param {Object} options - 参数。
  59345. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  59346. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  59347. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  59348. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  59349. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  59350. * @usage
  59351. */
  59352. class FacilityAnalyst3DParameters {
  59353. constructor(options) {
  59354. /**
  59355. * @member {number} [FacilityAnalyst3DParameters.prototype.edgeID]
  59356. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  59357. */
  59358. this.edgeID = null;
  59359. /**
  59360. * @member {number} [FacilityAnalyst3DParameters.prototype.nodeID]
  59361. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  59362. */
  59363. this.nodeID = null;
  59364. /**
  59365. * @member {string} FacilityAnalyst3DParameters.prototype.weightName
  59366. * @description 指定的权值字段信息对象的名称。
  59367. */
  59368. this.weightName = null;
  59369. /**
  59370. * @member {boolean} [FacilityAnalyst3DParameters.prototype.isUncertainDirectionValid=false]
  59371. * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  59372. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  59373. */
  59374. this.isUncertainDirectionValid = false;
  59375. Util_Util.extend(this, options);
  59376. this.CLASS_NAME = "SuperMap.FacilityAnalyst3DParameters";
  59377. }
  59378. /**
  59379. * @function FacilityAnalyst3DParameters.prototype.destroy
  59380. * @description 释放资源,将资源的属性置空。
  59381. */
  59382. destroy() {
  59383. var me = this;
  59384. me.edgeID = null;
  59385. me.nodeID = null;
  59386. me.weightName = null;
  59387. me.isUncertainDirectionValid = null;
  59388. }
  59389. }
  59390. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DParameters.js
  59391. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59392. * This program are made available under the terms of the Apache License, Version 2.0
  59393. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59394. /**
  59395. * @class FacilityAnalystSinks3DParameters
  59396. * @deprecatedclass SuperMap.FacilityAnalystSinks3DParameters
  59397. * @category iServer FacilityAnalyst3D Sinks
  59398. * @classdesc 最近设施分析参数类(汇查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  59399. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍点、转向表、耗费等属性在最近设施分析时同样可设置。
  59400. * @extends {FacilityAnalyst3DParameters}
  59401. * @param {Object} options - 参数。
  59402. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  59403. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  59404. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  59405. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  59406. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  59407. * @usage
  59408. */
  59409. class FacilityAnalystSinks3DParameters extends FacilityAnalyst3DParameters {
  59410. constructor(options) {
  59411. super(options);
  59412. this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DParameters";
  59413. }
  59414. /**
  59415. * @function FacilityAnalystSinks3DParameters.prototype.destroy
  59416. * @override
  59417. */
  59418. destroy() {
  59419. super.destroy();
  59420. }
  59421. }
  59422. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DService.js
  59423. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59424. * This program are made available under the terms of the Apache License, Version 2.0
  59425. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59426. /**
  59427. * @class FacilityAnalystSinks3DService
  59428. * @deprecatedclass SuperMap.FacilityAnalystSinks3DService
  59429. * @category iServer FacilityAnalyst3D Sinks
  59430. * @classdesc 最近设施分析服务类(汇查找资源)<br>
  59431. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  59432. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  59433. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  59434. * 最近设施分析结果通过该类支持的事件的监听函数参数获取
  59435. * @extends {CommonServiceBase}
  59436. * @example
  59437. * var myFacilityAnalystSinks3DService = new FacilityAnalystSinks3DService(url, {
  59438. * eventListeners: {
  59439. * "processCompleted": facilityAnalystSinks3DCompleted,
  59440. * "processFailed": facilityAnalystSinks3DError
  59441. * }
  59442. * });
  59443. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:<br>
  59444. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};<br>
  59445. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。<br>
  59446. * @param {Object} options - 参数。
  59447. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  59448. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  59449. * @param {Object} [options.headers] - 请求头。
  59450. * @usage
  59451. */
  59452. class FacilityAnalystSinks3DService extends CommonServiceBase {
  59453. constructor(url, options) {
  59454. super(url, options);
  59455. this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DService";
  59456. }
  59457. /**
  59458. * @function FacilityAnalystSinks3DService.prototype.destroy
  59459. * @override
  59460. */
  59461. destroy() {
  59462. CommonServiceBase.prototype.destroy.apply(this, arguments);
  59463. }
  59464. /**
  59465. * @function FacilityAnalystSinks3DService.prototype.processAsync
  59466. * @description 负责将客户端的查询参数传递到服务端。
  59467. * @param {FacilityAnalystSinks3DParameters} params - 最近设施分析参数类(汇查找资源)
  59468. */
  59469. processAsync(params) {
  59470. if (!(params instanceof FacilityAnalystSinks3DParameters)) {
  59471. return;
  59472. }
  59473. var me = this, jsonObject;
  59474. me.url = Util_Util.urlPathAppend(me.url, 'sinks');
  59475. jsonObject = {
  59476. edgeID: params.edgeID,
  59477. nodeID: params.nodeID,
  59478. weightName: params.weightName,
  59479. isUncertainDirectionValid: params.isUncertainDirectionValid
  59480. };
  59481. me.request({
  59482. method: "GET",
  59483. params: jsonObject,
  59484. scope: me,
  59485. success: me.serviceProcessCompleted,
  59486. failure: me.serviceProcessFailed
  59487. });
  59488. }
  59489. }
  59490. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DParameters.js
  59491. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59492. * This program are made available under the terms of the Apache License, Version 2.0
  59493. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59494. /**
  59495. * @class FacilityAnalystSources3DParameters
  59496. * @deprecatedclass SuperMap.FacilityAnalystSources3DParameters
  59497. * @category iServer FacilityAnalyst3D Sources
  59498. * @classdesc 最近设施分析参数类(源查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  59499. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍点、转向表、耗费等属性在最近设施分析时同样可设置。
  59500. * @extends {FacilityAnalyst3DParameters}
  59501. * @param {Object} options - 参数。
  59502. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  59503. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  59504. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  59505. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  59506. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  59507. * @usage
  59508. */
  59509. class FacilityAnalystSources3DParameters extends FacilityAnalyst3DParameters {
  59510. constructor(options) {
  59511. super(options);
  59512. this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DParameters";
  59513. }
  59514. /**
  59515. * @function FacilityAnalystSources3DParameters.prototype.destroy
  59516. * @override
  59517. */
  59518. destroy() {
  59519. super.destroy();
  59520. }
  59521. }
  59522. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DService.js
  59523. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59524. * This program are made available under the terms of the Apache License, Version 2.0
  59525. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59526. /**
  59527. * @class FacilityAnalystSources3DService
  59528. * @deprecatedclass SuperMap.FacilityAnalystSources3DService
  59529. * @category iServer FacilityAnalyst3D Sources
  59530. * @classdesc 最近设施分析服务类(源查找资源)
  59531. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  59532. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  59533. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  59534. * 最近设施分析结果通过该类支持的事件的监听函数参数获取。
  59535. * @extends {CommonServiceBase}
  59536. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  59537. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  59538. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  59539. * @param {Object} options - 参数。
  59540. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  59541. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  59542. * @param {Object} [options.headers] - 请求头。
  59543. * @usage
  59544. */
  59545. class FacilityAnalystSources3DService extends CommonServiceBase {
  59546. constructor(url, options) {
  59547. super(url, options);
  59548. this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DService";
  59549. }
  59550. /**
  59551. * @function FacilityAnalystSources3DService.prototype.destroy
  59552. * @override
  59553. */
  59554. destroy() {
  59555. super.destroy();
  59556. }
  59557. /**
  59558. * @function FacilityAnalystSources3DService.prototype.processAsync
  59559. * @description 负责将客户端的查询参数传递到服务端。
  59560. * @param {FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找资源)
  59561. */
  59562. processAsync(params) {
  59563. if (!(params instanceof FacilityAnalystSources3DParameters)) {
  59564. return;
  59565. }
  59566. var me = this, jsonObject;
  59567. me.url = Util_Util.urlPathAppend(me.url, 'sources');
  59568. jsonObject = {
  59569. edgeID: params.edgeID,
  59570. nodeID: params.nodeID,
  59571. weightName: params.weightName,
  59572. isUncertainDirectionValid: params.isUncertainDirectionValid
  59573. };
  59574. me.request({
  59575. method: "GET",
  59576. params: jsonObject,
  59577. scope: me,
  59578. success: me.serviceProcessCompleted,
  59579. failure: me.serviceProcessFailed
  59580. });
  59581. }
  59582. }
  59583. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DParameters.js
  59584. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59585. * This program are made available under the terms of the Apache License, Version 2.0
  59586. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59587. /**
  59588. * @class FacilityAnalystTraceup3DParameters
  59589. * @deprecatedclass SuperMap.FacilityAnalystTraceup3DParameters
  59590. * @category iServer FacilityAnalyst3D TraceUpResult
  59591. * @classdesc 上游追踪资源参数类。
  59592. * @extends {FacilityAnalyst3DParameters}
  59593. * @param {Object} options - 参数。
  59594. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  59595. * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
  59596. * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
  59597. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  59598. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  59599. * @usage
  59600. */
  59601. class FacilityAnalystTraceup3DParameters extends FacilityAnalyst3DParameters {
  59602. constructor(options) {
  59603. super(options);
  59604. this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DParameters";
  59605. }
  59606. /**
  59607. * @function FacilityAnalystTraceup3DParameters.prototype.destroy
  59608. * @override
  59609. */
  59610. destroy() {
  59611. super.destroy();
  59612. }
  59613. }
  59614. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DService.js
  59615. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59616. * This program are made available under the terms of the Apache License, Version 2.0
  59617. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59618. /**
  59619. * @class FacilityAnalystTraceup3DService
  59620. * @deprecatedclass SuperMap.FacilityAnalystTraceup3DService
  59621. * @category iServer FacilityAnalyst3D TraceUpResult
  59622. * @classdesc 上游追踪资源服务类
  59623. * @extends {CommonServiceBase}
  59624. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  59625. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  59626. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  59627. * @param {Object} options - 参数。
  59628. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  59629. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  59630. * @param {Object} [options.headers] - 请求头。
  59631. * @usage
  59632. */
  59633. class FacilityAnalystTraceup3DService extends CommonServiceBase {
  59634. constructor(url, options) {
  59635. super(url, options);
  59636. this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DService";
  59637. }
  59638. /**
  59639. * @function FacilityAnalystTraceup3DService.prototype.destroy
  59640. * @override
  59641. */
  59642. destroy() {
  59643. super.destroy();
  59644. }
  59645. /**
  59646. * @function FacilityAnalystTraceup3DService.prototype.processAsync
  59647. * @description 负责将客户端的查询参数传递到服务端。
  59648. * @param {FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类
  59649. */
  59650. processAsync(params) {
  59651. if (!(params instanceof FacilityAnalystTraceup3DParameters)) {
  59652. return;
  59653. }
  59654. var me = this, jsonObject;
  59655. me.url = Util_Util.urlPathAppend(me.url, 'traceupresult');
  59656. jsonObject = {
  59657. edgeID: params.edgeID,
  59658. nodeID: params.nodeID,
  59659. weightName: params.weightName,
  59660. isUncertainDirectionValid: params.isUncertainDirectionValid
  59661. };
  59662. me.request({
  59663. method: "GET",
  59664. params: jsonObject,
  59665. scope: me,
  59666. success: me.serviceProcessCompleted,
  59667. failure: me.serviceProcessFailed
  59668. });
  59669. }
  59670. }
  59671. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DParameters.js
  59672. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59673. * This program are made available under the terms of the Apache License, Version 2.0
  59674. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59675. /**
  59676. * @class FacilityAnalystTracedown3DParameters
  59677. * @deprecatedclass SuperMap.FacilityAnalystTracedown3DParameters
  59678. * @category iServer FacilityAnalyst3D TraceDownResult
  59679. * @classdesc 下游追踪资源参数类。
  59680. * @extends {FacilityAnalyst3DParameters}
  59681. * @param {Object} options - 参数。
  59682. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  59683. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  59684. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  59685. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  59686. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  59687. * @usage
  59688. */
  59689. class FacilityAnalystTracedown3DParameters extends FacilityAnalyst3DParameters {
  59690. constructor(options) {
  59691. super(options);
  59692. this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DParameters";
  59693. }
  59694. /**
  59695. * @function FacilityAnalystTracedown3DParameters.prototype.destroy
  59696. * @override
  59697. */
  59698. destroy() {
  59699. super.destroy();
  59700. }
  59701. }
  59702. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DService.js
  59703. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59704. * This program are made available under the terms of the Apache License, Version 2.0
  59705. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59706. /**
  59707. * @class FacilityAnalystTracedown3DService
  59708. * @deprecatedclass SuperMap.FacilityAnalystTracedown3DService
  59709. * @category iServer FacilityAnalyst3D TraceDownResult
  59710. * @classdesc 下游追踪资源服务类
  59711. * @extends {CommonServiceBase}
  59712. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  59713. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  59714. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  59715. * @param {Object} options - 参数。
  59716. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  59717. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  59718. * @param {Object} [options.headers] - 请求头。
  59719. * @usage
  59720. */
  59721. class FacilityAnalystTracedown3DService extends CommonServiceBase {
  59722. constructor(url, options) {
  59723. super(url, options);
  59724. this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DService";
  59725. }
  59726. /**
  59727. * @function FacilityAnalystTracedown3DService.prototype.destroy
  59728. * @override
  59729. */
  59730. destroy() {
  59731. super.destroy();
  59732. }
  59733. /**
  59734. * @function FacilityAnalystTracedown3DService.prototype.processAsync
  59735. * @description 负责将客户端的查询参数传递到服务端。
  59736. * @param {FacilityAnalystTracedown3DParameters} params - 下游追踪资源参数类。
  59737. */
  59738. processAsync(params) {
  59739. if (!(params instanceof FacilityAnalystTracedown3DParameters)) {
  59740. return;
  59741. }
  59742. var me = this, jsonObject;
  59743. me.url = Util_Util.urlPathAppend(me.url, 'tracedownresult');
  59744. jsonObject = {
  59745. edgeID: params.edgeID,
  59746. nodeID: params.nodeID,
  59747. weightName: params.weightName,
  59748. isUncertainDirectionValid: params.isUncertainDirectionValid
  59749. };
  59750. me.request({
  59751. method: "GET",
  59752. params: jsonObject,
  59753. scope: me,
  59754. success: me.serviceProcessCompleted,
  59755. failure: me.serviceProcessFailed
  59756. });
  59757. }
  59758. }
  59759. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DParameters.js
  59760. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59761. * This program are made available under the terms of the Apache License, Version 2.0
  59762. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59763. /**
  59764. * @class FacilityAnalystUpstream3DParameters
  59765. * @deprecatedclass SuperMap.FacilityAnalystUpstream3DParameters
  59766. * @category iServer FacilityAnalyst3D UpstreamCirticalFaclilities
  59767. * @classdesc 上游关键设施查找资源参数类。
  59768. * @extends {FacilityAnalyst3DParameters}
  59769. * @param {Object} options - 参数。
  59770. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  59771. * @param {number} [options.edgeID] - 指定的弧段ID。edgeID 与 nodeID 必须指定一个。
  59772. * @param {number} [options.nodeID] - 指定的结点ID。edgeID 与 edgeID 必须指定一个。
  59773. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  59774. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  59775. * @usage
  59776. */
  59777. class FacilityAnalystUpstream3DParameters extends FacilityAnalyst3DParameters {
  59778. constructor(options) {
  59779. super(options);
  59780. options = options || {};
  59781. this.sourceNodeIDs = null;
  59782. Util_Util.extend(this, options);
  59783. this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DParameters";
  59784. }
  59785. /**
  59786. * @function FacilityAnalystUpstream3DParameters.prototype.destroy
  59787. * @override
  59788. */
  59789. destroy() {
  59790. super.destroy();
  59791. this.sourceNodeIDs = null;
  59792. }
  59793. }
  59794. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DService.js
  59795. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59796. * This program are made available under the terms of the Apache License, Version 2.0
  59797. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59798. /**
  59799. * @class FacilityAnalystUpstream3DService
  59800. * @deprecatedclass SuperMap.FacilityAnalystUpstream3DService
  59801. * @category iServer FacilityAnalyst3D UpstreamCirticalFaclilities
  59802. * @classdesc 上游关键设施查找资源服务类
  59803. * @extends {CommonServiceBase}
  59804. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  59805. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  59806. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  59807. * @param {Object} options - 参数。
  59808. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  59809. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  59810. * @param {Object} [options.headers] - 请求头。
  59811. * @usage
  59812. */
  59813. class FacilityAnalystUpstream3DService extends CommonServiceBase {
  59814. constructor(url, options) {
  59815. super(url, options);
  59816. this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DService";
  59817. }
  59818. /**
  59819. * @function FacilityAnalystUpstream3DService.prototype.destroy
  59820. * @override
  59821. */
  59822. destroy() {
  59823. super.destroy();
  59824. }
  59825. /**
  59826. * @function FacilityAnalystUpstream3DService.prototype.processAsync
  59827. * @description 负责将客户端的查询参数传递到服务端。
  59828. * @param {FacilityAnalystUpstream3DParameters} params - 上游关键设施查找资源参数类
  59829. */
  59830. processAsync(params) {
  59831. if (!(params instanceof FacilityAnalystUpstream3DParameters)) {
  59832. return;
  59833. }
  59834. var me = this, jsonObject;
  59835. me.url = Util_Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
  59836. jsonObject = {
  59837. sourceNodeIDs: params.sourceNodeIDs,
  59838. edgeID: params.edgeID,
  59839. nodeID: params.nodeID,
  59840. isUncertainDirectionValid: params.isUncertainDirectionValid
  59841. };
  59842. me.request({
  59843. method: "GET",
  59844. params: jsonObject,
  59845. scope: me,
  59846. success: me.serviceProcessCompleted,
  59847. failure: me.serviceProcessFailed
  59848. });
  59849. }
  59850. }
  59851. ;// CONCATENATED MODULE: ./src/common/iServer/NetworkAnalyst3DService.js
  59852. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59853. * This program are made available under the terms of the Apache License, Version 2.0
  59854. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59855. /**
  59856. * @class NetworkAnalyst3DService
  59857. * @category iServer FacilityAnalyst3D
  59858. * @classdesc 3D 网络分析服务类。
  59859. * @extends {ServiceBase}
  59860. * @example
  59861. * new NetworkAnalyst3DService(url).sinksFacilityAnalyst(params,function(result){
  59862. * //doSomething
  59863. * })
  59864. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL 应为:
  59865. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  59866. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  59867. * @param {Object} options - 参数。
  59868. * @param {string} [options.proxy] - 服务代理地址。
  59869. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  59870. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  59871. * @param {Object} [options.headers] - 请求头。
  59872. * @usage
  59873. */
  59874. class NetworkAnalyst3DService_NetworkAnalyst3DService {
  59875. constructor(url, options) {
  59876. this.url = url;
  59877. this.options = options || {};
  59878. }
  59879. /**
  59880. * @function NetworkAnalyst3DService.prototype.sinksFacilityAnalyst
  59881. * @description 汇查找服务
  59882. * @param {FacilityAnalystSinks3DParameters} params- 最近设施分析参数类(汇查找资源)。
  59883. * @param {RequestCallback} callback - 回调函数。
  59884. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  59885. */
  59886. sinksFacilityAnalyst(params, callback) {
  59887. var me = this;
  59888. var facilityAnalystSinks3DService = new FacilityAnalystSinks3DService(me.url, {
  59889. proxy: me.options.proxy,
  59890. withCredentials: me.options.withCredentials,
  59891. crossOrigin: me.options.crossOrigin,
  59892. headers: me.options.headers,
  59893. eventListeners: {
  59894. scope: me,
  59895. processCompleted: callback,
  59896. processFailed: callback
  59897. }
  59898. });
  59899. facilityAnalystSinks3DService.processAsync(params);
  59900. }
  59901. /**
  59902. * @function NetworkAnalyst3DService.prototype.sourcesFacilityAnalyst
  59903. * @description 源查找服务。
  59904. * @param {FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找服务)。
  59905. * @param {RequestCallback} callback - 回调函数。
  59906. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  59907. */
  59908. sourcesFacilityAnalyst(params, callback) {
  59909. var me = this;
  59910. var facilityAnalystSources3DService = new FacilityAnalystSources3DService(me.url, {
  59911. proxy: me.options.proxy,
  59912. withCredentials: me.options.withCredentials,
  59913. crossOrigin: me.options.crossOrigin,
  59914. headers: me.options.headers,
  59915. eventListeners: {
  59916. scope: me,
  59917. processCompleted: callback,
  59918. processFailed: callback
  59919. }
  59920. });
  59921. facilityAnalystSources3DService.processAsync(params);
  59922. }
  59923. /**
  59924. * @function NetworkAnalyst3DService.prototype.traceUpFacilityAnalyst
  59925. * @description 上游追踪资源服务。
  59926. * @param {FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类。
  59927. * @param {RequestCallback} callback - 回调函数。
  59928. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  59929. */
  59930. traceUpFacilityAnalyst(params, callback) {
  59931. var me = this;
  59932. var facilityAnalystTraceup3DService = new FacilityAnalystTraceup3DService(me.url, {
  59933. proxy: me.options.proxy,
  59934. withCredentials: me.options.withCredentials,
  59935. crossOrigin: me.options.crossOrigin,
  59936. headers: me.options.headers,
  59937. eventListeners: {
  59938. scope: me,
  59939. processCompleted: callback,
  59940. processFailed: callback
  59941. }
  59942. });
  59943. facilityAnalystTraceup3DService.processAsync(params);
  59944. }
  59945. /**
  59946. * @function NetworkAnalyst3DService.prototype.traceDownFacilityAnalyst
  59947. * @description 下游追踪资源服务。
  59948. * @param {FacilityAnalystTracedown3DParameters} params - 下游追踪资源服务参数类。
  59949. * @param {RequestCallback} callback - 回调函数。
  59950. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  59951. */
  59952. traceDownFacilityAnalyst(params, callback) {
  59953. var me = this;
  59954. var facilityAnalystTracedown3DService = new FacilityAnalystTracedown3DService(me.url, {
  59955. proxy: me.options.proxy,
  59956. withCredentials: me.options.withCredentials,
  59957. crossOrigin: me.options.crossOrigin,
  59958. headers: me.options.headers,
  59959. eventListeners: {
  59960. scope: me,
  59961. processCompleted: callback,
  59962. processFailed: callback
  59963. }
  59964. });
  59965. facilityAnalystTracedown3DService.processAsync(params);
  59966. }
  59967. /**
  59968. * @function NetworkAnalyst3DService.prototype.upstreamFacilityAnalyst
  59969. * @description 上游关键设施查找服务。
  59970. * @param {FacilityAnalystUpstream3DParameters} params - 上游关键设施查找服务参数类。
  59971. * @param {RequestCallback} callback - 回调函数。
  59972. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  59973. */
  59974. upstreamFacilityAnalyst(params, callback) {
  59975. var me = this;
  59976. var facilityAnalystUpstream3DService = new FacilityAnalystUpstream3DService(me.url, {
  59977. proxy: me.options.proxy,
  59978. withCredentials: me.options.withCredentials,
  59979. crossOrigin: me.options.crossOrigin,
  59980. headers: me.options.headers,
  59981. eventListeners: {
  59982. scope: me,
  59983. processCompleted: callback,
  59984. processFailed: callback
  59985. }
  59986. });
  59987. facilityAnalystUpstream3DService.processAsync(params);
  59988. }
  59989. }
  59990. ;// CONCATENATED MODULE: ./src/mapboxgl/services/NetworkAnalyst3DService.js
  59991. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59992. * This program are made available under the terms of the Apache License, Version 2.0
  59993. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59994. /**
  59995. * @class NetworkAnalyst3DService
  59996. * @category iServer FacilityAnalyst3D
  59997. * @classdesc 3D 网络分析服务类。
  59998. * @modulecategory Services
  59999. * @extends {ServiceBase}
  60000. * @example
  60001. * new NetworkAnalyst3DService(url)
  60002. * .sinksFacilityAnalyst(params,function(result){
  60003. * //doSomething
  60004. * })
  60005. * @param {string} url - 服务地址。请求网络分析服务,URL应为:</br>
  60006. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源}。
  60007. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  60008. * @param {Object} options - 参数。
  60009. * @param {string} [options.proxy] - 服务代理地址。
  60010. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  60011. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  60012. * @param {Object} [options.headers] - 请求头。
  60013. * @usage
  60014. */
  60015. class NetworkAnalyst3DService extends ServiceBase {
  60016. constructor(url, options) {
  60017. super(url, options);
  60018. this._networkAnalyst3DService = new NetworkAnalyst3DService_NetworkAnalyst3DService(url, options);
  60019. }
  60020. /**
  60021. * @function NetworkAnalyst3DService.prototype.sinksFacilityAnalyst
  60022. * @description 汇查找服务。
  60023. * @param {FacilityAnalystSinks3DParameters} params - 最近设施分析参数类(汇查找资源)。
  60024. * @param {RequestCallback} callback - 回调函数。
  60025. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  60026. */
  60027. sinksFacilityAnalyst(params, callback) {
  60028. this._networkAnalyst3DService.sinksFacilityAnalyst(params, callback);
  60029. }
  60030. /**
  60031. * @function NetworkAnalyst3DService.prototype.sourcesFacilityAnalyst
  60032. * @description 源查找服务。
  60033. * @param {FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找服务)。
  60034. * @param {RequestCallback} callback - 回调函数。
  60035. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  60036. */
  60037. sourcesFacilityAnalyst(params, callback) {
  60038. this._networkAnalyst3DService.sourcesFacilityAnalyst(params, callback);
  60039. }
  60040. /**
  60041. * @function NetworkAnalyst3DService.prototype.traceUpFacilityAnalyst
  60042. * @description 上游追踪资源服务。
  60043. * @param {FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类。
  60044. * @param {RequestCallback} callback 回调函数。
  60045. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  60046. */
  60047. traceUpFacilityAnalyst(params, callback) {
  60048. this._networkAnalyst3DService.traceUpFacilityAnalyst(params, callback);
  60049. }
  60050. /**
  60051. * @function NetworkAnalyst3DService.prototype.traceDownFacilityAnalyst
  60052. * @description 下游追踪资源服务。
  60053. * @param {FacilityAnalystTracedown3DParameters} params - 下游追踪资源服务参数类。
  60054. * @param {RequestCallback} callback 回调函数。
  60055. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  60056. */
  60057. traceDownFacilityAnalyst(params, callback) {
  60058. this._networkAnalyst3DService.traceDownFacilityAnalyst(params, callback);
  60059. }
  60060. /**
  60061. * @function NetworkAnalyst3DService.prototype.upstreamFacilityAnalyst
  60062. * @description 上游关键设施查找服务。
  60063. * @param {FacilityAnalystUpstream3DParameters} params - 上游关键设施查找服务参数类。
  60064. * @param {RequestCallback} callback 回调函数。
  60065. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  60066. */
  60067. upstreamFacilityAnalyst(params, callback) {
  60068. this._networkAnalyst3DService.upstreamFacilityAnalyst(params, callback);
  60069. }
  60070. }
  60071. ;// CONCATENATED MODULE: ./src/common/iServer/ProcessingServiceBase.js
  60072. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60073. * This program are made available under the terms of the Apache License, Version 2.0
  60074. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60075. /**
  60076. * @class ProcessingServiceBase
  60077. * @deprecatedclass SuperMap.ProcessingServiceBase
  60078. * @category iServer Core
  60079. * @classdesc 分布式分析服务基类
  60080. * @extends {CommonServiceBase}
  60081. * @param {string} url - 服务地址。
  60082. * @param {Object} options - 参数。
  60083. * @param {Events} options.events - 处理所有事件的对象。
  60084. * @param {number} options.index - 服务访问地址在数组中的位置。
  60085. * @param {number} options.length - 服务访问地址数组长度。
  60086. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  60087. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  60088. * @param {Object} [options.headers] - 请求头。
  60089. * @usage
  60090. */
  60091. class ProcessingServiceBase extends CommonServiceBase {
  60092. constructor(url, options) {
  60093. options = options || {};
  60094. /*
  60095. * Constant: EVENT_TYPES
  60096. * {Array.<string>}
  60097. * 此类支持的事件类型
  60098. * - *processCompleted* 创建成功后触发的事件。
  60099. * - *processFailed* 创建失败后触发的事件 。
  60100. * - *processRunning* 创建过程的整个阶段都会触发的事件,用于获取创建过程的状态 。
  60101. */
  60102. options.EVENT_TYPES = ["processCompleted", "processFailed", "processRunning"];
  60103. super(url, options);
  60104. this.CLASS_NAME = "SuperMap.ProcessingServiceBase";
  60105. }
  60106. /**
  60107. * @function ProcessingServiceBase.prototype.destroy
  60108. * @override
  60109. */
  60110. destroy() {
  60111. super.destroy();
  60112. }
  60113. /**
  60114. * @function ProcessingServiceBase.prototype.getJobs
  60115. * @description 获取分布式分析任务。
  60116. * @param {string} url - 资源地址。
  60117. */
  60118. getJobs(url) {
  60119. var me = this;
  60120. FetchRequest.get(SecurityManager.appendCredential(url), null, {
  60121. proxy: me.proxy
  60122. }).then(function (response) {
  60123. return response.json();
  60124. }).then(function (result) {
  60125. me.events.triggerEvent("processCompleted", {
  60126. result: result
  60127. });
  60128. }).catch(function (e) {
  60129. me.eventListeners.processFailed({
  60130. error: e
  60131. });
  60132. });
  60133. }
  60134. /**
  60135. * @function ProcessingServiceBase.prototype.addJob
  60136. * @description 添加分布式分析任务。
  60137. * @param {string} url - 资源根地址。
  60138. * @param {Object} params - 创建一个空间分析的请求参数。
  60139. * @param {string} paramType - 请求参数类型。
  60140. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  60141. */
  60142. addJob(url, params, paramType, seconds) {
  60143. var me = this,
  60144. parameterObject = null;
  60145. if (params && params instanceof paramType) {
  60146. parameterObject = new Object();
  60147. paramType.toObject(params, parameterObject);
  60148. }
  60149. let headers = Object.assign({
  60150. 'Content-Type': 'application/x-www-form-urlencoded'
  60151. }, me.headers || {})
  60152. var options = {
  60153. proxy: me.proxy,
  60154. headers,
  60155. withCredentials: me.withCredentials,
  60156. crossOrigin: me.crossOrigin,
  60157. isInTheSameDomain: me.isInTheSameDomain
  60158. };
  60159. FetchRequest.post(SecurityManager.appendCredential(url), JSON.stringify(parameterObject), options).then(function (response) {
  60160. return response.json();
  60161. }).then(function (result) {
  60162. if (result.succeed) {
  60163. me.serviceProcessCompleted(result, seconds);
  60164. } else {
  60165. me.serviceProcessFailed(result);
  60166. }
  60167. }).catch(function (e) {
  60168. me.serviceProcessFailed({
  60169. error: e
  60170. });
  60171. });
  60172. }
  60173. serviceProcessCompleted(result, seconds) {
  60174. result = Util_Util.transformResult(result);
  60175. seconds = seconds || 1000;
  60176. var me = this;
  60177. if (result) {
  60178. var id = setInterval(function () {
  60179. FetchRequest.get(SecurityManager.appendCredential(result.newResourceLocation), {
  60180. _t: new Date().getTime()
  60181. })
  60182. .then(function (response) {
  60183. return response.json();
  60184. }).then(function (job) {
  60185. me.events.triggerEvent("processRunning", {
  60186. id: job.id,
  60187. state: job.state
  60188. });
  60189. if (job.state.runState === 'LOST' || job.state.runState === 'KILLED' || job.state.runState === 'FAILED') {
  60190. clearInterval(id);
  60191. me.events.triggerEvent("processFailed", {
  60192. error: job.state.errorMsg,
  60193. state: job.state.runState
  60194. });
  60195. }
  60196. if (job.state.runState === 'FINISHED' && job.setting.serviceInfo) {
  60197. clearInterval(id);
  60198. me.events.triggerEvent("processCompleted", {
  60199. result: job
  60200. });
  60201. }
  60202. }).catch(function (e) {
  60203. clearInterval(id);
  60204. me.events.triggerEvent("processFailed", {
  60205. error: e
  60206. });
  60207. });
  60208. }, seconds);
  60209. }
  60210. }
  60211. serviceProcessFailed(result) {
  60212. super.serviceProcessFailed(result);
  60213. }
  60214. }
  60215. ;// CONCATENATED MODULE: ./src/common/iServer/DatasourceConnectionInfo.js
  60216. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60217. * This program are made available under the terms of the Apache License, Version 2.0
  60218. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60219. // eslint-disable-line no-unused-vars
  60220. /**
  60221. * @class DatasourceConnectionInfo
  60222. * @deprecatedclass SuperMap.DatasourceConnectionInfo
  60223. * @category iServer Data Datasource
  60224. * @classdesc 数据源连接信息类。该类包括了进行数据源连接的所有信息,如所要连接的服务器名称、数据库名称、用户名以及密码等。
  60225. * 当保存为工作空间时,工作空间中的数据源的连接信息都将存储到工作空间文件中。对于不同类型的数据源,其连接信息有所区别。
  60226. * 所以在使用该类所包含的成员时,请注意该成员所适用的数据源类型。对于从数据源对象中返回的数据连接信息对象,只有 connect 方法可以被修改,
  60227. * 其他内容是不可以被修改的。对于用户创建的数据源连接信息对象,其内容都可以修改。
  60228. * @param {Object} options - 参数。
  60229. * @param {string} options.alias - 数据源别名。
  60230. * @param {string} options.dataBase - 数据源连接的数据库名。
  60231. * @param {boolean} [options.connect] - 数据源是否自动连接数据。
  60232. * @param {string} [options.driver] - 使用 ODBC(Open Database Connectivity,开放数据库互连)的数据库的驱动程序名。
  60233. * @param {EngineType} [options.engineType] - 数据源连接的引擎类型。
  60234. * @param {boolean} [options.exclusive] - 是否以独占方式打开数据源。
  60235. * @param {boolean} [options.OpenLinkTable] - 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  60236. * @param {string} [options.password] - 登录数据源连接的数据库或文件的密码。
  60237. * @param {boolean} [options.readOnly] - 是否以只读方式打开数据源。
  60238. * @param {string} [options.server] - 数据库服务器名或 SDB 文件名。
  60239. * @param {string} [options.user] - 登录数据库的用户名。
  60240. * @usage
  60241. */
  60242. class DatasourceConnectionInfo {
  60243. constructor(options) {
  60244. /**
  60245. * @member {string} DatasourceConnectionInfo.prototype.alias
  60246. * @description 数据源别名。
  60247. */
  60248. this.alias = null;
  60249. /**
  60250. * @member {boolean} [DatasourceConnectionInfo.prototype.connect]
  60251. * @description 数据源是否自动连接数据。
  60252. */
  60253. this.connect = null;
  60254. /**
  60255. * @member {string} DatasourceConnectionInfo.prototype.dataBase
  60256. * @description 数据源连接的数据库名。
  60257. */
  60258. this.dataBase = null;
  60259. /**
  60260. * @member {string} [DatasourceConnectionInfo.prototype.driver]
  60261. * @description 使用 ODBC(Open Database Connectivity,开放数据库互连) 的数据库的驱动程序名。
  60262. * 其中,对于 SQL Server 数据库与 iServer 发布的 WMTS 服务,此为必设参数。
  60263. * 对于 SQL Server 数据库,它使用 ODBC 连接,所设置的驱动程序名为 "SQL Server" 或 "SQL Native Client";
  60264. * 对于 iServer 发布的 WMTS 服务,设置的驱动名称为 "WMTS"。
  60265. */
  60266. this.driver = null;
  60267. /**
  60268. * @member {EngineType} [DatasourceConnectionInfo.prototype.engineType]
  60269. * @description 数据源连接的引擎类型。
  60270. */
  60271. this.engineType = null;
  60272. /**
  60273. * @member {boolean} [DatasourceConnectionInfo.prototype.exclusive]
  60274. * @description 是否以独占方式打开数据源。
  60275. */
  60276. this.exclusive = null;
  60277. /**
  60278. * @member {boolean} [DatasourceConnectionInfo.prototype.OpenLinkTable]
  60279. * @description 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  60280. */
  60281. this.OpenLinkTable = null;
  60282. /**
  60283. * @member {string} [DatasourceConnectionInfo.prototype.password]
  60284. * @description 登录数据源连接的数据库或文件的密码。
  60285. */
  60286. this.password = null;
  60287. /**
  60288. * @member {boolean} [DatasourceConnectionInfo.prototype.readOnly]
  60289. * @description 是否以只读方式打开数据源。
  60290. */
  60291. this.readOnly = null;
  60292. /**
  60293. * @member {string} [DatasourceConnectionInfo.prototype.server]
  60294. * @description 数据库服务器名、文件名或服务地址。
  60295. * 1.对于 SDB 和 UDB 文件,为其文件的绝对路径。注意:当绝对路径的长度超过 UTF-8 编码格式的 260 字节长度,该数据源无法打开。
  60296. * 2.对于 Oracle 数据库,其服务器名为其 TNS 服务名称。
  60297. * 3.对于 SQL Server 数据库,其服务器名为其系统的 DSN(Database Source Name) 名称。
  60298. * 4.对于 PostgreSQL 数据库,其服务器名为 “IP:端口号”,默认的端口号是 5432。
  60299. * 5.对于 DB2 数据库,已经进行了编目,所以不需要进行服务器的设置。
  60300. * 6.对于 Kingbase 数据库,其服务器名为其 IP 地址。
  60301. * 7.对于 GoogleMaps 数据源,其服务器地址,默认设置为 “{@link http://maps.google.com}”,且不可更改。
  60302. * 8.对于 SuperMapCould 数据源,为其服务地址。
  60303. * 9.对于 MAPWORLD 数据源,为其服务地址,默认设置为 “{@link http://www.tianditu.cn}”,且不可更改。
  60304. * 10.对于 OGC 和 REST 数据源,为其服务地址。
  60305. */
  60306. this.server = null;
  60307. /**
  60308. * @member {string} DatasourceConnectionInfo.prototype.user
  60309. * @description 登录数据库的用户名。
  60310. */
  60311. this.user = null;
  60312. if (options) {
  60313. Util_Util.extend(this, options);
  60314. }
  60315. this.CLASS_NAME = "SuperMap.DatasourceConnectionInfo";
  60316. }
  60317. /**
  60318. * @function DatasourceConnectionInfo.prototype.destroy
  60319. * @description 释放资源,将引用资源的属性置空。
  60320. */
  60321. destroy() {
  60322. var me = this;
  60323. me.alias = null;
  60324. me.connect = null;
  60325. me.dataBase = null;
  60326. me.driver = null;
  60327. me.engineType = null;
  60328. me.exclusive = null;
  60329. me.OpenLinkTable = null;
  60330. me.password = null;
  60331. me.readOnly = null;
  60332. me.server = null;
  60333. me.user = null;
  60334. }
  60335. }
  60336. ;// CONCATENATED MODULE: ./src/common/iServer/OutputSetting.js
  60337. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60338. * This program are made available under the terms of the Apache License, Version 2.0
  60339. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60340. /**
  60341. * @class OutputSetting
  60342. * @deprecatedclass SuperMap.OutputSetting
  60343. * @category iServer ProcessingService
  60344. * @classdesc 分布式分析输出类型设置类。
  60345. * @param {Object} options - 参数。
  60346. * @param {DatasourceConnectionInfo} options.datasourceInfo - 数据源连接信息。
  60347. * @param {string} [options.datasetName='analystResult'] - 结果数据集名称。
  60348. * @param {OutputType} [options.type=OutputType.UDB] - 输出类型。
  60349. * @param {string} [options.outputPath] - 分析结果输出路径。
  60350. * @usage
  60351. */
  60352. class OutputSetting {
  60353. constructor(options) {
  60354. /**
  60355. * @member {OutputType} OutputSetting.prototype.type
  60356. * @description 分布式分析的输出类型。
  60357. */
  60358. this.type = OutputType.UDB;
  60359. /**
  60360. * @member {string} [OutputSetting.prototype.datasetName='analystResult']
  60361. * @description 分布式分析的输出结果数据集名称。
  60362. */
  60363. this.datasetName = "analystResult";
  60364. /**
  60365. * @member {DatasourceConnectionInfo} OutputSetting.prototype.datasourceInfo
  60366. * @description 分布式分析的输出结果数据源连接信息。
  60367. */
  60368. this.datasourceInfo = null;
  60369. /**
  60370. * @member {string} [OutputSetting.prototype.outputPath]
  60371. * @description 分布式分析的分析结果输出路径。
  60372. */
  60373. this.outputPath = "";
  60374. Util_Util.extend(this, options);
  60375. this.CLASS_NAME = "SuperMap.OutputSetting";
  60376. }
  60377. /**
  60378. * @function OutputSetting.prototype.destroy
  60379. * @description 释放资源,将引用资源的属性置空。
  60380. */
  60381. destroy() {
  60382. var me = this;
  60383. me.type = null;
  60384. me.datasetName = null;
  60385. me.outputPath = null;
  60386. if (me.datasourceInfo instanceof DatasourceConnectionInfo) {
  60387. me.datasourceInfo.destroy();
  60388. me.datasourceInfo = null;
  60389. }
  60390. }
  60391. }
  60392. ;// CONCATENATED MODULE: ./src/common/iServer/MappingParameters.js
  60393. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60394. * This program are made available under the terms of the Apache License, Version 2.0
  60395. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60396. /**
  60397. * @class MappingParameters
  60398. * @deprecatedclass SuperMap.MappingParameters
  60399. * @category iServer ProcessingService
  60400. * @classdesc 分析后结果可视化的参数类。
  60401. * @param {Object} options - 参数。
  60402. * @param {Array.<ThemeGridRangeItem>} [options.items] - 栅格分段专题图子项数组。
  60403. * @param {number} [options.numericPrecision=1] - 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  60404. * @param {RangeMode} [options.rangeMode=RangeMode.EQUALINTERVAL] - 专题图分段模式。
  60405. * @param {number} [options.rangeCount] - 专题图分段个数。
  60406. * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 专题图颜色渐变模式。
  60407. * @usage
  60408. */
  60409. class MappingParameters {
  60410. constructor(options) {
  60411. /**
  60412. * @member {Array.<ThemeGridRangeItem>} [MappingParameters.prototype.items]
  60413. * @description 栅格分段专题图子项数组。
  60414. */
  60415. this.items = null;
  60416. /**
  60417. * @member {number} [MappingParameters.prototype.numericPrecision=1]
  60418. * @description 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  60419. */
  60420. this.numericPrecision = 1;
  60421. /**
  60422. * @member {RangeMode} [MappingParameters.prototype.RangeMode=RangeMode.EQUALINTERVAL]
  60423. * @description 专题图分段模式。
  60424. */
  60425. this.rangeMode = RangeMode.EQUALINTERVAL;
  60426. /**
  60427. * @member {number} [MappingParameters.prototype.rangeCount]
  60428. * @description 专题图分段个数。
  60429. */
  60430. this.rangeCount = "";
  60431. /**
  60432. * @member {ColorGradientType} [MappingParameters.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
  60433. * @description 专题图颜色渐变模式。
  60434. */
  60435. this.colorGradientType = ColorGradientType.YELLOW_RED;
  60436. Util_Util.extend(this, options);
  60437. this.CLASS_NAME = "SuperMap.MappingParameters";
  60438. }
  60439. /**
  60440. * @function MappingParameters.prototype.destroy
  60441. * @description 释放资源,将引用资源的属性置空。
  60442. */
  60443. destroy() {
  60444. var me = this;
  60445. if (me.items) {
  60446. if (me.items.length > 0) {
  60447. for (var item in me.items) {
  60448. me.items[item].destroy();
  60449. me.items[item] = null;
  60450. }
  60451. }
  60452. me.items = null;
  60453. }
  60454. me.numericPrecision = null;
  60455. me.rangeMode = null;
  60456. me.rangeCount = null;
  60457. me.colorGradientType = null;
  60458. }
  60459. }
  60460. ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobParameter.js
  60461. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60462. * This program are made available under the terms of the Apache License, Version 2.0
  60463. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60464. /**
  60465. * @class KernelDensityJobParameter
  60466. * @deprecatedclass SuperMap.KernelDensityJobParameter
  60467. * @category iServer ProcessingService DensityAnalyst
  60468. * @classdesc 核密度分析服务参数类。
  60469. * @param {Object} options - 参数。
  60470. * @param {string} options.datasetName - 数据集名。
  60471. * @param {string} options.fields - 权重索引。
  60472. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.query] - 分析范围(默认为全图范围)。
  60473. * @param {number} [options.resolution=80] - 分辨率。
  60474. * @param {number} [options.method=0] - 分析方法。
  60475. * @param {number} [options.meshType=0] - 分析类型。
  60476. * @param {number} [options.radius=300] - 分析的影响半径。
  60477. * @param {AnalystSizeUnit} [options.meshSizeUnit=AnalystSizeUnit.METER] - 网格大小单位。
  60478. * @param {AnalystSizeUnit} [options.radiusUnit=AnalystSizeUnit.METER] - 搜索半径单位。
  60479. * @param {AnalystAreaUnit} [options.areaUnit=AnalystAreaUnit.SQUAREMILE] - 面积单位。
  60480. * @param {OutputSetting} [options.output] - 输出参数设置。
  60481. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  60482. * @usage
  60483. */
  60484. class KernelDensityJobParameter {
  60485. constructor(options) {
  60486. if (!options) {
  60487. return;
  60488. }
  60489. /**
  60490. * @member {string} KernelDensityJobParameter.prototype.datasetName
  60491. * @description 数据集名。
  60492. */
  60493. this.datasetName = "";
  60494. /**
  60495. * @member {SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject} [KernelDensityJobParameter.prototype.query]
  60496. * @description 分析范围。
  60497. */
  60498. this.query = "";
  60499. /**
  60500. * @member {number} [KernelDensityJobParameter.prototype.resolution=80]
  60501. * @description 网格大小。
  60502. */
  60503. this.resolution = 80;
  60504. /**
  60505. * @member {number} [KernelDensityJobParameter.prototype.method=0]
  60506. * @description 分析方法。
  60507. */
  60508. this.method = 0;
  60509. /**
  60510. * @member {number} [KernelDensityJobParameter.prototype.meshType=0]
  60511. * @description 分析类型。
  60512. */
  60513. this.meshType = 0;
  60514. /**
  60515. * @member {string} KernelDensityJobParameter.prototype.fields
  60516. * @description 权重索引。
  60517. */
  60518. this.fields = "";
  60519. /**
  60520. * @member {number} [KernelDensityJobParameter.prototype.radius=300]
  60521. * @description 分析的影响半径。
  60522. */
  60523. this.radius = 300;
  60524. /**
  60525. * @member {AnalystSizeUnit} [KernelDensityJobParameter.prototype.meshSizeUnit=AnalystSizeUnit.METER]
  60526. * @description 网格大小单位。
  60527. */
  60528. this.meshSizeUnit = AnalystSizeUnit.METER;
  60529. /**
  60530. * @member {AnalystSizeUnit} [KernelDensityJobParameter.prototype.radiusUnit=AnalystSizeUnit.METER]
  60531. * @description 搜索半径单位。
  60532. */
  60533. this.radiusUnit = AnalystSizeUnit.METER;
  60534. /**
  60535. * @member {AnalystAreaUnit} [KernelDensityJobParameter.prototype.areaUnit=AnalystAreaUnit.SQUAREMILE]
  60536. * @description 面积单位。
  60537. */
  60538. this.areaUnit = AnalystAreaUnit.SQUAREMILE;
  60539. /**
  60540. * @member {OutputSetting} KernelDensityJobParameter.prototype.output
  60541. * @description 输出参数设置类。
  60542. */
  60543. this.output = null;
  60544. /**
  60545. * @member {MappingParameters} [KernelDensityJobParameter.prototype.mappingParameters]
  60546. * @description 分析后结果可视化的参数类。
  60547. */
  60548. this.mappingParameters = null;
  60549. Util_Util.extend(this, options);
  60550. this.CLASS_NAME = "SuperMap.KernelDensityJobParameter";
  60551. }
  60552. /**
  60553. * @function KernelDensityJobParameter.prototype.destroy
  60554. * @description 释放资源,将引用资源的属性置空。
  60555. */
  60556. destroy() {
  60557. this.datasetName = null;
  60558. this.query = null;
  60559. this.resolution = null;
  60560. this.method = null;
  60561. this.radius = null;
  60562. this.meshType = null;
  60563. this.fields = null;
  60564. this.meshSizeUnit = null;
  60565. this.radiusUnit = null;
  60566. this.areaUnit = null;
  60567. if (this.output instanceof OutputSetting) {
  60568. this.output.destroy();
  60569. this.output = null;
  60570. }
  60571. if (this.mappingParameters instanceof MappingParameters) {
  60572. this.mappingParameters.destroy();
  60573. this.mappingParameters = null;
  60574. }
  60575. }
  60576. /**
  60577. * @function KernelDensityJobParameter.toObject
  60578. * @param {KernelDensityJobParameter} kernelDensityJobParameter - 核密度分析服务参数类。
  60579. * @param {KernelDensityJobParameter} tempObj - 核密度分析服务参数对象。
  60580. * @description 将核密度分析服务参数对象转换为 JSON 对象。
  60581. * @returns JSON 对象。
  60582. */
  60583. static toObject(kernelDensityJobParameter, tempObj) {
  60584. for (var name in kernelDensityJobParameter) {
  60585. if (name === "datasetName") {
  60586. tempObj['input'] = tempObj['input'] || {};
  60587. tempObj['input'][name] = kernelDensityJobParameter[name];
  60588. continue;
  60589. }
  60590. if (name === "output") {
  60591. tempObj['output'] = tempObj['output'] || {};
  60592. tempObj['output'] = kernelDensityJobParameter[name];
  60593. continue;
  60594. }
  60595. tempObj['analyst'] = tempObj['analyst'] || {};
  60596. if (name === 'query' && kernelDensityJobParameter[name]) {
  60597. tempObj['analyst'][name] = kernelDensityJobParameter[name].toBBOX();
  60598. } else {
  60599. tempObj['analyst'][name] = kernelDensityJobParameter[name];
  60600. }
  60601. if (name === 'mappingParameters') {
  60602. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  60603. tempObj['analyst']['mappingParameters'] = kernelDensityJobParameter[name];
  60604. }
  60605. }
  60606. }
  60607. }
  60608. ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobsService.js
  60609. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60610. * This program are made available under the terms of the Apache License, Version 2.0
  60611. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60612. /**
  60613. * @class KernelDensityJobsService
  60614. * @deprecatedclass SuperMap.KernelDensityJobsService
  60615. * @category iServer ProcessingService DensityAnalyst
  60616. * @classdesc 核密度分析服务类
  60617. * @extends {ProcessingServiceBase}
  60618. * @param {string} url - 服务地址。
  60619. * @param {Object} options - 可选参数。
  60620. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  60621. * @param {Object} [options.headers] - 请求头。
  60622. * @usage
  60623. */
  60624. class KernelDensityJobsService extends ProcessingServiceBase {
  60625. constructor(url, options) {
  60626. super(url, options);
  60627. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/density');
  60628. this.CLASS_NAME = "SuperMap.KernelDensityJobsService";
  60629. }
  60630. /**
  60631. * @function KernelDensityJobsService.prototype.destroy
  60632. * @override
  60633. */
  60634. destroy() {
  60635. super.destroy();
  60636. }
  60637. /**
  60638. * @function KernelDensityJobsService.prototype.getKernelDensityJobs
  60639. * @description 获取核密度分析任务
  60640. */
  60641. getKernelDensityJobs() {
  60642. super.getJobs(this.url);
  60643. }
  60644. /**
  60645. * @function KernelDensityJobsService.prototype.getKernelDensityJobs
  60646. * @description 获取指定id的核密度分析服务
  60647. * @param {string} id - 指定要获取数据的id
  60648. */
  60649. getKernelDensityJob(id) {
  60650. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  60651. }
  60652. /**
  60653. * @function KernelDensityJobsService.prototype.addKernelDensityJob
  60654. * @description 新建核密度分析服务
  60655. * @param {KernelDensityJobParameter} params - 核密度分析服务参数类。
  60656. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  60657. */
  60658. addKernelDensityJob(params, seconds) {
  60659. super.addJob(this.url, params, KernelDensityJobParameter, seconds);
  60660. }
  60661. }
  60662. ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsParameter.js
  60663. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60664. * This program are made available under the terms of the Apache License, Version 2.0
  60665. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60666. /**
  60667. * @class SingleObjectQueryJobsParameter
  60668. * @deprecatedclass SuperMap.SingleObjectQueryJobsParameter
  60669. * @category iServer ProcessingService Query
  60670. * @classdesc 单对象空间查询分析任务参数类。
  60671. * @param {Object} options - 参数。
  60672. * @param {string} options.datasetName - 数据集名。
  60673. * @param {string} options.datasetQuery - 查询对象所在的数据集名称。
  60674. * @param {SpatialQueryMode} [options.mode=SpatialQueryMode.CONTAIN] - 空间查询模式。
  60675. * @param {OutputSetting} [options.output] - 输出参数设置。
  60676. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  60677. * @usage
  60678. */
  60679. class SingleObjectQueryJobsParameter {
  60680. constructor(options) {
  60681. if (!options) {
  60682. return;
  60683. }
  60684. /**
  60685. * @member {string} SingleObjectQueryJobsParameter.prototype.datasetName
  60686. * @description 数据集名。
  60687. */
  60688. this.datasetName = "";
  60689. /**
  60690. * @member {string} SingleObjectQueryJobsParameter.prototype.datasetQuery
  60691. * @description 查询对象所在的数据集名称。
  60692. */
  60693. this.datasetQuery = "";
  60694. /**
  60695. * @member {string} SingleObjectQueryJobsParameter.prototype.geometryQuery
  60696. * @description 查询对象所在的几何对象。
  60697. */
  60698. this.geometryQuery = "";
  60699. /**
  60700. * @member {SpatialQueryMode} [SingleObjectQueryJobsParameter.prototype.mode=SpatialQueryMode.CONTAIN]
  60701. * @description 空间查询模式 。
  60702. */
  60703. this.mode = SpatialQueryMode.CONTAIN;
  60704. /**
  60705. * @member {OutputSetting} [SingleObjectQueryJobsParameter.prototype.output]
  60706. * @description 输出参数设置类。
  60707. */
  60708. this.output = null;
  60709. /**
  60710. * @member {MappingParameters} [SingleObjectQueryJobsParameter.prototype.mappingParameters]
  60711. * @description 分析后结果可视化的参数类。
  60712. */
  60713. this.mappingParameters = null;
  60714. Util_Util.extend(this, options);
  60715. this.CLASS_NAME = "SuperMap.SingleObjectQueryJobsParameter";
  60716. }
  60717. /**
  60718. * @function SingleObjectQueryJobsParameter.prototype.destroy
  60719. * @description 释放资源,将引用资源的属性置空。
  60720. */
  60721. destroy() {
  60722. this.datasetName = null;
  60723. this.datasetQuery = null;
  60724. this.geometryQuery = null;
  60725. this.mode = null;
  60726. if (this.output instanceof OutputSetting) {
  60727. this.output.destroy();
  60728. this.output = null;
  60729. }
  60730. if (this.mappingParameters instanceof MappingParameters){
  60731. this.mappingParameters.destroy();
  60732. this.mappingParameters = null;
  60733. }
  60734. }
  60735. /**
  60736. * @function SingleObjectQueryJobsParameter.toObject
  60737. * @param {Object} singleObjectQueryJobsParameter - 单对象空间查询分析任务参数。
  60738. * @param {Object} tempObj - 目标对象。
  60739. * @description 生成单对象空间查询分析任务对象。
  60740. */
  60741. static toObject(singleObjectQueryJobsParameter, tempObj) {
  60742. for (var name in singleObjectQueryJobsParameter) {
  60743. if (name === "datasetName") {
  60744. tempObj['input'] = tempObj['input'] || {};
  60745. tempObj['input'][name] = singleObjectQueryJobsParameter[name];
  60746. continue;
  60747. }
  60748. if (name === "output"){
  60749. tempObj['output'] = tempObj['output'] || {};
  60750. tempObj['output'] = singleObjectQueryJobsParameter[name];
  60751. continue;
  60752. }
  60753. tempObj['analyst'] = tempObj['analyst'] || {};
  60754. tempObj['analyst'][name] = singleObjectQueryJobsParameter[name];
  60755. if(name === 'mappingParameters'){
  60756. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  60757. tempObj['analyst']['mappingParameters'] = singleObjectQueryJobsParameter[name];
  60758. }
  60759. }
  60760. }
  60761. }
  60762. ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsService.js
  60763. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60764. * This program are made available under the terms of the Apache License, Version 2.0
  60765. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60766. /**
  60767. * @class SingleObjectQueryJobsService
  60768. * @deprecatedclass SuperMap.SingleObjectQueryJobsService
  60769. * @category iServer ProcessingService Query
  60770. * @classdesc 单对象查询分析服务类
  60771. * @extends {ProcessingServiceBase}
  60772. * @param {string} url - 服务地址。
  60773. * @param {Object} options - 可选参数。
  60774. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  60775. * @param {Object} [options.headers] - 请求头。
  60776. * @usage
  60777. */
  60778. class SingleObjectQueryJobsService extends ProcessingServiceBase {
  60779. constructor(url, options) {
  60780. super(url, options);
  60781. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/query');
  60782. this.CLASS_NAME = 'SuperMap.SingleObjectQueryJobsService';
  60783. }
  60784. /**
  60785. *@override
  60786. */
  60787. destroy() {
  60788. super.destroy();
  60789. }
  60790. /**
  60791. * @function SingleObjectQueryJobsService.protitype.getQueryJobs
  60792. * @description 获取单对象空间查询分析所有任务
  60793. */
  60794. getQueryJobs() {
  60795. super.getJobs(this.url);
  60796. }
  60797. /**
  60798. * @function KernelDensityJobsService.protitype.getQueryJob
  60799. * @description 获取指定id的单对象空间查询分析服务
  60800. * @param {string} id - 指定要获取数据的id
  60801. */
  60802. getQueryJob(id) {
  60803. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  60804. }
  60805. /**
  60806. * @function SingleObjectQueryJobsService.protitype.addQueryJob
  60807. * @description 新建单对象空间查询分析服务
  60808. * @param {SingleObjectQueryJobsParameter} params - 创建一个空间分析的请求参数。
  60809. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  60810. */
  60811. addQueryJob(params, seconds) {
  60812. super.addJob(this.url, params, SingleObjectQueryJobsParameter, seconds);
  60813. }
  60814. }
  60815. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobParameter.js
  60816. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60817. * This program are made available under the terms of the Apache License, Version 2.0
  60818. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60819. /**
  60820. * @class SummaryMeshJobParameter
  60821. * @deprecatedclass SuperMap.SummaryMeshJobParameter
  60822. * @category iServer ProcessingService AggregatePoints
  60823. * @classdesc 点聚合分析任务参数类。
  60824. * @param {Object} options - 参数。
  60825. * @param {string} options.datasetName - 数据集名。
  60826. * @param {string} [options.regionDataset ] - 聚合面数据集(聚合类型为多边形聚合时使用的参数)
  60827. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.query] - 分析范围(默认为全图范围)。
  60828. * @param {number} options.fields - 权重索引。
  60829. * @param {number} [options.resolution=100] - 分辨率。
  60830. * @param {StatisticAnalystMode} [options.statisticModes=StatisticAnalystMode.AVERAGE] - 分析模式。
  60831. * @param {number} [options.meshType=0] - 分析类型。
  60832. * @param {SummaryType} [options.type=SummaryType.SUMMARYMESH] - 聚合类型。
  60833. * @param {OutputSetting} [options.output] - 输出参数设置。
  60834. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  60835. * @usage
  60836. */
  60837. class SummaryMeshJobParameter {
  60838. constructor(options) {
  60839. if (!options) {
  60840. return;
  60841. }
  60842. /**
  60843. * @member {string} SummaryMeshJobParameter.prototype.datasetName
  60844. * @description 数据集名。
  60845. */
  60846. this.datasetName = "";
  60847. /**
  60848. * @member {string} SummaryMeshJobParameter.prototype.regionDataset
  60849. * @description 聚合面数据集(聚合类型为多边形聚合时使用的参数)。
  60850. */
  60851. this.regionDataset = "";
  60852. /**
  60853. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} SummaryMeshJobParameter.prototype.query
  60854. * @description 分析范围(聚合类型为网格面聚合时使用的参数)。
  60855. */
  60856. this.query = "";
  60857. /**
  60858. * @member {number} [SummaryMeshJobParameter.prototype.resolution=100]
  60859. * @description 分辨率(聚合类型为网格面聚合时使用的参数)。
  60860. */
  60861. this.resolution = 100;
  60862. /**
  60863. * @member {number} [SummaryMeshJobParameter.prototype.meshType=0]
  60864. * @description 网格面类型(聚合类型为网格面聚合时使用的参数),取值:0 或 1。
  60865. */
  60866. this.meshType = 0;
  60867. /**
  60868. * @member {StatisticAnalystMode} [SummaryMeshJobParameter.prototype.statisticModes=StatisticAnalystMode.AVERAGE]
  60869. * @description 统计模式。
  60870. */
  60871. this.statisticModes = StatisticAnalystMode.AVERAGE;
  60872. /**
  60873. * @member {number} SummaryMeshJobParameter.prototype.fields
  60874. * @description 权重字段。
  60875. */
  60876. this.fields = "";
  60877. /**
  60878. * @member {SummaryType} [SummaryMeshJobParameter.prototype.type=SummaryType.SUMMARYMESH]
  60879. * @description 聚合类型。
  60880. */
  60881. this.type = SummaryType.SUMMARYMESH;
  60882. /**
  60883. * @member {OutputSetting} [SummaryMeshJobParameter.prototype.output]
  60884. * @description 输出参数设置类。
  60885. */
  60886. this.output = null;
  60887. /**
  60888. * @member {MappingParameters} [SummaryMeshJobParameter.prototype.mappingParameters]
  60889. * @description 分析后结果可视化的参数类。
  60890. */
  60891. this.mappingParameters = null;
  60892. Util_Util.extend(this, options);
  60893. this.CLASS_NAME = "SuperMap.SummaryMeshJobParameter";
  60894. }
  60895. /**
  60896. * @function SummaryMeshJobParameter.prototype.destroy
  60897. * @description 释放资源,将资源的属性置空。
  60898. */
  60899. destroy() {
  60900. this.datasetName = null;
  60901. this.query = null;
  60902. this.resolution = null;
  60903. this.statisticModes = null;
  60904. this.meshType = null;
  60905. this.fields = null;
  60906. this.regionDataset = null;
  60907. this.type = null;
  60908. if (this.output instanceof OutputSetting) {
  60909. this.output.destroy();
  60910. this.output = null;
  60911. }
  60912. if (this.mappingParameters instanceof MappingParameters){
  60913. this.mappingParameters.destroy();
  60914. this.mappingParameters = null;
  60915. }
  60916. }
  60917. /**
  60918. * @function SummaryMeshJobParameter.toObject
  60919. * @param {Object} summaryMeshJobParameter - 点聚合分析任务参数。
  60920. * @param {Object} tempObj - 目标对象。
  60921. * @description 生成点聚合分析任务对象。
  60922. */
  60923. static toObject(summaryMeshJobParameter, tempObj) {
  60924. for (var name in summaryMeshJobParameter) {
  60925. if (name === "datasetName") {
  60926. tempObj['input'] = tempObj['input'] || {};
  60927. tempObj['input'][name] = summaryMeshJobParameter[name];
  60928. continue;
  60929. }
  60930. if (name === "type") {
  60931. tempObj['type'] = summaryMeshJobParameter[name];
  60932. continue;
  60933. }
  60934. if (name === "output") {
  60935. tempObj['output'] = tempObj['output'] || {};
  60936. tempObj['output'] = summaryMeshJobParameter[name];
  60937. continue;
  60938. }
  60939. if (summaryMeshJobParameter.type === 'SUMMARYMESH' && name !== 'regionDataset' || summaryMeshJobParameter.type === 'SUMMARYREGION' && !contains(['meshType', 'resolution', 'query'], name)) {
  60940. tempObj['analyst'] = tempObj['analyst'] || {};
  60941. if (name === 'query' && summaryMeshJobParameter[name]) {
  60942. tempObj['analyst'][name] = summaryMeshJobParameter[name].toBBOX();
  60943. } else {
  60944. tempObj['analyst'][name] = summaryMeshJobParameter[name];
  60945. }
  60946. if(name === 'mappingParameters'){
  60947. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  60948. tempObj['analyst']['mappingParameters'] = summaryMeshJobParameter[name];
  60949. }
  60950. }
  60951. }
  60952. function contains(arr, obj) {
  60953. var i = arr.length;
  60954. while (i--) {
  60955. if (arr[i] === obj) {
  60956. return true;
  60957. }
  60958. }
  60959. return false;
  60960. }
  60961. }
  60962. }
  60963. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobsService.js
  60964. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60965. * This program are made available under the terms of the Apache License, Version 2.0
  60966. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60967. /**
  60968. * @class SummaryMeshJobsService
  60969. * @deprecatedclass SuperMap.SummaryMeshJobsService
  60970. * @category iServer ProcessingService AggregatePoints
  60971. * @classdesc 点聚合分析任务类。
  60972. * @param {string} url - 服务地址。
  60973. * @param {Object} options - 参数。
  60974. * @param {Events} options.events - 处理所有事件的对象。
  60975. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  60976. * @param {number} options.index - 服务地址在数组中的位置。
  60977. * @param {number} options.length - 服务地址数组长度。
  60978. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  60979. * @param {Object} [options.headers] - 请求头。
  60980. * @usage
  60981. */
  60982. class SummaryMeshJobsService extends ProcessingServiceBase {
  60983. constructor(url, options) {
  60984. super(url, options);
  60985. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/aggregatepoints');
  60986. this.CLASS_NAME = 'SuperMap.SummaryMeshJobsService';
  60987. }
  60988. /**
  60989. * @override
  60990. */
  60991. destroy() {
  60992. super.destroy();
  60993. }
  60994. /**
  60995. * @function SummaryMeshJobsService.prototype.getSummaryMeshJobs
  60996. * @description 获取点聚合分析任务
  60997. */
  60998. getSummaryMeshJobs() {
  60999. super.getJobs(this.url);
  61000. }
  61001. /**
  61002. * @function SummaryMeshJobsService.prototype.getSummaryMeshJob
  61003. * @description 获取指定ip的点聚合分析任务
  61004. * @param {string} id - 指定要获取数据的id
  61005. */
  61006. getSummaryMeshJob(id) {
  61007. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  61008. }
  61009. /**
  61010. * @function SummaryMeshJobsService.prototype.addSummaryMeshJob
  61011. * @description 新建点聚合分析服务
  61012. * @param {SummaryMeshJobParameter} params - 创建一个空间分析的请求参数。
  61013. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  61014. */
  61015. addSummaryMeshJob(params, seconds) {
  61016. super.addJob(this.url, params, SummaryMeshJobParameter, seconds);
  61017. }
  61018. }
  61019. ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsParameter.js
  61020. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61021. * This program are made available under the terms of the Apache License, Version 2.0
  61022. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61023. /**
  61024. * @class VectorClipJobsParameter
  61025. * @deprecatedclass SuperMap.VectorClipJobsParameter
  61026. * @category iServer ProcessingService VectorClip
  61027. * @classdesc 矢量裁剪分析任务参数类。
  61028. * @param {Object} options - 参数。
  61029. * @param {string} options.datasetName - 数据集名。
  61030. * @param {string} options.datasetOverlay - 裁剪对象数据集。
  61031. * @param {ClipAnalystMode} [options.mode=ClipAnalystMode.CLIP] - 裁剪分析模式。
  61032. * @param {string} [options.geometryClip] - 裁剪几何对象。
  61033. * @param {OutputSetting} [options.output] - 输出参数设置。
  61034. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  61035. * @usage
  61036. */
  61037. class VectorClipJobsParameter {
  61038. constructor(options) {
  61039. options = options || {};
  61040. /**
  61041. * @member {string} VectorClipJobsParameter.prototype.datasetName
  61042. * @description 数据集名。
  61043. */
  61044. this.datasetName = "";
  61045. /**
  61046. * @member {string} VectorClipJobsParameter.prototype.datasetOverlay
  61047. * @description 裁剪对象数据集。
  61048. */
  61049. this.datasetVectorClip = "";
  61050. /**
  61051. * @member {string} VectorClipJobsParameter.prototype.geometryClip
  61052. * @description 裁剪几何对象。
  61053. */
  61054. this.geometryClip = "";
  61055. /**
  61056. * @member {ClipAnalystMode} [VectorClipJobsParameter.prototype.mode=ClipAnalystMode.CLIP]
  61057. * @description 裁剪分析模式 。
  61058. */
  61059. this.mode = ClipAnalystMode.CLIP;
  61060. /**
  61061. * @member {OutputSetting} VectorClipJobsParameter.prototype.output
  61062. * @description 输出参数设置类。
  61063. */
  61064. this.output = null;
  61065. /**
  61066. * @member {MappingParameters} [VectorClipJobsParameter.prototype.mappingParameters]
  61067. * @description 分析后结果可视化的参数类。
  61068. */
  61069. this.mappingParameters = null;
  61070. Util_Util.extend(this, options);
  61071. this.CLASS_NAME = "SuperMap.VectorClipJobsParameter";
  61072. }
  61073. /**
  61074. * @function VectorClipJobsParameter.prototype.destroy
  61075. * @description 释放资源,将引用资源的属性置空。
  61076. */
  61077. destroy() {
  61078. this.datasetName = null;
  61079. this.datasetVectorClip = null;
  61080. this.geometryClip = null;
  61081. this.mode = null;
  61082. if (this.output instanceof OutputSetting) {
  61083. this.output.destroy();
  61084. this.output = null;
  61085. }
  61086. if (this.mappingParameters instanceof MappingParameters) {
  61087. this.mappingParameters.destroy();
  61088. this.mappingParameters = null;
  61089. }
  61090. }
  61091. /**
  61092. * @function VectorClipJobsParameter.toObject
  61093. * @param {Object} vectorClipJobsParameter - 区域汇总分析服务参数。
  61094. * @param {Object} tempObj - 目标对象。
  61095. * @description 矢量裁剪分析任务对象。
  61096. */
  61097. static toObject(vectorClipJobsParameter, tempObj) {
  61098. for (var name in vectorClipJobsParameter) {
  61099. if (name === "datasetName") {
  61100. tempObj['input'] = tempObj['input'] || {};
  61101. tempObj['input'][name] = vectorClipJobsParameter[name];
  61102. continue;
  61103. }
  61104. if (name === "output"){
  61105. tempObj['output'] = tempObj['output'] || {};
  61106. tempObj['output'] = vectorClipJobsParameter[name];
  61107. continue;
  61108. }
  61109. tempObj['analyst'] = tempObj['analyst'] || {};
  61110. tempObj['analyst'][name] = vectorClipJobsParameter[name];
  61111. if(name === 'mappingParameters'){
  61112. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  61113. tempObj['analyst']['mappingParameters'] = vectorClipJobsParameter[name];
  61114. }
  61115. }
  61116. }
  61117. }
  61118. ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsService.js
  61119. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61120. * This program are made available under the terms of the Apache License, Version 2.0
  61121. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61122. /**
  61123. * @class VectorClipJobsService
  61124. * @deprecatedclass SuperMap.VectorClipJobsService
  61125. * @category iServer ProcessingService VectorClip
  61126. * @classdesc 矢量裁剪分析服务类
  61127. * @extends {ProcessingServiceBase}
  61128. * @param {string} url -服务地址。
  61129. * @param {Object} options - 可选参数。
  61130. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  61131. * @param {Object} [options.headers] - 请求头。
  61132. * @usage
  61133. */
  61134. class VectorClipJobsService extends ProcessingServiceBase {
  61135. constructor(url, options) {
  61136. super(url, options);
  61137. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/vectorclip');
  61138. this.CLASS_NAME = 'SuperMap.VectorClipJobsService';
  61139. }
  61140. /**
  61141. *@override
  61142. */
  61143. destroy() {
  61144. super.destroy();
  61145. }
  61146. /**
  61147. * @function VectorClipJobsService.protitype.getVectorClipJobs
  61148. * @description 获取矢量裁剪分析所有任务
  61149. */
  61150. getVectorClipJobs() {
  61151. super.getJobs(this.url);
  61152. }
  61153. /**
  61154. * @function KernelDensityJobsService.protitype.getVectorClipJob
  61155. * @description 获取指定id的矢量裁剪分析服务
  61156. * @param {string} id - 指定要获取数据的id
  61157. */
  61158. getVectorClipJob(id) {
  61159. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  61160. }
  61161. /**
  61162. * @function VectorClipJobsService.protitype.addVectorClipJob
  61163. * @description 新建矢量裁剪分析服务
  61164. * @param {VectorClipJobsParameter} params - 创建一个空间分析的请求参数。
  61165. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  61166. */
  61167. addVectorClipJob(params, seconds) {
  61168. super.addJob(this.url, params, VectorClipJobsParameter, seconds);
  61169. }
  61170. }
  61171. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobParameter.js
  61172. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61173. * This program are made available under the terms of the Apache License, Version 2.0
  61174. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61175. /**
  61176. * @class OverlayGeoJobParameter
  61177. * @deprecatedclass SuperMap.OverlayGeoJobParameter
  61178. * @category iServer ProcessingService OverlayAnalyst
  61179. * @classdesc 叠加分析任务参数类。
  61180. * @param {Object} options - 参数。
  61181. * @param {string} options.datasetName - 数据集名。
  61182. * @param {string} options.datasetOverlay - 叠加对象所在的数据集名称。
  61183. * @param {string} options.srcFields - 输入数据需要保留的字段。
  61184. * @param {string} [options.overlayFields] - 叠加数据需要保留的字段。对分析模式为 clip、update、erase 时,此参数无效。
  61185. * @param {string} [options.mode] - 叠加分析模式。
  61186. * @param {OutputSetting} [options.output] - 输出参数设置。
  61187. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  61188. * @usage
  61189. */
  61190. class OverlayGeoJobParameter {
  61191. constructor(options) {
  61192. if (!options) {
  61193. return;
  61194. }
  61195. /**
  61196. * @member {string} OverlayGeoJobParameter.prototype.datasetName
  61197. * @description 数据集名。
  61198. */
  61199. this.datasetName = "";
  61200. /**
  61201. * @member {string} OverlayGeoJobParameter.prototype.datasetOverlay
  61202. * @description 叠加对象所在的数据集名称。
  61203. */
  61204. this.datasetOverlay = "";
  61205. /**
  61206. * @member {string} [OverlayGeoJobParameter.prototype.mode]
  61207. * @description 叠加分析模式。
  61208. */
  61209. this.mode = "";
  61210. /**
  61211. * @member {string} OverlayGeoJobParameter.prototype.srcFields
  61212. * @description 输入数据需要保留的字段。
  61213. */
  61214. this.srcFields = "";
  61215. /**
  61216. * @member {string} OverlayGeoJobParameter.prototype.overlayFields
  61217. * @description 叠加数据需要保留的字段,对分析模式为 clip、update、erase 时,此参数无效。
  61218. */
  61219. this.overlayFields = "";
  61220. /**
  61221. * @member {OutputSetting} [OverlayGeoJobParameter.prototype.output]
  61222. * @description 输出参数设置类。
  61223. */
  61224. this.output = null;
  61225. /**
  61226. * @member {MappingParameters} [OverlayGeoJobParameter.prototype.mappingParameters]
  61227. * @description 分析后结果可视化的参数类。
  61228. */
  61229. this.mappingParameters = null;
  61230. Util_Util.extend(this, options);
  61231. this.CLASS_NAME = "SuperMap.OverlayGeoJobParameter";
  61232. }
  61233. /**
  61234. * @function OverlayGeoJobParameter.prototype.destroy
  61235. * @description 释放资源,将资源的属性置空。
  61236. */
  61237. destroy() {
  61238. this.datasetName = null;
  61239. this.datasetOverlay = null;
  61240. this.mode = null;
  61241. this.srcFields = null;
  61242. this.overlayFields = null;
  61243. if (this.output instanceof OutputSetting) {
  61244. this.output.destroy();
  61245. this.output = null;
  61246. }
  61247. if (this.mappingParameters instanceof MappingParameters) {
  61248. this.mappingParameters.destroy();
  61249. this.mappingParameters = null;
  61250. }
  61251. }
  61252. /**
  61253. * @function OverlayGeoJobParameter.toObject
  61254. * @param {Object} OverlayGeoJobParameter - 点聚合分析任务参数。
  61255. * @param {Object} tempObj - 目标对象。
  61256. * @description 生成点聚合分析任务对象。
  61257. */
  61258. static toObject(OverlayGeoJobParameter, tempObj) {
  61259. for (var name in OverlayGeoJobParameter) {
  61260. if (name == "datasetName") {
  61261. tempObj['input'] = tempObj['input'] || {};
  61262. tempObj['input'][name] = OverlayGeoJobParameter[name];
  61263. continue;
  61264. }
  61265. if (name === "output") {
  61266. tempObj['output'] = tempObj['output'] || {};
  61267. tempObj['output'] = OverlayGeoJobParameter[name];
  61268. continue;
  61269. }
  61270. tempObj['analyst'] = tempObj['analyst'] || {};
  61271. tempObj['analyst'][name] = OverlayGeoJobParameter[name];
  61272. if(name === 'mappingParameters'){
  61273. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  61274. tempObj['analyst']['mappingParameters'] = OverlayGeoJobParameter[name];
  61275. }
  61276. }
  61277. }
  61278. }
  61279. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobsService.js
  61280. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61281. * This program are made available under the terms of the Apache License, Version 2.0
  61282. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61283. /**
  61284. * @class OverlayGeoJobsService
  61285. * @deprecatedclass SuperMap.OverlayGeoJobsService
  61286. * @category iServer ProcessingService OverlayAnalyst
  61287. * @classdesc 叠加分析任务类。
  61288. * @param {string} url - 服务地址。
  61289. * @param {Object} options - 参数。
  61290. * @param {Events} options.events - 处理所有事件的对象。
  61291. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  61292. * @param {number} options.index - 服务访问地址在数组中的位置。
  61293. * @param {number} options.length - 服务访问地址数组长度。
  61294. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  61295. * @param {Object} [options.headers] - 请求头。
  61296. * @usage
  61297. */
  61298. class OverlayGeoJobsService extends ProcessingServiceBase {
  61299. constructor(url, options) {
  61300. super(url, options);
  61301. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/overlay');
  61302. this.CLASS_NAME = 'SuperMap.OverlayGeoJobsService';
  61303. }
  61304. /**
  61305. * @override
  61306. */
  61307. destroy() {
  61308. super.destroy();
  61309. }
  61310. /**
  61311. * @function OverlayGeoJobsService.prototype.getOverlayGeoJobs
  61312. * @description 获取叠加分析任务
  61313. */
  61314. getOverlayGeoJobs() {
  61315. super.getJobs(this.url);
  61316. }
  61317. /**
  61318. * @function OverlayGeoJobsService.prototype.getOverlayGeoJob
  61319. * @description 获取指定id的叠加分析任务
  61320. * @param {string} id - 指定要获取数据的id
  61321. */
  61322. getOverlayGeoJob(id) {
  61323. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  61324. }
  61325. /**
  61326. * @function OverlayGeoJobsService.prototype.addOverlayGeoJob
  61327. * @description 新建点叠加析服务
  61328. * @param {OverlayGeoJobParameter} params - 创建一个叠加分析的请求参数。
  61329. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  61330. */
  61331. addOverlayGeoJob(params, seconds) {
  61332. super.addJob(this.url, params, OverlayGeoJobParameter, seconds);
  61333. }
  61334. }
  61335. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobParameter.js
  61336. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61337. * This program are made available under the terms of the Apache License, Version 2.0
  61338. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61339. /**
  61340. * @class SummaryRegionJobParameter
  61341. * @deprecatedclass SuperMap.SummaryRegionJobParameter
  61342. * @category iServer ProcessingService SummaryRegion
  61343. * @classdesc 区域汇总分析任务参数类。
  61344. * @param {Object} options - 参数。
  61345. * @param {string} options.datasetName - 数据集名。
  61346. * @param {string} [options.regionDataset] - 汇总数据源(多边形汇总时用到的参数)。
  61347. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.query] - 分析范围(默认为全图范围)。
  61348. * @param {string} [options.standardFields] - 标准属性字段名称。
  61349. * @param {string} [options.weightedFields] - 权重字段名称。
  61350. * @param {StatisticAnalystMode} [options.standardStatisticModes] - 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  61351. * @param {StatisticAnalystMode} [options.weightedStatisticModes] - 权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  61352. * @param {boolean} [options.sumShape=true] - 是否统计长度或面积。
  61353. * @param {boolean} [options.standardSummaryFields=false] - 是否以标准属性字段统计。
  61354. * @param {boolean} [options.weightedSummaryFields=false] - 是否以权重字段统计。
  61355. * @param {number} [options.resolution=100] - 网格大小。
  61356. * @param {number} [options.meshType=0] - 网格面汇总类型。
  61357. * @param {AnalystSizeUnit} [options.meshSizeUnit=AnalystSizeUnit.METER] - 网格大小单位。
  61358. * @param {SummaryType} [options.type=SummaryType.SUMMARYMESH] - 汇总类型。
  61359. * @param {OutputSetting} [options.output] - 输出参数设置。
  61360. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  61361. * @usage
  61362. */
  61363. class SummaryRegionJobParameter {
  61364. constructor(options) {
  61365. if (!options) {
  61366. return;
  61367. }
  61368. /**
  61369. * @member {string} SummaryRegionJobParameter.prototype.datasetName
  61370. * @description 数据集名。
  61371. */
  61372. this.datasetName = "";
  61373. /**
  61374. * @member {string} SummaryRegionJobParameter.prototype.regionDataset
  61375. * @description 汇总数据源(多边形汇总时用到的参数)。
  61376. */
  61377. this.regionDataset = "";
  61378. /**
  61379. * @member {boolean} [SummaryRegionJobParameter.prototype.sumShape=true]
  61380. * @description 是否统计长度或面积。
  61381. */
  61382. this.sumShape = true;
  61383. /**
  61384. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} SummaryRegionJobParameter.prototype.query
  61385. * @description 分析范围。
  61386. */
  61387. this.query = "";
  61388. /**
  61389. * @member {boolean} [SummaryRegionJobParameter.prototype.standardSummaryFields=false]
  61390. * @description 是否以标准属字段统计。
  61391. */
  61392. this.standardSummaryFields = false;
  61393. /**
  61394. * @member {string} SummaryRegionJobParameter.prototype.standardFields
  61395. * @description 标准属性字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。standardSummaryFields 为 true 时必填。
  61396. */
  61397. this.standardFields = "";
  61398. /**
  61399. * @member {StatisticAnalystMode} SummaryRegionJobParameter.prototype.standardStatisticModes
  61400. * @description 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  61401. */
  61402. this.standardStatisticModes = "";
  61403. /**
  61404. * @member {boolean} [SummaryRegionJobParameter.prototype.weightedSummaryFields=false]
  61405. * @description 是否以权重字段统计。
  61406. */
  61407. this.weightedSummaryFields = false;
  61408. /**
  61409. * @member {string} SummaryRegionJobParameter.prototype.weightedFields
  61410. * @description 权重字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。weightedSummaryFields 为 true 时必填。
  61411. */
  61412. this.weightedFields = "";
  61413. /**
  61414. * @member {StatisticAnalystMode} SummaryRegionJobParameter.prototype.weightedStatisticModes
  61415. * @description 以权重字段统计的统计模式。权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  61416. */
  61417. this.weightedStatisticModes = "";
  61418. /**
  61419. * @member {number} [SummaryRegionJobParameter.prototype.meshType=0]
  61420. * @description 网格面汇总类型。
  61421. */
  61422. this.meshType = 0;
  61423. /**
  61424. * @member {number} [SummaryRegionJobParameter.prototype.resolution=100]
  61425. * @description 网格大小。
  61426. */
  61427. this.resolution = 100;
  61428. /**
  61429. * @member {AnalystSizeUnit} [SummaryRegionJobParameter.prototype.meshSizeUnit=AnalystSizeUnit.METER]
  61430. * @description 网格大小单位。
  61431. */
  61432. this.meshSizeUnit = AnalystSizeUnit.METER;
  61433. /**
  61434. * @member {SummaryType} [SummaryRegionJobParameter.prototype.type=SummaryType.SUMMARYMESH]
  61435. * @description 汇总类型。
  61436. */
  61437. this.type = SummaryType.SUMMARYMESH;
  61438. /**
  61439. * @member {OutputSetting} SummaryRegionJobParameter.prototype.output
  61440. * @description 输出参数设置类。
  61441. */
  61442. this.output = null;
  61443. /**
  61444. * @member {MappingParameters} [SummaryRegionJobParameter.prototype.mappingParameters]
  61445. * @description 分析后结果可视化的参数类。
  61446. */
  61447. this.mappingParameters = null;
  61448. Util_Util.extend(this, options);
  61449. this.CLASS_NAME = "SuperMap.SummaryRegionJobParameter";
  61450. }
  61451. /**
  61452. * @function SummaryRegionJobParameter.prototype.destroy
  61453. * @description 释放资源,将引用资源的属性置空。
  61454. */
  61455. destroy() {
  61456. this.datasetName = null;
  61457. this.sumShape = null;
  61458. this.regionDataset = null;
  61459. this.query = null;
  61460. this.standardSummaryFields = null;
  61461. this.standardFields = null;
  61462. this.standardStatisticModes = null;
  61463. this.weightedSummaryFields = null;
  61464. this.weightedFields = null;
  61465. this.weightedStatisticModes = null;
  61466. this.meshType = null;
  61467. this.resolution = null;
  61468. this.meshSizeUnit = null;
  61469. this.type = null;
  61470. if (this.output instanceof OutputSetting) {
  61471. this.output.destroy();
  61472. this.output = null;
  61473. }
  61474. if (this.mappingParameters instanceof MappingParameters){
  61475. this.mappingParameters.destroy();
  61476. this.mappingParameters = null;
  61477. }
  61478. }
  61479. /**
  61480. * @function SummaryRegionJobParameter.toObject
  61481. * @param {Object} summaryRegionJobParameter - 矢量裁剪分析任务参数。
  61482. * @param {Object} tempObj - 目标对象。
  61483. * @description 生成区域汇总分析服务对象。
  61484. */
  61485. static toObject(summaryRegionJobParameter, tempObj) {
  61486. for (var name in summaryRegionJobParameter) {
  61487. if (name === "datasetName") {
  61488. tempObj['input'] = tempObj['input'] || {};
  61489. tempObj['input'][name] = summaryRegionJobParameter[name];
  61490. continue;
  61491. }
  61492. if (name === "type") {
  61493. tempObj['type'] = summaryRegionJobParameter[name];
  61494. continue;
  61495. }
  61496. if (name === "type") {
  61497. tempObj['type'] = summaryRegionJobParameter[name];
  61498. continue;
  61499. }
  61500. if (name === "output") {
  61501. tempObj['output'] = tempObj['output'] || {};
  61502. tempObj['output'] = summaryRegionJobParameter[name];
  61503. continue;
  61504. }
  61505. if (summaryRegionJobParameter.type === "SUMMARYREGION" || summaryRegionJobParameter.type === "SUMMARYMESH" && name !== "regionDataset") {
  61506. tempObj['analyst'] = tempObj['analyst'] || {};
  61507. if (name === 'query' && summaryRegionJobParameter[name]) {
  61508. tempObj['analyst'][name] = summaryRegionJobParameter[name].toBBOX();
  61509. } else {
  61510. tempObj['analyst'][name] = summaryRegionJobParameter[name];
  61511. }
  61512. if(name === 'mappingParameters'){
  61513. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  61514. tempObj['analyst']['mappingParameters'] = summaryRegionJobParameter[name];
  61515. }
  61516. }
  61517. }
  61518. }
  61519. }
  61520. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobsService.js
  61521. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61522. * This program are made available under the terms of the Apache License, Version 2.0
  61523. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61524. /**
  61525. * @class SummaryRegionJobsService
  61526. * @deprecatedclass SuperMap.SummaryRegionJobsService
  61527. * @category iServer ProcessingService SummaryRegion
  61528. * @classdesc 区域汇总分析服务类
  61529. * @extends {ProcessingServiceBase}
  61530. * @param {string} url - 服务地址。
  61531. * @param {Object} options - 可选参数。
  61532. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  61533. * @param {Object} [options.headers] - 请求头。
  61534. * @usage
  61535. */
  61536. class SummaryRegionJobsService extends ProcessingServiceBase {
  61537. constructor(url, options) {
  61538. super(url, options);
  61539. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/summaryregion');
  61540. this.CLASS_NAME = 'SuperMap.SummaryRegionJobsService';
  61541. }
  61542. /**
  61543. *@override
  61544. */
  61545. destroy() {
  61546. super.destroy();
  61547. }
  61548. /**
  61549. * @function SummaryRegionJobsService.prototype.getSummaryRegionJobs
  61550. * @description 获取区域汇总分析任务集合。
  61551. */
  61552. getSummaryRegionJobs() {
  61553. super.getJobs(this.url);
  61554. }
  61555. /**
  61556. * @function SummaryRegionJobsService.prototype.getSummaryRegionJob
  61557. * @description 获取指定id的区域汇总分析任务。
  61558. * @param {string} id -要获取区域汇总分析任务的id
  61559. */
  61560. getSummaryRegionJob(id) {
  61561. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  61562. }
  61563. /**
  61564. * @function SummaryRegionJobsService.prototype.addSummaryRegionJob
  61565. * @description 新建区域汇总任务。
  61566. * @param {SummaryRegionJobParameter} params - 区域汇总分析任务参数类。
  61567. * @param {number} seconds - 创建成功结果的时间间隔。
  61568. */
  61569. addSummaryRegionJob(params, seconds) {
  61570. super.addJob(this.url, params, SummaryRegionJobParameter, seconds);
  61571. }
  61572. }
  61573. ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsParameter.js
  61574. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61575. * This program are made available under the terms of the Apache License, Version 2.0
  61576. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61577. /**
  61578. * @class BuffersAnalystJobsParameter
  61579. * @deprecatedclass SuperMap.BuffersAnalystJobsParameter
  61580. * @category iServer ProcessingService BufferAnalyst
  61581. * @classdesc 缓冲区分析任务参数类。
  61582. * @param {Object} options - 参数。
  61583. * @param {string} options.datasetName - 数据集名。
  61584. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.bounds] - 分析范围(默认为全图范围)。
  61585. * @param {string} [options.distance='15'] - 缓冲距离,或缓冲区半径。
  61586. * @param {string} [options.distanceField='pickup_latitude'] - 缓冲区分析距离字段。
  61587. * @param {AnalystSizeUnit} [options.distanceUnit=AnalystSizeUnit.METER] - 缓冲距离单位单位。
  61588. * @param {OutputSetting} [options.output] - 输出参数设置。
  61589. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  61590. * @usage
  61591. */
  61592. class BuffersAnalystJobsParameter {
  61593. constructor(options) {
  61594. /**
  61595. * @member {string} BuffersAnalystJobsParameter.prototype.datasetName
  61596. * @description 数据集名。
  61597. */
  61598. this.datasetName = '';
  61599. /**
  61600. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} BuffersAnalystJobsParameter.prototype.bounds
  61601. * @description 分析范围。
  61602. */
  61603. this.bounds = '';
  61604. /**
  61605. * @member {string} [BuffersAnalystJobsParameter.prototype.distance='15']
  61606. * @description 缓冲距离,或称为缓冲区半径。当缓冲距离字段为空时,此参数有效。
  61607. */
  61608. this.distance = '';
  61609. /**
  61610. * @member {string} [BuffersAnalystJobsParameter.prototype.distanceField='pickup_latitude']
  61611. * @description 缓冲距离字段。
  61612. */
  61613. this.distanceField = '';
  61614. /**
  61615. * @member {AnalystSizeUnit} [BuffersAnalystJobsParameter.prototype.distanceUnit=AnalystSizeUnit.METER]
  61616. * @description 缓冲距离单位。
  61617. */
  61618. this.distanceUnit = AnalystSizeUnit.METER;
  61619. /**
  61620. * @member {string} BuffersAnalystJobsParameter.prototype.dissolveField
  61621. * @description 融合字段,根据字段值对缓冲区结果面对象进行融合。
  61622. */
  61623. this.dissolveField = '';
  61624. /**
  61625. * @member {OutputSetting} [BuffersAnalystJobsParameter.prototype.output]
  61626. * @description 输出参数设置类。
  61627. */
  61628. this.output = null;
  61629. /**
  61630. * @member {MappingParameters} [BuffersAnalystJobsParameter.prototype.mappingParameters]
  61631. * @description 分析后结果可视化的参数类。
  61632. */
  61633. this.mappingParameters = null;
  61634. if (!options) {
  61635. return this;
  61636. }
  61637. Util_Util.extend(this, options);
  61638. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsParameter';
  61639. }
  61640. /**
  61641. * @function BuffersAnalystJobsParameter.prototype.destroy
  61642. * @description 释放资源,将引用资源的属性置空。
  61643. */
  61644. destroy() {
  61645. this.datasetName = null;
  61646. this.bounds = null;
  61647. this.distance = null;
  61648. this.distanceField = null;
  61649. this.distanceUnit = null;
  61650. this.dissolveField = null;
  61651. if (this.output instanceof OutputSetting) {
  61652. this.output.destroy();
  61653. this.output = null;
  61654. }
  61655. if (this.mappingParameters instanceof MappingParameters) {
  61656. this.mappingParameters.destroy();
  61657. this.mappingParameters = null;
  61658. }
  61659. }
  61660. /**
  61661. * @function BuffersAnalystJobsParameter.toObject
  61662. * @param {BuffersAnalystJobsParameter} BuffersAnalystJobsParameter - 缓冲区分析任务参数。
  61663. * @param {Object} tempObj - 目标对象。
  61664. * @description 生成缓冲区分析任务对象。
  61665. */
  61666. static toObject(BuffersAnalystJobsParameter, tempObj) {
  61667. for (var name in BuffersAnalystJobsParameter) {
  61668. if (name === 'datasetName') {
  61669. tempObj['input'] = tempObj['input'] || {};
  61670. tempObj['input'][name] = BuffersAnalystJobsParameter[name];
  61671. continue;
  61672. }
  61673. if (name === 'output') {
  61674. tempObj['output'] = tempObj['output'] || {};
  61675. tempObj['output'] = BuffersAnalystJobsParameter[name];
  61676. continue;
  61677. }
  61678. tempObj['analyst'] = tempObj['analyst'] || {};
  61679. if (name === 'bounds' && BuffersAnalystJobsParameter[name]) {
  61680. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name].toBBOX();
  61681. } else {
  61682. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name];
  61683. }
  61684. if (name === 'mappingParameters') {
  61685. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  61686. tempObj['analyst']['mappingParameters'] = BuffersAnalystJobsParameter[name];
  61687. }
  61688. }
  61689. }
  61690. }
  61691. ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsService.js
  61692. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61693. * This program are made available under the terms of the Apache License, Version 2.0
  61694. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61695. /**
  61696. * @class BuffersAnalystJobsService
  61697. * @deprecatedclass SuperMap.BuffersAnalystJobsService
  61698. * @category iServer ProcessingService BufferAnalyst
  61699. * @classdesc 缓冲区分析服务类。
  61700. * @extends {ProcessingServiceBase}
  61701. * @param {string} url - 服务地址。
  61702. * @param {Object} options - 参数。
  61703. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  61704. * @param {Object} [options.headers] - 请求头。
  61705. * @usage
  61706. */
  61707. class BuffersAnalystJobsService extends ProcessingServiceBase {
  61708. constructor(url, options) {
  61709. super(url, options);
  61710. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/buffers');
  61711. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsService';
  61712. }
  61713. /**
  61714. *@override
  61715. */
  61716. destroy() {
  61717. super.destroy();
  61718. }
  61719. /**
  61720. * @function BuffersAnalystJobsService.prototype.getBufferJobs
  61721. * @description 获取缓冲区分析所有任务
  61722. */
  61723. getBuffersJobs() {
  61724. super.getJobs(this.url);
  61725. }
  61726. /**
  61727. * @function BuffersAnalystJobsService.prototype.getBufferJob
  61728. * @description 获取指定id的缓冲区分析服务
  61729. * @param {string} id - 指定要获取数据的id。
  61730. */
  61731. getBuffersJob(id) {
  61732. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  61733. }
  61734. /**
  61735. * @function BuffersAnalystJobsService.prototype.addBufferJob
  61736. * @description 新建缓冲区分析服务
  61737. * @param {BuffersAnalystJobsParameter} params - 创建一个空间分析的请求参数。
  61738. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  61739. */
  61740. addBuffersJob(params, seconds) {
  61741. super.addJob(this.url, params, BuffersAnalystJobsParameter, seconds);
  61742. }
  61743. }
  61744. ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsParameter.js
  61745. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61746. * This program are made available under the terms of the Apache License, Version 2.0
  61747. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61748. /**
  61749. * @class TopologyValidatorJobsParameter
  61750. * @deprecatedclass SuperMap.TopologyValidatorJobsParameter
  61751. * @category iServer ProcessingService TopologyValidator
  61752. * @classdesc 拓扑检查分析任务参数类。
  61753. * @param {Object} options - 参数。
  61754. * @param {string} options.datasetName - 数据集名。
  61755. * @param {string} options.datasetTopology -检查对象所在的数据集名称。
  61756. * @param {TopologyValidatorRule} [options.rule=TopologyValidatorRule.REGIONNOOVERLAP] - 拓扑检查规则。
  61757. * @param {string} [options.tolerance] - 容限。
  61758. * @param {OutputSetting} [options.output] - 输出参数设置。
  61759. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  61760. * @usage
  61761. */
  61762. class TopologyValidatorJobsParameter {
  61763. constructor(options) {
  61764. if (!options) {
  61765. return;
  61766. }
  61767. /**
  61768. * @member {string} TopologyValidatorJobsParameter.prototype.datasetName
  61769. * @description 数据集名。
  61770. */
  61771. this.datasetName = "";
  61772. /**
  61773. * @member {string} TopologyValidatorJobsParameter.prototype.datasetTopology
  61774. * @description 拓扑检查对象所在的数据集名称。
  61775. */
  61776. this.datasetTopology = "";
  61777. /**
  61778. * @member {string} [TopologyValidatorJobsParameter.prototype.tolerance]
  61779. * @description 容限,指定的拓扑错误检查时使用的容限。
  61780. */
  61781. this.tolerance = "";
  61782. /**
  61783. * @member {TopologyValidatorRule} [TopologyValidatorJobsParameter.prototype.rule=TopologyValidatorRule.REGIONNOOVERLAP]
  61784. * @description 拓扑检查模式。
  61785. */
  61786. this.rule = TopologyValidatorRule.REGIONNOOVERLAP;
  61787. /**
  61788. * @member {OutputSetting} [TopologyValidatorJobsParameter.prototype.output]
  61789. * @description 输出参数设置类。
  61790. */
  61791. this.output = null;
  61792. /**
  61793. * @member {MappingParameters} [TopologyValidatorJobsParameter.prototype.mappingParameters]
  61794. * @description 分析后结果可视化的参数类。
  61795. */
  61796. this.mappingParameters = null;
  61797. Util_Util.extend(this, options);
  61798. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsParameter";
  61799. }
  61800. /**
  61801. * @function TopologyValidatorJobsParameter.prototype.destroy
  61802. * @description 释放资源,将引用资源的属性置空。
  61803. */
  61804. destroy() {
  61805. this.datasetName = null;
  61806. this.datasetTopology = null;
  61807. this.tolerance = null;
  61808. this.rule = null;
  61809. if (this.output instanceof OutputSetting) {
  61810. this.output.destroy();
  61811. this.output = null;
  61812. }
  61813. if (this.mappingParameters instanceof MappingParameters) {
  61814. this.mappingParameters.destroy();
  61815. this.mappingParameters = null;
  61816. }
  61817. }
  61818. /**
  61819. * @function TopologyValidatorJobsParameter.toObject
  61820. * @param {Object} TopologyValidatorJobsParameter -拓扑检查分析任务参数。
  61821. * @param {Object} tempObj - 目标对象。
  61822. * @description 生成拓扑检查分析任务对象。
  61823. */
  61824. static toObject(TopologyValidatorJobsParameter, tempObj) {
  61825. for (var name in TopologyValidatorJobsParameter) {
  61826. if (name === "datasetName") {
  61827. tempObj['input'] = tempObj['input'] || {};
  61828. tempObj['input'][name] = TopologyValidatorJobsParameter[name];
  61829. continue;
  61830. }
  61831. if (name === "output") {
  61832. tempObj['output'] = tempObj['output'] || {};
  61833. tempObj['output'] = TopologyValidatorJobsParameter[name];
  61834. continue;
  61835. }
  61836. tempObj['analyst'] = tempObj['analyst'] || {};
  61837. tempObj['analyst'][name] = TopologyValidatorJobsParameter[name];
  61838. if(name === 'mappingParameters'){
  61839. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  61840. tempObj['analyst']['mappingParameters'] = TopologyValidatorJobsParameter[name];
  61841. }
  61842. }
  61843. }
  61844. }
  61845. ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsService.js
  61846. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61847. * This program are made available under the terms of the Apache License, Version 2.0
  61848. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61849. /**
  61850. * @class TopologyValidatorJobsService
  61851. * @deprecatedclass SuperMap.TopologyValidatorJobsService
  61852. * @category iServer ProcessingService TopologyValidator
  61853. * @classdesc 拓扑检查分析服务类
  61854. * @extends {ProcessingServiceBase}
  61855. * @param {string} url - 服务地址。
  61856. * @param {Object} options - 可选参数。
  61857. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  61858. * @param {Object} [options.headers] - 请求头。
  61859. * @usage
  61860. */
  61861. class TopologyValidatorJobsService extends ProcessingServiceBase {
  61862. constructor(url, options) {
  61863. super(url, options);
  61864. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/topologyvalidator');
  61865. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsService";
  61866. }
  61867. /**
  61868. *@override
  61869. */
  61870. destroy() {
  61871. super.destroy();
  61872. }
  61873. /**
  61874. * @function TopologyValidatorJobsService.protitype.getTopologyValidatorJobs
  61875. * @description 获取拓扑检查分析所有任务
  61876. */
  61877. getTopologyValidatorJobs() {
  61878. super.getJobs(this.url);
  61879. }
  61880. /**
  61881. * @function TopologyValidatorJobsService.protitype.getTopologyValidatorJob
  61882. * @description 获取指定id的拓扑检查分析服务
  61883. * @param {string} id - 指定要获取数据的id
  61884. */
  61885. getTopologyValidatorJob(id) {
  61886. super.getJobs( Util_Util.urlPathAppend(this.url, id));
  61887. }
  61888. /**
  61889. * @function TopologyValidatorJobsService.protitype.addTopologyValidatorJob
  61890. * @description 新建拓扑检查分析服务
  61891. * @param {TopologyValidatorJobsParameter} params - 拓扑检查分析任务参数类。
  61892. * @param {number} seconds -创建成功结果的时间间隔。
  61893. */
  61894. addTopologyValidatorJob(params, seconds) {
  61895. super.addJob(this.url, params, TopologyValidatorJobsParameter, seconds);
  61896. }
  61897. }
  61898. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsParameter.js
  61899. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61900. * This program are made available under the terms of the Apache License, Version 2.0
  61901. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61902. /**
  61903. * @class SummaryAttributesJobsParameter
  61904. * @deprecatedclass SuperMap.SummaryAttributesJobsParameter
  61905. * @category iServer ProcessingService SummaryAttributes
  61906. * @classdesc 属性汇总分析任务参数类。
  61907. * @param {Object} options - 参数。
  61908. * @param {string} options.datasetName - 数据集名。
  61909. * @param {string} options.groupField - 分组字段。
  61910. * @param {string} options.attributeField - 属性字段。
  61911. * @param {string} options.statisticModes - 统计模式。
  61912. * @param {OutputSetting} [options.output] -输出参数设置。
  61913. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  61914. * @usage
  61915. */
  61916. class SummaryAttributesJobsParameter {
  61917. constructor(options) {
  61918. if (!options) {
  61919. return;
  61920. }
  61921. /**
  61922. * @member {string} SummaryAttributesJobsParameter.prototype.datasetName
  61923. * @description 汇总数据集名称。
  61924. */
  61925. this.datasetName = "";
  61926. /**
  61927. * @member {string} SummaryAttributesJobsParameter.prototype.groupField
  61928. * @description 分组字段。
  61929. */
  61930. this.groupField = "";
  61931. /**
  61932. * @member {string} SummaryAttributesJobsParameter.prototype.attributeField
  61933. * @description 属性字段。
  61934. */
  61935. this.attributeField = "";
  61936. /**
  61937. * @member {string} SummaryAttributesJobsParameter.prototype.statisticModes
  61938. * @description 属性汇总统计模式。
  61939. */
  61940. this.statisticModes = "";
  61941. /**
  61942. * @member {OutputSetting} SummaryAttributesJobsParameter.prototype.output
  61943. * @description 输出参数设置类。
  61944. */
  61945. this.output = null;
  61946. /**
  61947. * @member {MappingParameters} [SummaryAttributesJobsParameter.prototype.mappingParameters]
  61948. * @description 分析后结果可视化的参数类。
  61949. */
  61950. this.mappingParameters = null;
  61951. Util_Util.extend(this, options);
  61952. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsParameter";
  61953. }
  61954. /**
  61955. * @function SummaryAttributesJobsParameter.prototype.destroy
  61956. * @description 释放资源,将资源的属性置空。
  61957. */
  61958. destroy() {
  61959. this.datasetName = null;
  61960. this.groupField = null;
  61961. this.attributeField = null;
  61962. this.statisticModes = null;
  61963. if (this.output instanceof OutputSetting) {
  61964. this.output.destroy();
  61965. this.output = null;
  61966. }
  61967. if (this.mappingParameters instanceof MappingParameters){
  61968. this.mappingParameters.destroy();
  61969. this.mappingParameters = null;
  61970. }
  61971. }
  61972. /**
  61973. * @function SummaryAttributesJobsParameter.toObject
  61974. * @param {Object} SummaryAttributesJobsParameter - 属性汇总任务参数。
  61975. * @param {Object} tempObj - 目标对象。
  61976. * @description 生成属性汇总分析任务对象。
  61977. */
  61978. static toObject(SummaryAttributesJobsParameter, tempObj) {
  61979. for (var name in SummaryAttributesJobsParameter) {
  61980. if (name === "datasetName") {
  61981. tempObj['input'] = tempObj['input'] || {};
  61982. tempObj['input'][name] = SummaryAttributesJobsParameter[name];
  61983. continue;
  61984. }
  61985. if (name === "output") {
  61986. tempObj['output'] = tempObj['output'] || {};
  61987. tempObj['output'] = SummaryAttributesJobsParameter[name];
  61988. continue;
  61989. }
  61990. tempObj['analyst'] = tempObj['analyst'] || {};
  61991. tempObj['analyst'][name] = SummaryAttributesJobsParameter[name];
  61992. if(name === 'mappingParameters'){
  61993. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  61994. tempObj['analyst']['mappingParameters'] = SummaryAttributesJobsParameter[name];
  61995. }
  61996. }
  61997. }
  61998. }
  61999. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsService.js
  62000. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  62001. * This program are made available under the terms of the Apache License, Version 2.0
  62002. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62003. /**
  62004. * @class SummaryAttributesJobsService
  62005. * @deprecatedclass SuperMap.SummaryAttributesJobsService
  62006. * @category iServer ProcessingService SummaryAttributes
  62007. * @classdesc 属性汇总分析服务类
  62008. * @extends {ProcessingServiceBase}
  62009. * @param {string} url - 服务地址。
  62010. * @param {Object} options - 可选参数。
  62011. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  62012. * @param {Object} [options.headers] - 请求头。
  62013. * @usage
  62014. */
  62015. class SummaryAttributesJobsService extends ProcessingServiceBase {
  62016. constructor(url, options) {
  62017. super(url, options);
  62018. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/summaryattributes');
  62019. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsService";
  62020. }
  62021. /**
  62022. *@override
  62023. */
  62024. destroy() {
  62025. super.destroy();
  62026. }
  62027. /**
  62028. * @function SummaryAttributesJobsService.protitype.getSummaryAttributesJobs
  62029. * @description 获取属性汇总分析所有任务
  62030. */
  62031. getSummaryAttributesJobs (){
  62032. super.getJobs(this.url);
  62033. }
  62034. /**
  62035. * @function SummaryAttributesJobsService.protitype.getSummaryAttributesJob
  62036. * @description 获取指定id的属性汇总分析服务
  62037. * @param {string} id - 指定要获取数据的id
  62038. */
  62039. getSummaryAttributesJob(id) {
  62040. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  62041. }
  62042. /**
  62043. * @function SummaryAttributesJobsService.protitype.addSummaryAttributesJob
  62044. * @description 新建属性汇总分析服务
  62045. * @param {SummaryAttributesJobsParameter} params - 属性汇总分析任务参数类。
  62046. * @param {number} seconds - 创建成功结果的时间间隔。
  62047. */
  62048. addSummaryAttributesJob(params, seconds) {
  62049. super.addJob(this.url, params, SummaryAttributesJobsParameter, seconds);
  62050. }
  62051. }
  62052. ;// CONCATENATED MODULE: ./src/common/iServer/ProcessingService.js
  62053. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  62054. * This program are made available under the terms of the Apache License, Version 2.0
  62055. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62056. /**
  62057. * @class ProcessingService
  62058. * @category iServer ProcessingService
  62059. * @classdesc 分布式分析相关服务类。
  62060. * @extends {ServiceBase}
  62061. * @example
  62062. * new ProcessingService(url,options)
  62063. * .getKernelDensityJobs(function(result){
  62064. * //doSomething
  62065. * })
  62066. * @param {string} url - 服务地址。
  62067. * @param {Object} options - 参数。
  62068. * @param {string} [options.proxy] - 服务代理地址。
  62069. * @param {boolean} [options.withCredentials=false] - 请求是否携带cookie。
  62070. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  62071. * @param {Object} [options.headers] - 请求头。
  62072. * @usage
  62073. */
  62074. class ProcessingService_ProcessingService {
  62075. constructor(url, options) {
  62076. this.url = url;
  62077. this.options = options || {};
  62078. this.kernelDensityJobs = {};
  62079. this.summaryMeshJobs = {};
  62080. this.queryJobs = {};
  62081. this.summaryRegionJobs = {};
  62082. this.vectorClipJobs = {};
  62083. this.overlayGeoJobs = {};
  62084. this.buffersJobs = {};
  62085. this.topologyValidatorJobs = {};
  62086. this.summaryAttributesJobs = {};
  62087. }
  62088. /**
  62089. * @function ProcessingService.prototype.getKernelDensityJobs
  62090. * @description 获取密度分析的列表。
  62091. * @param {RequestCallback} callback - 回调函数。
  62092. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62093. */
  62094. getKernelDensityJobs(callback, resultFormat) {
  62095. var me = this,
  62096. format = me._processFormat(resultFormat);
  62097. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  62098. proxy: me.options.proxy,
  62099. withCredentials: me.options.withCredentials,
  62100. crossOrigin: me.options.crossOrigin,
  62101. headers: me.options.headers,
  62102. eventListeners: {
  62103. scope: me,
  62104. processCompleted: callback,
  62105. processFailed: callback
  62106. },
  62107. format: format
  62108. });
  62109. kernelDensityJobsService.getKernelDensityJobs();
  62110. }
  62111. /**
  62112. * @function ProcessingService.prototype.getKernelDensityJob
  62113. * @description 获取某个密度分析。
  62114. * @param {string} id - 空间分析的ID。
  62115. * @param {RequestCallback} callback - 回调函数。
  62116. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62117. */
  62118. getKernelDensityJob(id, callback, resultFormat) {
  62119. var me = this,
  62120. format = me._processFormat(resultFormat);
  62121. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  62122. proxy: me.options.proxy,
  62123. withCredentials: me.options.withCredentials,
  62124. crossOrigin: me.options.crossOrigin,
  62125. headers: me.options.headers,
  62126. eventListeners: {
  62127. scope: me,
  62128. processCompleted: callback,
  62129. processFailed: callback
  62130. },
  62131. format: format
  62132. });
  62133. kernelDensityJobsService.getKernelDensityJob(id);
  62134. }
  62135. /**
  62136. * @function ProcessingService.prototype.addKernelDensityJob
  62137. * @description 密度分析。
  62138. * @param {KernelDensityJobParameter} params -密度分析参数类。
  62139. * @param {RequestCallback} callback 回调函数。
  62140. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  62141. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62142. */
  62143. addKernelDensityJob(params, callback, seconds, resultFormat) {
  62144. var me = this,
  62145. format = me._processFormat(resultFormat);
  62146. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  62147. proxy: me.options.proxy,
  62148. withCredentials: me.options.withCredentials,
  62149. crossOrigin: me.options.crossOrigin,
  62150. headers: me.options.headers,
  62151. eventListeners: {
  62152. scope: me,
  62153. processCompleted: callback,
  62154. processFailed: callback,
  62155. processRunning: function (job) {
  62156. me.kernelDensityJobs[job.id] = job.state;
  62157. }
  62158. },
  62159. format: format
  62160. });
  62161. kernelDensityJobsService.addKernelDensityJob(params, seconds);
  62162. }
  62163. /**
  62164. * @function ProcessingService.prototype.getKernelDensityJobState
  62165. * @description 获取密度分析的状态。
  62166. * @param {string} id - 密度分析的id。
  62167. * @returns {Object} 密度分析的状态。
  62168. */
  62169. getKernelDensityJobState(id) {
  62170. return this.kernelDensityJobs[id];
  62171. }
  62172. /**
  62173. * @function ProcessingService.prototype.getSummaryMeshJobs
  62174. * @description 获取点聚合分析的列表。
  62175. * @param {RequestCallback} callback - 回调函数。
  62176. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62177. */
  62178. getSummaryMeshJobs(callback, resultFormat) {
  62179. var me = this,
  62180. format = me._processFormat(resultFormat);
  62181. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  62182. proxy: me.options.proxy,
  62183. withCredentials: me.options.withCredentials,
  62184. crossOrigin: me.options.crossOrigin,
  62185. headers: me.options.headers,
  62186. eventListeners: {
  62187. scope: me,
  62188. processCompleted: callback,
  62189. processFailed: callback
  62190. },
  62191. format: format
  62192. });
  62193. summaryMeshJobsService.getSummaryMeshJobs();
  62194. }
  62195. /**
  62196. * @function ProcessingService.prototype.getSummaryMeshJob
  62197. * @description 获取某个点聚合分析。
  62198. * @param {string} id - 空间分析的 ID。
  62199. * @param {RequestCallback} callback - 回调函数。
  62200. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62201. */
  62202. getSummaryMeshJob(id, callback, resultFormat) {
  62203. var me = this,
  62204. format = me._processFormat(resultFormat);
  62205. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  62206. proxy: me.options.proxy,
  62207. withCredentials: me.options.withCredentials,
  62208. crossOrigin: me.options.crossOrigin,
  62209. headers: me.options.headers,
  62210. eventListeners: {
  62211. scope: me,
  62212. processCompleted: callback,
  62213. processFailed: callback
  62214. },
  62215. format: format
  62216. });
  62217. summaryMeshJobsService.getSummaryMeshJob(id);
  62218. }
  62219. /**
  62220. * @function ProcessingService.prototype.addSummaryMeshJob
  62221. * @description 点聚合分析。
  62222. * @param {SummaryMeshJobParameter} params - 点聚合分析任务参数类。
  62223. * @param {RequestCallback} callback 回调函数。
  62224. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  62225. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62226. */
  62227. addSummaryMeshJob(params, callback, seconds, resultFormat) {
  62228. var me = this,
  62229. format = me._processFormat(resultFormat);
  62230. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  62231. proxy: me.options.proxy,
  62232. withCredentials: me.options.withCredentials,
  62233. crossOrigin: me.options.crossOrigin,
  62234. headers: me.options.headers,
  62235. eventListeners: {
  62236. scope: me,
  62237. processCompleted: callback,
  62238. processFailed: callback,
  62239. processRunning: function (job) {
  62240. me.summaryMeshJobs[job.id] = job.state;
  62241. }
  62242. },
  62243. format: format
  62244. });
  62245. summaryMeshJobsService.addSummaryMeshJob(params, seconds);
  62246. }
  62247. /**
  62248. * @function ProcessingService.prototype.getSummaryMeshJobState
  62249. * @description 获取点聚合分析的状态。
  62250. * @param {string} id - 点聚合分析的 ID。
  62251. * @returns {Object} 点聚合分析的状态。
  62252. */
  62253. getSummaryMeshJobState(id) {
  62254. return this.summaryMeshJobs[id];
  62255. }
  62256. /**
  62257. * @function ProcessingService.prototype.getQueryJobs
  62258. * @description 获取单对象查询分析的列表。
  62259. * @param {RequestCallback} callback - 回调函数。
  62260. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62261. */
  62262. getQueryJobs(callback, resultFormat) {
  62263. var me = this,
  62264. format = me._processFormat(resultFormat);
  62265. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  62266. proxy: me.options.proxy,
  62267. withCredentials: me.options.withCredentials,
  62268. crossOrigin: me.options.crossOrigin,
  62269. headers: me.options.headers,
  62270. eventListeners: {
  62271. scope: me,
  62272. processCompleted: callback,
  62273. processFailed: callback
  62274. },
  62275. format: format
  62276. });
  62277. singleObjectQueryJobsService.getQueryJobs();
  62278. }
  62279. /**
  62280. * @function ProcessingService.prototype.getQueryJob
  62281. * @description 获取某个单对象查询分析。
  62282. * @param {string} id - 空间分析的 ID。
  62283. * @param {RequestCallback} callback - 回调函数。
  62284. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62285. */
  62286. getQueryJob(id, callback, resultFormat) {
  62287. var me = this,
  62288. format = me._processFormat(resultFormat);
  62289. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  62290. proxy: me.options.proxy,
  62291. withCredentials: me.options.withCredentials,
  62292. crossOrigin: me.options.crossOrigin,
  62293. headers: me.options.headers,
  62294. eventListeners: {
  62295. scope: me,
  62296. processCompleted: callback,
  62297. processFailed: callback
  62298. },
  62299. format: format
  62300. });
  62301. singleObjectQueryJobsService.getQueryJob(id);
  62302. }
  62303. /**
  62304. * @function ProcessingService.prototype.addQueryJob
  62305. * @description 单对象查询分析。
  62306. * @param {SingleObjectQueryJobsParameter} params - 单对象查询分析的请求参数。
  62307. * @param {RequestCallback} callback - 回调函数。
  62308. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  62309. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62310. */
  62311. addQueryJob(params, callback, seconds, resultFormat) {
  62312. var me = this,
  62313. format = me._processFormat(resultFormat);
  62314. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  62315. proxy: me.options.proxy,
  62316. withCredentials: me.options.withCredentials,
  62317. crossOrigin: me.options.crossOrigin,
  62318. headers: me.options.headers,
  62319. eventListeners: {
  62320. scope: me,
  62321. processCompleted: callback,
  62322. processFailed: callback,
  62323. processRunning: function (job) {
  62324. me.queryJobs[job.id] = job.state;
  62325. }
  62326. },
  62327. format: format
  62328. });
  62329. singleObjectQueryJobsService.addQueryJob(params, seconds);
  62330. }
  62331. /**
  62332. * @function ProcessingService.prototype.getQueryJobState
  62333. * @description 获取单对象查询分析的状态。
  62334. * @param {string} id - 单对象查询分析的 ID。
  62335. * @returns {Object} 单对象查询分析的状态。
  62336. */
  62337. getQueryJobState(id) {
  62338. return this.queryJobs[id];
  62339. }
  62340. /**
  62341. * @function ProcessingService.prototype.getSummaryRegionJobs
  62342. * @description 获取区域汇总分析的列表。
  62343. * @param {RequestCallback} callback - 回调函数。
  62344. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62345. */
  62346. getSummaryRegionJobs(callback, resultFormat) {
  62347. var me = this,
  62348. format = me._processFormat(resultFormat);
  62349. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  62350. proxy: me.options.proxy,
  62351. withCredentials: me.options.withCredentials,
  62352. crossOrigin: me.options.crossOrigin,
  62353. headers: me.options.headers,
  62354. eventListeners: {
  62355. scope: me,
  62356. processCompleted: callback,
  62357. processFailed: callback
  62358. },
  62359. format: format
  62360. });
  62361. summaryRegionJobsService.getSummaryRegionJobs();
  62362. }
  62363. /**
  62364. * @function ProcessingService.prototype.getSummaryRegionJob
  62365. * @description 获取某个区域汇总分析。
  62366. * @param {string} id - 区域汇总分析的 ID。
  62367. * @param {RequestCallback} callback - 回调函数。
  62368. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62369. */
  62370. getSummaryRegionJob(id, callback, resultFormat) {
  62371. var me = this,
  62372. format = me._processFormat(resultFormat);
  62373. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  62374. proxy: me.options.proxy,
  62375. withCredentials: me.options.withCredentials,
  62376. crossOrigin: me.options.crossOrigin,
  62377. headers: me.options.headers,
  62378. eventListeners: {
  62379. scope: me,
  62380. processCompleted: callback,
  62381. processFailed: callback
  62382. },
  62383. format: format
  62384. });
  62385. summaryRegionJobsService.getSummaryRegionJob(id);
  62386. }
  62387. /**
  62388. * @function ProcessingService.prototype.addSummaryRegionJob
  62389. * @description 区域汇总分析。
  62390. * @param {SummaryRegionJobParameter} params - 区域汇总分析参数类。
  62391. * @param {RequestCallback} callback - 回调函数。
  62392. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  62393. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62394. */
  62395. addSummaryRegionJob(params, callback, seconds, resultFormat) {
  62396. var me = this,
  62397. format = me._processFormat(resultFormat);
  62398. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  62399. proxy: me.options.proxy,
  62400. withCredentials: me.options.withCredentials,
  62401. crossOrigin: me.options.crossOrigin,
  62402. headers: me.options.headers,
  62403. eventListeners: {
  62404. scope: me,
  62405. processCompleted: callback,
  62406. processFailed: callback,
  62407. processRunning: function (job) {
  62408. me.summaryRegionJobs[job.id] = job.state;
  62409. }
  62410. },
  62411. format: format
  62412. });
  62413. summaryRegionJobsService.addSummaryRegionJob(params, seconds);
  62414. }
  62415. /**
  62416. * @function ProcessingService.prototype.getSummaryRegionJobState
  62417. * @description 获取区域汇总分析的状态。
  62418. * @param {string} id - 生成区域汇总分析的 ID。
  62419. * @returns {Object} 区域汇总分析的状态。
  62420. */
  62421. getSummaryRegionJobState(id) {
  62422. return this.summaryRegionJobs[id];
  62423. }
  62424. /**
  62425. * @function ProcessingService.prototype.getVectorClipJobs
  62426. * @description 获取矢量裁剪分析的列表。
  62427. * @param {RequestCallback} callback - 回调函数。
  62428. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62429. */
  62430. getVectorClipJobs(callback, resultFormat) {
  62431. var me = this,
  62432. format = me._processFormat(resultFormat);
  62433. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  62434. proxy: me.options.proxy,
  62435. withCredentials: me.options.withCredentials,
  62436. crossOrigin: me.options.crossOrigin,
  62437. headers: me.options.headers,
  62438. eventListeners: {
  62439. scope: me,
  62440. processCompleted: callback,
  62441. processFailed: callback
  62442. },
  62443. format: format
  62444. });
  62445. vectorClipJobsService.getVectorClipJobs();
  62446. }
  62447. /**
  62448. * @function ProcessingService.prototype.getVectorClipJob
  62449. * @description 获取某个矢量裁剪分析。
  62450. * @param {string} id - 空间分析的 ID。
  62451. * @param {RequestCallback} callback - 回调函数。
  62452. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62453. */
  62454. getVectorClipJob(id, callback, resultFormat) {
  62455. var me = this,
  62456. format = me._processFormat(resultFormat);
  62457. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  62458. proxy: me.options.proxy,
  62459. withCredentials: me.options.withCredentials,
  62460. crossOrigin: me.options.crossOrigin,
  62461. headers: me.options.headers,
  62462. eventListeners: {
  62463. scope: me,
  62464. processCompleted: callback,
  62465. processFailed: callback
  62466. },
  62467. format: format
  62468. });
  62469. vectorClipJobsService.getVectorClipJob(id);
  62470. }
  62471. /**
  62472. * @function ProcessingService.prototype.addVectorClipJob
  62473. * @description 矢量裁剪分析。
  62474. * @param {VectorClipJobsParameter} params - 矢量裁剪分析请求参数类。
  62475. * @param {RequestCallback} callback - 回调函数。
  62476. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  62477. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62478. */
  62479. addVectorClipJob(params, callback, seconds, resultFormat) {
  62480. var me = this,
  62481. format = me._processFormat(resultFormat);
  62482. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  62483. proxy: me.options.proxy,
  62484. withCredentials: me.options.withCredentials,
  62485. crossOrigin: me.options.crossOrigin,
  62486. headers: me.options.headers,
  62487. eventListeners: {
  62488. scope: me,
  62489. processCompleted: callback,
  62490. processFailed: callback,
  62491. processRunning: function (job) {
  62492. me.vectorClipJobs[job.id] = job.state;
  62493. }
  62494. },
  62495. format: format
  62496. });
  62497. vectorClipJobsService.addVectorClipJob(params, seconds);
  62498. }
  62499. /**
  62500. * @function ProcessingService.prototype.getVectorClipJobState
  62501. * @description 获取矢量裁剪分析的状态。
  62502. * @param {number} id - 矢量裁剪分析的ID。
  62503. * @returns {Object} 矢量裁剪分析的状态。
  62504. */
  62505. getVectorClipJobState(id) {
  62506. return this.vectorClipJobs[id];
  62507. }
  62508. /**
  62509. * @function ProcessingService.prototype.getOverlayGeoJobs
  62510. * @description 获取叠加分析的列表。
  62511. * @param {RequestCallback} callback - 回调函数。
  62512. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62513. */
  62514. getOverlayGeoJobs(callback, resultFormat) {
  62515. var me = this,
  62516. format = me._processFormat(resultFormat);
  62517. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  62518. proxy: me.options.proxy,
  62519. withCredentials: me.options.withCredentials,
  62520. crossOrigin: me.options.crossOrigin,
  62521. headers: me.options.headers,
  62522. eventListeners: {
  62523. scope: me,
  62524. processCompleted: callback,
  62525. processFailed: callback
  62526. },
  62527. format: format
  62528. });
  62529. overlayGeoJobsService.getOverlayGeoJobs();
  62530. }
  62531. /**
  62532. * @function ProcessingService.prototype.getOverlayGeoJob
  62533. * @description 获取某个叠加分析。
  62534. * @param {string} id - 空间分析的 ID。
  62535. * @param {RequestCallback} callback - 回调函数。
  62536. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62537. */
  62538. getOverlayGeoJob(id, callback, resultFormat) {
  62539. var me = this,
  62540. format = me._processFormat(resultFormat);
  62541. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  62542. proxy: me.options.proxy,
  62543. withCredentials: me.options.withCredentials,
  62544. crossOrigin: me.options.crossOrigin,
  62545. headers: me.options.headers,
  62546. eventListeners: {
  62547. scope: me,
  62548. processCompleted: callback,
  62549. processFailed: callback
  62550. },
  62551. format: format
  62552. });
  62553. overlayGeoJobsService.getOverlayGeoJob(id);
  62554. }
  62555. /**
  62556. * @function ProcessingService.prototype.addOverlayGeoJob
  62557. * @description 叠加分析。
  62558. * @param {OverlayGeoJobParameter} params - 叠加分析请求参数类。
  62559. * @param {RequestCallback} callback - 回调函数。
  62560. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  62561. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62562. */
  62563. addOverlayGeoJob(params, callback, seconds, resultFormat) {
  62564. var me = this,
  62565. format = me._processFormat(resultFormat);
  62566. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  62567. proxy: me.options.proxy,
  62568. withCredentials: me.options.withCredentials,
  62569. crossOrigin: me.options.crossOrigin,
  62570. headers: me.options.headers,
  62571. eventListeners: {
  62572. scope: me,
  62573. processCompleted: callback,
  62574. processFailed: callback,
  62575. processRunning: function (job) {
  62576. me.overlayGeoJobs[job.id] = job.state;
  62577. }
  62578. },
  62579. format: format
  62580. });
  62581. overlayGeoJobsService.addOverlayGeoJob(params, seconds);
  62582. }
  62583. /**
  62584. * @function ProcessingService.prototype.getoverlayGeoJobState
  62585. * @description 获取叠加分析的状态。
  62586. * @param {string} id - 叠加分析的 ID。
  62587. * @returns {Object} 叠加分析的状态。
  62588. */
  62589. getoverlayGeoJobState(id) {
  62590. return this.overlayGeoJobs[id];
  62591. }
  62592. /**
  62593. * @function ProcessingService.prototype.getBuffersJobs
  62594. * @description 获取缓冲区分析的列表。
  62595. * @param {RequestCallback} callback - 回调函数。
  62596. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62597. */
  62598. getBuffersJobs(callback, resultFormat) {
  62599. var me = this,
  62600. format = me._processFormat(resultFormat);
  62601. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  62602. proxy: me.options.proxy,
  62603. withCredentials: me.options.withCredentials,
  62604. crossOrigin: me.options.crossOrigin,
  62605. headers: me.options.headers,
  62606. eventListeners: {
  62607. scope: me,
  62608. processCompleted: callback,
  62609. processFailed: callback
  62610. },
  62611. format: format
  62612. });
  62613. buffersAnalystJobsService.getBuffersJobs();
  62614. }
  62615. /**
  62616. * @function ProcessingService.prototype.getBuffersJob
  62617. * @description 获取某个缓冲区分析。
  62618. * @param {string} id - 空间分析的 ID。
  62619. * @param {RequestCallback} callback - 回调函数。
  62620. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62621. */
  62622. getBuffersJob(id, callback, resultFormat) {
  62623. var me = this,
  62624. format = me._processFormat(resultFormat);
  62625. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  62626. proxy: me.options.proxy,
  62627. withCredentials: me.options.withCredentials,
  62628. crossOrigin: me.options.crossOrigin,
  62629. headers: me.options.headers,
  62630. eventListeners: {
  62631. scope: me,
  62632. processCompleted: callback,
  62633. processFailed: callback
  62634. },
  62635. format: format
  62636. });
  62637. buffersAnalystJobsService.getBuffersJob(id);
  62638. }
  62639. /**
  62640. * @function ProcessingService.prototype.addBuffersJob
  62641. * @description 缓冲区分析。
  62642. * @param {BuffersAnalystJobsParameter} params - 缓冲区分析请求参数类。
  62643. * @param {RequestCallback} callback - 回调函数。
  62644. * @param {number} seconds - 获取创建成功结果的时间间隔。
  62645. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62646. */
  62647. addBuffersJob(params, callback, seconds, resultFormat) {
  62648. var me = this,
  62649. format = me._processFormat(resultFormat);
  62650. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  62651. proxy: me.options.proxy,
  62652. withCredentials: me.options.withCredentials,
  62653. crossOrigin: me.options.crossOrigin,
  62654. headers: me.options.headers,
  62655. eventListeners: {
  62656. scope: me,
  62657. processCompleted: callback,
  62658. processFailed: callback,
  62659. processRunning: function (job) {
  62660. me.buffersJobs[job.id] = job.state;
  62661. }
  62662. },
  62663. format: format
  62664. });
  62665. buffersAnalystJobsService.addBuffersJob(params, seconds);
  62666. }
  62667. /**
  62668. * @function ProcessingService.prototype.getBuffersJobState
  62669. * @description 获取缓冲区分析的状态。
  62670. * @param {string} id - 缓冲区分析的 ID。
  62671. * @returns {Object} 缓冲区分析的状态。
  62672. */
  62673. getBuffersJobState(id) {
  62674. return this.buffersJobs[id];
  62675. }
  62676. /**
  62677. * @function ProcessingService.prototype.getTopologyValidatorJobs
  62678. * @description 获取拓扑检查分析的列表。
  62679. * @param {RequestCallback} callback - 回调函数。
  62680. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62681. */
  62682. getTopologyValidatorJobs(callback, resultFormat) {
  62683. var me = this,
  62684. format = me._processFormat(resultFormat);
  62685. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  62686. proxy: me.options.proxy,
  62687. withCredentials: me.options.withCredentials,
  62688. crossOrigin: me.options.crossOrigin,
  62689. headers: me.options.headers,
  62690. eventListeners: {
  62691. scope: me,
  62692. processCompleted: callback,
  62693. processFailed: callback
  62694. },
  62695. format: format
  62696. });
  62697. topologyValidatorJobsService.getTopologyValidatorJobs();
  62698. }
  62699. /**
  62700. * @function ProcessingService.prototype.getTopologyValidatorJob
  62701. * @description 获取某个拓扑检查分析。
  62702. * @param {string} id - 空间分析的 ID。
  62703. * @param {RequestCallback} callback - 回调函数。
  62704. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62705. */
  62706. getTopologyValidatorJob(id, callback, resultFormat) {
  62707. var me = this,
  62708. format = me._processFormat(resultFormat);
  62709. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  62710. proxy: me.options.proxy,
  62711. withCredentials: me.options.withCredentials,
  62712. crossOrigin: me.options.crossOrigin,
  62713. headers: me.options.headers,
  62714. eventListeners: {
  62715. scope: me,
  62716. processCompleted: callback,
  62717. processFailed: callback
  62718. },
  62719. format: format
  62720. });
  62721. topologyValidatorJobsService.getTopologyValidatorJob(id);
  62722. }
  62723. /**
  62724. * @function ProcessingService.prototype.addTopologyValidatorJob
  62725. * @description 拓扑检查分析。
  62726. * @param {TopologyValidatorJobsParameter} params - 拓扑检查分析请求参数类。
  62727. * @param {RequestCallback} callback - 回调函数。
  62728. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  62729. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62730. */
  62731. addTopologyValidatorJob(params, callback, seconds, resultFormat) {
  62732. var me = this,
  62733. format = me._processFormat(resultFormat);
  62734. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  62735. proxy: me.options.proxy,
  62736. withCredentials: me.options.withCredentials,
  62737. crossOrigin: me.options.crossOrigin,
  62738. headers: me.options.headers,
  62739. eventListeners: {
  62740. scope: me,
  62741. processCompleted: callback,
  62742. processFailed: callback,
  62743. processRunning: function (job) {
  62744. me.topologyValidatorJobs[job.id] = job.state;
  62745. }
  62746. },
  62747. format: format
  62748. });
  62749. topologyValidatorJobsService.addTopologyValidatorJob(params, seconds);
  62750. }
  62751. /**
  62752. * @function ProcessingService.prototype.getTopologyValidatorJobState
  62753. * @description 获取拓扑检查分析的状态。
  62754. * @param {string} id - 拓扑检查分析的 ID。
  62755. * @returns {Object} 拓扑检查分析的状态。
  62756. */
  62757. getTopologyValidatorJobState(id) {
  62758. return this.topologyValidatorJobs[id];
  62759. }
  62760. /**
  62761. * @function ProcessingService.prototype.getSummaryAttributesJobs
  62762. * @description 获取属性汇总分析的列表。
  62763. * @param {RequestCallback} callback - 回调函数。
  62764. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62765. */
  62766. getSummaryAttributesJobs(callback, resultFormat) {
  62767. var me = this,
  62768. format = me._processFormat(resultFormat);
  62769. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  62770. proxy: me.options.proxy,
  62771. withCredentials: me.options.withCredentials,
  62772. crossOrigin: me.options.crossOrigin,
  62773. headers: me.options.headers,
  62774. eventListeners: {
  62775. scope: me,
  62776. processCompleted: callback,
  62777. processFailed: callback
  62778. },
  62779. format: format
  62780. });
  62781. summaryAttributesJobsService.getSummaryAttributesJobs();
  62782. }
  62783. /**
  62784. * @function ProcessingService.prototype.getSummaryAttributesJob
  62785. * @description 获取某个属性汇总分析。
  62786. * @param {string} id - 空间分析的 ID。
  62787. * @param {RequestCallback} callback - 回调函数。
  62788. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62789. */
  62790. getSummaryAttributesJob(id, callback, resultFormat) {
  62791. var me = this,
  62792. format = me._processFormat(resultFormat);
  62793. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  62794. proxy: me.options.proxy,
  62795. withCredentials: me.options.withCredentials,
  62796. crossOrigin: me.options.crossOrigin,
  62797. headers: me.options.headers,
  62798. eventListeners: {
  62799. scope: me,
  62800. processCompleted: callback,
  62801. processFailed: callback
  62802. },
  62803. format: format
  62804. });
  62805. summaryAttributesJobsService.getSummaryAttributesJob(id);
  62806. }
  62807. /**
  62808. * @function ProcessingService.prototype.addSummaryAttributesJob
  62809. * @description 属性汇总分析。
  62810. * @param {SummaryAttributesJobsParameter} params - 属性汇总分析参数类。
  62811. * @param {RequestCallback} callback - 回调函数。
  62812. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  62813. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62814. */
  62815. addSummaryAttributesJob(params, callback, seconds, resultFormat) {
  62816. var me = this,
  62817. format = me._processFormat(resultFormat);
  62818. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  62819. proxy: me.options.proxy,
  62820. withCredentials: me.options.withCredentials,
  62821. crossOrigin: me.options.crossOrigin,
  62822. headers: me.options.headers,
  62823. eventListeners: {
  62824. scope: me,
  62825. processCompleted: callback,
  62826. processFailed: callback,
  62827. processRunning: function (job) {
  62828. me.summaryAttributesJobs[job.id] = job.state;
  62829. }
  62830. },
  62831. format: format
  62832. });
  62833. summaryAttributesJobsService.addSummaryAttributesJob(params, seconds);
  62834. }
  62835. /**
  62836. * @function ProcessingService.prototype.getSummaryAttributesJobState
  62837. * @description 获取属性汇总分析的状态。
  62838. * @param {string} id - 属性汇总分析的 ID。
  62839. * @returns {Object} 属性汇总分析的状态
  62840. */
  62841. getSummaryAttributesJobState(id) {
  62842. return this.summaryAttributesJobs[id];
  62843. }
  62844. _processFormat(resultFormat) {
  62845. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  62846. }
  62847. }
  62848. ;// CONCATENATED MODULE: ./src/mapboxgl/services/ProcessingService.js
  62849. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  62850. * This program are made available under the terms of the Apache License, Version 2.0
  62851. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62852. /**
  62853. * @class ProcessingService
  62854. * @category iServer ProcessingService
  62855. * @classdesc 分布式分析相关服务类。
  62856. * @modulecategory Services
  62857. * @extends {ServiceBase}
  62858. * @example
  62859. * new ProcessingService(url,options)
  62860. * .getKernelDensityJobs(function(result){
  62861. * //doSomething
  62862. * })
  62863. * @param {string} url - 服务地址。
  62864. * @param {Object} options - 参数。
  62865. * @param {string} [options.proxy] - 服务代理地址。
  62866. * @param {boolean} [options.withCredentials=false] - 请求是否携带cookie。
  62867. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  62868. * @param {Object} [options.headers] - 请求头。
  62869. * @usage
  62870. */
  62871. class ProcessingService extends ServiceBase {
  62872. constructor(url, options) {
  62873. super(url, options);
  62874. this._processingService = new ProcessingService_ProcessingService(url, options);
  62875. }
  62876. /**
  62877. * @function ProcessingService.prototype.getKernelDensityJobs
  62878. * @description 获取密度分析的列表。
  62879. * @param {RequestCallback} callback - 回调函数。
  62880. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62881. */
  62882. getKernelDensityJobs(callback, resultFormat) {
  62883. this._processingService.getKernelDensityJobs(callback, resultFormat);
  62884. }
  62885. /**
  62886. * @function ProcessingService.prototype.getKernelDensityJob
  62887. * @description 获取某个密度分析。
  62888. * @param {string} id - 空间分析的ID。
  62889. * @param {RequestCallback} callback - 回调函数。
  62890. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62891. */
  62892. getKernelDensityJob(id, callback, resultFormat) {
  62893. this._processingService.getKernelDensityJob(id, callback, resultFormat);
  62894. }
  62895. /**
  62896. * @function ProcessingService.prototype.addKernelDensityJob
  62897. * @description 密度分析。
  62898. * @param {KernelDensityJobParameter} params -密度分析参数类。
  62899. * @param {RequestCallback} callback 回调函数。
  62900. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  62901. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62902. */
  62903. addKernelDensityJob(params, callback, seconds, resultFormat) {
  62904. params = this._processParams(params);
  62905. this._processingService.addKernelDensityJob(params, callback, seconds, resultFormat);
  62906. }
  62907. /**
  62908. * @function ProcessingService.prototype.getKernelDensityJobState
  62909. * @description 获取密度分析的状态。
  62910. * @param {string} id - 密度分析的id。
  62911. * @returns {Object} 密度分析的状态。
  62912. */
  62913. getKernelDensityJobState(id) {
  62914. return this._processingService.getKernelDensityJobState(id);
  62915. }
  62916. /**
  62917. * @function ProcessingService.prototype.getSummaryMeshJobs
  62918. * @description 获取点聚合分析的列表。
  62919. * @param {RequestCallback} callback - 回调函数。
  62920. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62921. */
  62922. getSummaryMeshJobs(callback, resultFormat) {
  62923. this._processingService.getSummaryMeshJobs(callback, resultFormat);
  62924. }
  62925. /**
  62926. * @function ProcessingService.prototype.getSummaryMeshJob
  62927. * @description 获取某个点聚合分析。
  62928. * @param {string} id - 空间分析的 ID。
  62929. * @param {RequestCallback} callback - 回调函数。
  62930. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62931. */
  62932. getSummaryMeshJob(id, callback, resultFormat) {
  62933. this._processingService.getSummaryMeshJob(id, callback, resultFormat);
  62934. }
  62935. /**
  62936. * @function ProcessingService.prototype.addSummaryMeshJob
  62937. * @description 点聚合分析。
  62938. * @param {SummaryMeshJobParameter} params - 点聚合分析任务参数类。
  62939. * @param {RequestCallback} callback 回调函数。
  62940. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  62941. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62942. */
  62943. addSummaryMeshJob(params, callback, seconds, resultFormat) {
  62944. params = this._processParams(params);
  62945. this._processingService.addSummaryMeshJob(params, callback, seconds, resultFormat);
  62946. }
  62947. /**
  62948. * @function ProcessingService.prototype.getSummaryMeshJobState
  62949. * @description 获取点聚合分析的状态。
  62950. * @param {string} id - 点聚合分析的 ID。
  62951. * @returns {Object} 点聚合分析的状态。
  62952. */
  62953. getSummaryMeshJobState(id) {
  62954. return this._processingService.getSummaryMeshJobState(id);
  62955. }
  62956. /**
  62957. * @function ProcessingService.prototype.getQueryJobs
  62958. * @description 获取单对象查询分析的列表。
  62959. * @param {RequestCallback} callback - 回调函数。
  62960. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62961. */
  62962. getQueryJobs(callback, resultFormat) {
  62963. this._processingService.getQueryJobs(callback, resultFormat);
  62964. }
  62965. /**
  62966. * @function ProcessingService.prototype.getQueryJob
  62967. * @description 获取某个单对象查询分析。
  62968. * @param {string} id - 空间分析的 ID。
  62969. * @param {RequestCallback} callback - 回调函数。
  62970. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62971. */
  62972. getQueryJob(id, callback, resultFormat) {
  62973. this._processingService.getQueryJob(id, callback, resultFormat);
  62974. }
  62975. /**
  62976. * @function ProcessingService.prototype.addQueryJob
  62977. * @description 单对象查询分析。
  62978. * @param {SingleObjectQueryJobsParameter} params - 单对象查询分析的请求参数。
  62979. * @param {RequestCallback} callback - 回调函数。
  62980. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  62981. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  62982. */
  62983. addQueryJob(params, callback, seconds, resultFormat) {
  62984. params = this._processParams(params);
  62985. this._processingService.addQueryJob(params, callback, seconds, resultFormat);
  62986. }
  62987. /**
  62988. * @function ProcessingService.prototype.getQueryJobState
  62989. * @description 获取单对象查询分析的状态。
  62990. * @param {string} id - 单对象查询分析的 ID。
  62991. * @returns {Object} 单对象查询分析的状态。
  62992. */
  62993. getQueryJobState(id) {
  62994. return this._processingService.getQueryJobState(id);
  62995. }
  62996. /**
  62997. * @function ProcessingService.prototype.getSummaryRegionJobs
  62998. * @description 获取区域汇总分析的列表。
  62999. * @param {RequestCallback} callback - 回调函数。
  63000. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63001. */
  63002. getSummaryRegionJobs(callback, resultFormat) {
  63003. this._processingService.getSummaryRegionJobs(callback, resultFormat);
  63004. }
  63005. /**
  63006. * @function ProcessingService.prototype.getSummaryRegionJob
  63007. * @description 获取某个区域汇总分析。
  63008. * @param {string} id - 区域汇总分析的 ID。
  63009. * @param {RequestCallback} callback - 回调函数。
  63010. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63011. */
  63012. getSummaryRegionJob(id, callback, resultFormat) {
  63013. this._processingService.getSummaryRegionJob(id, callback, resultFormat);
  63014. }
  63015. /**
  63016. * @function ProcessingService.prototype.addSummaryRegionJob
  63017. * @description 区域汇总分析。
  63018. * @param {SummaryRegionJobParameter} params - 区域汇总分析参数类。
  63019. * @param {RequestCallback} callback - 回调函数。
  63020. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  63021. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63022. */
  63023. addSummaryRegionJob(params, callback, seconds, resultFormat) {
  63024. params = this._processParams(params);
  63025. this._processingService.addSummaryRegionJob(params, callback, seconds, resultFormat);
  63026. }
  63027. /**
  63028. * @function ProcessingService.prototype.getSummaryRegionJobState
  63029. * @description 获取区域汇总分析的状态。
  63030. * @param {string} id - 生成区域汇总分析的 ID。
  63031. * @returns {Object} 区域汇总分析的状态。
  63032. */
  63033. getSummaryRegionJobState(id) {
  63034. return this._processingService.getSummaryRegionJobState(id);
  63035. }
  63036. /**
  63037. * @function ProcessingService.prototype.getVectorClipJobs
  63038. * @description 获取矢量裁剪分析的列表。
  63039. * @param {RequestCallback} callback - 回调函数。
  63040. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63041. */
  63042. getVectorClipJobs(callback, resultFormat) {
  63043. this._processingService.getVectorClipJobs(callback, resultFormat);
  63044. }
  63045. /**
  63046. * @function ProcessingService.prototype.getVectorClipJob
  63047. * @description 获取某个矢量裁剪分析。
  63048. * @param {string} id - 空间分析的 ID。
  63049. * @param {RequestCallback} callback - 回调函数。
  63050. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63051. */
  63052. getVectorClipJob(id, callback, resultFormat) {
  63053. this._processingService.getVectorClipJob(id, callback, resultFormat);
  63054. }
  63055. /**
  63056. * @function ProcessingService.prototype.addVectorClipJob
  63057. * @description 矢量裁剪分析。
  63058. * @param {VectorClipJobsParameter} params - 矢量裁剪分析请求参数类。
  63059. * @param {RequestCallback} callback - 回调函数。
  63060. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  63061. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63062. */
  63063. addVectorClipJob(params, callback, seconds, resultFormat) {
  63064. params = this._processParams(params);
  63065. this._processingService.addVectorClipJob(params, callback, seconds, resultFormat);
  63066. }
  63067. /**
  63068. * @function ProcessingService.prototype.getVectorClipJobState
  63069. * @description 获取矢量裁剪分析的状态。
  63070. * @param {number} id - 矢量裁剪分析的ID。
  63071. * @returns {Object} 矢量裁剪分析的状态。
  63072. */
  63073. getVectorClipJobState(id) {
  63074. return this._processingService.getVectorClipJobState(id);
  63075. }
  63076. /**
  63077. * @function ProcessingService.prototype.getOverlayGeoJobs
  63078. * @description 获取叠加分析的列表。
  63079. * @param {RequestCallback} callback - 回调函数。
  63080. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63081. */
  63082. getOverlayGeoJobs(callback, resultFormat) {
  63083. this._processingService.getOverlayGeoJobs(callback, resultFormat);
  63084. }
  63085. /**
  63086. * @function ProcessingService.prototype.getOverlayGeoJob
  63087. * @description 获取某个叠加分析。
  63088. * @param {string} id - 空间分析的 ID。
  63089. * @param {RequestCallback} callback - 回调函数。
  63090. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63091. */
  63092. getOverlayGeoJob(id, callback, resultFormat) {
  63093. this._processingService.getOverlayGeoJob(id, callback, resultFormat);
  63094. }
  63095. /**
  63096. * @function ProcessingService.prototype.addOverlayGeoJob
  63097. * @description 叠加分析。
  63098. * @param {OverlayGeoJobParameter} params - 叠加分析请求参数类。
  63099. * @param {RequestCallback} callback - 回调函数。
  63100. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  63101. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63102. */
  63103. addOverlayGeoJob(params, callback, seconds, resultFormat) {
  63104. params = this._processParams(params);
  63105. this._processingService.addOverlayGeoJob(params, callback, seconds, resultFormat);
  63106. }
  63107. /**
  63108. * @function ProcessingService.prototype.getoverlayGeoJobState
  63109. * @description 获取叠加分析的状态。
  63110. * @param {string} id - 叠加分析的 ID。
  63111. * @returns {Object} 叠加分析的状态。
  63112. */
  63113. getoverlayGeoJobState(id) {
  63114. return this._processingService.getoverlayGeoJobState(id);
  63115. }
  63116. /**
  63117. * @function ProcessingService.prototype.getBuffersJobs
  63118. * @description 获取缓冲区分析的列表。
  63119. * @param {RequestCallback} callback - 回调函数。
  63120. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63121. */
  63122. getBuffersJobs(callback, resultFormat) {
  63123. this._processingService.getBuffersJobs(callback, resultFormat);
  63124. }
  63125. /**
  63126. * @function ProcessingService.prototype.getBuffersJob
  63127. * @description 获取某个缓冲区分析。
  63128. * @param {string} id - 空间分析的 ID。
  63129. * @param {RequestCallback} callback - 回调函数。
  63130. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63131. */
  63132. getBuffersJob(id, callback, resultFormat) {
  63133. this._processingService.getBuffersJob(id, callback, resultFormat);
  63134. }
  63135. /**
  63136. * @function ProcessingService.prototype.addBuffersJob
  63137. * @description 缓冲区分析。
  63138. * @param {BuffersAnalystJobsParameter} params - 缓冲区分析请求参数类。
  63139. * @param {RequestCallback} callback - 回调函数。
  63140. * @param {number} seconds - 获取创建成功结果的时间间隔。
  63141. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63142. */
  63143. addBuffersJob(params, callback, seconds, resultFormat) {
  63144. params = this._processParams(params);
  63145. this._processingService.addBuffersJob(params, callback, seconds, resultFormat);
  63146. }
  63147. /**
  63148. * @function ProcessingService.prototype.getBuffersJobState
  63149. * @description 获取缓冲区分析的状态。
  63150. * @param {string} id - 缓冲区分析的 ID。
  63151. * @returns {Object} 缓冲区分析的状态。
  63152. */
  63153. getBuffersJobState(id) {
  63154. return this._processingService.getBuffersJobState(id);
  63155. }
  63156. /**
  63157. * @function ProcessingService.prototype.getTopologyValidatorJobs
  63158. * @description 获取拓扑检查分析的列表。
  63159. * @param {RequestCallback} callback - 回调函数。
  63160. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63161. */
  63162. getTopologyValidatorJobs(callback, resultFormat) {
  63163. this._processingService.getTopologyValidatorJobs(callback, resultFormat);
  63164. }
  63165. /**
  63166. * @function ProcessingService.prototype.getTopologyValidatorJob
  63167. * @description 获取某个拓扑检查分析。
  63168. * @param {string} id - 空间分析的 ID。
  63169. * @param {RequestCallback} callback - 回调函数。
  63170. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63171. */
  63172. getTopologyValidatorJob(id, callback, resultFormat) {
  63173. this._processingService.getTopologyValidatorJob(id, callback, resultFormat);
  63174. }
  63175. /**
  63176. * @function ProcessingService.prototype.addTopologyValidatorJob
  63177. * @description 拓扑检查分析。
  63178. * @param {TopologyValidatorJobsParameter} params - 拓扑检查分析请求参数类。
  63179. * @param {RequestCallback} callback - 回调函数。
  63180. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  63181. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63182. */
  63183. addTopologyValidatorJob(params, callback, seconds, resultFormat) {
  63184. params = this._processParams(params);
  63185. this._processingService.addTopologyValidatorJob(params, callback, seconds, resultFormat);
  63186. }
  63187. /**
  63188. * @function ProcessingService.prototype.getTopologyValidatorJobState
  63189. * @description 获取拓扑检查分析的状态。
  63190. * @param {string} id - 拓扑检查分析的 ID。
  63191. * @returns {Object} 拓扑检查分析的状态。
  63192. */
  63193. getTopologyValidatorJobState(id) {
  63194. return this._processingService.getTopologyValidatorJobState(id);
  63195. }
  63196. /**
  63197. * @function ProcessingService.prototype.getSummaryAttributesJobs
  63198. * @description 获取属性汇总分析的列表。
  63199. * @param {RequestCallback} callback - 回调函数。
  63200. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63201. */
  63202. getSummaryAttributesJobs(callback, resultFormat) {
  63203. this._processingService.getSummaryAttributesJobs(callback, resultFormat);
  63204. }
  63205. /**
  63206. * @function ProcessingService.prototype.getSummaryAttributesJob
  63207. * @description 获取某个属性汇总分析。
  63208. * @param {string} id - 空间分析的 ID。
  63209. * @param {RequestCallback} callback - 回调函数。
  63210. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63211. */
  63212. getSummaryAttributesJob(id, callback, resultFormat) {
  63213. this._processingService.getSummaryAttributesJob(id, callback, resultFormat);
  63214. }
  63215. /**
  63216. * @function ProcessingService.prototype.addSummaryAttributesJob
  63217. * @description 属性汇总分析。
  63218. * @param {SummaryAttributesJobsParameter} params - 属性汇总分析参数类。
  63219. * @param {RequestCallback} callback - 回调函数。
  63220. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  63221. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63222. */
  63223. addSummaryAttributesJob(params, callback, seconds, resultFormat) {
  63224. params = this._processParams(params);
  63225. this._processingService.addSummaryAttributesJob(params, callback, seconds, resultFormat);
  63226. }
  63227. /**
  63228. * @function ProcessingService.prototype.getSummaryAttributesJobState
  63229. * @description 获取属性汇总分析的状态。
  63230. * @param {string} id - 属性汇总分析的 ID。
  63231. * @returns {Object} 属性汇总分析的状态
  63232. */
  63233. getSummaryAttributesJobState(id) {
  63234. return this._processingService.getSummaryAttributesJobState(id);
  63235. }
  63236. _processFormat(resultFormat) {
  63237. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  63238. }
  63239. _processParams(params) {
  63240. if (!params) {
  63241. return {};
  63242. }
  63243. if (params.bounds) {
  63244. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  63245. }
  63246. //这里只允许传端的bounds
  63247. if (params.query) {
  63248. params.query = core_Util_Util.toSuperMapBounds(params.query);
  63249. }
  63250. if (params.geometryQuery) {
  63251. params.geometryQuery = core_Util_Util.toProcessingParam(params.geometryQuery);
  63252. }
  63253. if (params.geometryClip) {
  63254. params.geometryClip = core_Util_Util.toProcessingParam(params.geometryClip);
  63255. }
  63256. return params;
  63257. }
  63258. }
  63259. ;// CONCATENATED MODULE: ./src/common/iServer/QueryServiceBase.js
  63260. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  63261. * This program are made available under the terms of the Apache License, Version 2.0
  63262. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63263. /**
  63264. * @class QueryService
  63265. * @deprecatedclass SuperMap.QueryService
  63266. * @category iServer Map QueryResults
  63267. * @classdesc 查询服务基类。
  63268. * @extends {CommonServiceBase}
  63269. * @param {string} url - 服务地址。请求地图查询服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  63270. * @param {Object} options - 参数。
  63271. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  63272. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  63273. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  63274. * @param {Object} [options.headers] - 请求头。
  63275. * @example
  63276. * var myService = new QueryService(url, {
  63277. * eventListeners: {
  63278. * "processCompleted": queryCompleted,
  63279. * "processFailed": queryError
  63280. * }
  63281. * };
  63282. * @usage
  63283. */
  63284. class QueryServiceBase extends CommonServiceBase {
  63285. constructor(url, options) {
  63286. super(url, options);
  63287. /**
  63288. * @member {boolean} QueryService.prototype.returnContent
  63289. * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
  63290. */
  63291. this.returnContent = false;
  63292. /**
  63293. * @member {string} QueryService.prototype.format
  63294. * @description 查询结果返回格式,目前支持iServerJSON、GeoJSON、FGB三种格式。参数格式为"ISERVER","GEOJSON","FGB"。
  63295. */
  63296. this.format = DataFormat.GEOJSON;
  63297. this.returnFeatureWithFieldCaption = false;
  63298. if (options) {
  63299. Util_Util.extend(this, options);
  63300. }
  63301. this.CLASS_NAME = "SuperMap.QueryService";
  63302. if (!this.url) {
  63303. return;
  63304. }
  63305. if (options && options.format) {
  63306. this.format = options.format.toUpperCase();
  63307. }
  63308. this.url = Util_Util.urlPathAppend(this.url,'queryResults');
  63309. }
  63310. /**
  63311. * @function QueryService.prototype.destroy
  63312. * @description 释放资源,将引用资源的属性置空。
  63313. */
  63314. destroy() {
  63315. super.destroy();
  63316. var me = this;
  63317. me.returnContent = null;
  63318. me.format = null;
  63319. }
  63320. /**
  63321. * @function QueryService.prototype.processAsync
  63322. * @description 负责将客户端的查询参数传递到服务端。
  63323. * @param {QueryParameters} params - 查询参数。
  63324. */
  63325. processAsync(params) {
  63326. if (!(params instanceof QueryParameters)) {
  63327. return;
  63328. }
  63329. var me = this,
  63330. returnCustomResult = null,
  63331. jsonParameters = null;
  63332. me.returnContent = params.returnContent;
  63333. jsonParameters = me.getJsonParameters(params);
  63334. if (!me.returnContent) {
  63335. //仅供三维使用 获取高亮图片的bounds
  63336. returnCustomResult = params.returnCustomResult;
  63337. if (returnCustomResult) {
  63338. me.url = Util_Util.urlAppend(me.url, 'returnCustomResult=' + returnCustomResult);
  63339. }
  63340. }
  63341. me.returnFeatureWithFieldCaption = params.returnFeatureWithFieldCaption;
  63342. me.request({
  63343. method: "POST",
  63344. data: jsonParameters,
  63345. scope: me,
  63346. success: me.serviceProcessCompleted,
  63347. failure: me.serviceProcessFailed
  63348. });
  63349. }
  63350. /**
  63351. * @function QueryService.prototype.serviceProcessCompleted
  63352. * @description 查询完成,执行此方法。
  63353. * @param {Object} result - 服务器返回的结果对象。
  63354. */
  63355. serviceProcessCompleted(result, options) {
  63356. var me = this;
  63357. result = Util_Util.transformResult(result);
  63358. var geoJSONFormat = new GeoJSON();
  63359. if (result && result.recordsets) {
  63360. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  63361. if (recordsets[i].features) {
  63362. if (me.returnFeatureWithFieldCaption === true) {
  63363. recordsets[i].features.map((feature) => {
  63364. feature.fieldNames = recordsets[i].fieldCaptions;
  63365. return feature;
  63366. })
  63367. }
  63368. if (me.format === DataFormat.GEOJSON) {
  63369. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  63370. }
  63371. }
  63372. }
  63373. }
  63374. me.events.triggerEvent("processCompleted", {
  63375. result: result,
  63376. options
  63377. });
  63378. }
  63379. dataFormat() {
  63380. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  63381. }
  63382. /**
  63383. * @function QueryService.prototype.getQueryParameters
  63384. * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
  63385. * @param {Object} params - JSON 字符串表示的查询参数。
  63386. * @returns {QueryParameters} 返回转化后的 QueryParameters 对象。
  63387. */
  63388. getQueryParameters(params) {
  63389. return new QueryParameters({
  63390. customParams: params.customParams,
  63391. expectCount: params.expectCount,
  63392. networkType: params.networkType,
  63393. queryOption: params.queryOption,
  63394. queryParams: params.queryParams,
  63395. startRecord: params.startRecord,
  63396. prjCoordSys: params.prjCoordSys,
  63397. holdTime: params.holdTime
  63398. });
  63399. }
  63400. }
  63401. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsParameters.js
  63402. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  63403. * This program are made available under the terms of the Apache License, Version 2.0
  63404. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63405. /**
  63406. * @class QueryByBoundsParameters
  63407. * @deprecatedclass SuperMap.QueryByBoundsParameters
  63408. * @category iServer Map QueryResults
  63409. * @classdesc Bounds 查询参数类。该类用于设置 Bounds 查询的相关参数。
  63410. * @extends {QueryParameters}
  63411. * @param {Object} options - 参数。
  63412. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 指定的查询范围。
  63413. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  63414. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  63415. * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  63416. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  63417. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  63418. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  63419. * @param {number} [options.startRecord=0] - 查询起始记录号。
  63420. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  63421. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  63422. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  63423. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  63424. * @usage
  63425. */
  63426. class QueryByBoundsParameters extends QueryParameters {
  63427. constructor(options) {
  63428. options = options || {};
  63429. super(options);
  63430. /**
  63431. * @member {boolean} [QueryByBoundsParameters.prototype.returnContent=true]
  63432. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  63433. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  63434. * 为 false,则返回的是查询结果资源的 URI。
  63435. */
  63436. this.returnContent = true;
  63437. /**
  63438. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} QueryByBoundsParameters.prototype.bounds
  63439. * @description 指定的查询范围。
  63440. */
  63441. this.bounds = null;
  63442. Util_Util.extend(this, options);
  63443. this.CLASS_NAME = "SuperMap.QueryByBoundsParameters";
  63444. }
  63445. /**
  63446. * @function QueryByBoundsParameters.prototype.destroy
  63447. * @description 释放资源,将引用资源的属性置空。
  63448. */
  63449. destroy() {
  63450. super.destroy();
  63451. var me = this;
  63452. me.returnContent = null;
  63453. if (me.bounds) {
  63454. me.bounds = null;
  63455. }
  63456. }
  63457. }
  63458. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsService.js
  63459. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  63460. * This program are made available under the terms of the Apache License, Version 2.0
  63461. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63462. /**
  63463. * @class QueryByBoundsService
  63464. * @deprecatedclass SuperMap.QueryByBoundsService
  63465. * @category iServer Map QueryResults
  63466. * @classdesc Bounds 查询服务类。
  63467. * @augments {QueryService}
  63468. * @example
  63469. * (start end)
  63470. * var myQueryByBoundsService = new QueryByBoundsService(url, {
  63471. * eventListeners: {
  63472. * "processCompleted": queryCompleted,
  63473. * "processFailed": queryError
  63474. * }
  63475. * });
  63476. * function queryCompleted(object){//todo};
  63477. * function queryError(object){//todo};
  63478. * (end)
  63479. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  63480. * @param {Object} options - 参数。
  63481. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
  63482. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  63483. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  63484. * @param {Object} [options.headers] - 请求头。
  63485. * @usage
  63486. */
  63487. class QueryByBoundsService extends QueryServiceBase {
  63488. constructor(url, options) {
  63489. super(url, options);
  63490. this.CLASS_NAME = "SuperMap.QueryByBoundsService";
  63491. }
  63492. /**
  63493. * @override
  63494. */
  63495. destroy() {
  63496. super.destroy();
  63497. }
  63498. /**
  63499. * @function QueryByBoundsService.prototype.getJsonParameters
  63500. * @description 将查询参数转化为 JSON 字符串。
  63501. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds 等)。
  63502. * @param {QueryByBoundsParameters} params - Bounds 查询参数。
  63503. * @returns {Object} 转化后的 JSON 字符串。
  63504. */
  63505. getJsonParameters(params) {
  63506. if (!(params instanceof QueryByBoundsParameters)) {
  63507. return null;
  63508. }
  63509. var me = this,
  63510. jsonParameters = "",
  63511. qp = null,
  63512. bounds = params.bounds;
  63513. qp = me.getQueryParameters(params);
  63514. jsonParameters += "'queryMode':'BoundsQuery','queryParameters':";
  63515. jsonParameters += Util_Util.toJSON(qp);
  63516. jsonParameters += ",'bounds': {'rightTop':{'y':" + bounds.top + ",'x':" +
  63517. bounds.right + "},'leftBottom':{'y':" + bounds.bottom + ",'x':" + bounds.left + "}}";
  63518. jsonParameters = "{" + jsonParameters + "}";
  63519. return jsonParameters;
  63520. }
  63521. }
  63522. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceParameters.js
  63523. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  63524. * This program are made available under the terms of the Apache License, Version 2.0
  63525. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63526. /**
  63527. * @class QueryByDistanceParameters
  63528. * @deprecatedclass SuperMap.QueryByDistanceParameters
  63529. * @category iServer Map QueryResults
  63530. * @classdesc Distance 查询参数类。
  63531. * 该类用于设置 Distance 查询的相关参数。
  63532. * @extends {QueryParameters}
  63533. * @param {Object} options - 参数。
  63534. * @param {GeoJSONObject} options.geometry - 用于查询的几何对象。
  63535. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  63536. * @param {number} options.distance - 查询距离,单位与所查询图层对应的数据集单位相同。距离查询时,表示距离地物的距离。最近地物查询时,表示搜索的范围。此为必选参数。
  63537. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  63538. * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  63539. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  63540. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  63541. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  63542. * @param {number} [options.startRecord=0] - 查询起始记录号。
  63543. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  63544. * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
  63545. * @param {boolean} [options.isNearest=false] - 是否为最近距离查询。
  63546. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  63547. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  63548. * @usage
  63549. */
  63550. class QueryByDistanceParameters extends QueryParameters {
  63551. constructor(options) {
  63552. options = options || {};
  63553. super(options);
  63554. /**
  63555. * @member {number} [QueryByDistanceParameters.prototype.distance=0]
  63556. * @description 查询距离,单位与所查询图层对应的数据集单位相同。
  63557. * 距离查询时,表示距离地物的距离。最近地物查询时,表示搜索的范围。
  63558. */
  63559. /**
  63560. * @member {GeoJSONObject} QueryByDistanceParameters.prototype.geometry
  63561. * @description 用于查询的地理对象。<br>
  63562. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLat}|{@link mapboxgl.Point}|{@link GeoJSONObject}。<br>
  63563. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  63564. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
  63565. */
  63566. this.geometry = null;
  63567. /**
  63568. * @member {boolean} [QueryByDistanceParameters.prototype.isNearest=false]
  63569. * @description 是否为最近距离查询。<br>
  63570. * 建议该属性与 expectCount(继承自 {@link QueryParameters})属性联合使用。
  63571. * 当该属性为 true 时,即表示查找最近地物,如果查询结果数大于期望返回的结果记录数(expectCount),
  63572. * 则查找结果为查询总记录中距离中心最近的 expectCount 个地物。
  63573. * 当该属性为不为 true 时,如果查询结果数大于期望返回的结果记录数(expectCount),
  63574. * 则查找结果为从查询总记录中随机抽取的 expectCount 个地物。
  63575. * 目前查询结果不支持按远近距离排序。
  63576. */
  63577. this.isNearest = null;
  63578. /**
  63579. * @member {boolean} [QueryByDistanceParameters.prototype.returnContent=true]
  63580. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  63581. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  63582. * 为 false,则返回的是查询结果资源的 URI。
  63583. */
  63584. this.returnContent = true;
  63585. Util_Util.extend(this, options);
  63586. this.CLASS_NAME = "SuperMap.QueryByDistanceParameters";
  63587. }
  63588. /**
  63589. * @function QueryByDistanceParameters.prototype.destroy
  63590. * @description 释放资源,将引用资源的属性置空。
  63591. */
  63592. destroy() {
  63593. super.destroy();
  63594. var me = this;
  63595. me.returnContent = null;
  63596. me.distance = null;
  63597. me.isNearest = null;
  63598. if (me.geometry) {
  63599. me.geometry.destroy();
  63600. me.geometry = null;
  63601. }
  63602. }
  63603. }
  63604. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceService.js
  63605. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  63606. * This program are made available under the terms of the Apache License, Version 2.0
  63607. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63608. /**
  63609. * @class QueryByDistanceService
  63610. * @deprecatedclass SuperMap.QueryByDistanceService
  63611. * @category iServer Map QueryResults
  63612. * @classdesc Distance查询服务类。
  63613. * @extends {QueryServiceBase}
  63614. * @example
  63615. * var myQueryByDistService = new QueryByDistanceService(url, {
  63616. * eventListeners: {
  63617. * "processCompleted": queryCompleted,
  63618. * "processFailed": queryError
  63619. * }
  63620. * });
  63621. * function queryCompleted(object){//todo};
  63622. * function queryError(object){//todo};
  63623. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  63624. * @param {Object} options - 参数。
  63625. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  63626. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  63627. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  63628. * @param {Object} [options.headers] - 请求头。
  63629. * @usage
  63630. */
  63631. class QueryByDistanceService extends QueryServiceBase {
  63632. constructor(url, options) {
  63633. super(url, options);
  63634. this.CLASS_NAME = "SuperMap.QueryByDistanceService";
  63635. }
  63636. /**
  63637. * @override
  63638. */
  63639. destroy() {
  63640. super.destroy();
  63641. }
  63642. /**
  63643. * @function QueryByDistanceService.prototype.getJsonParameters
  63644. * @description 将查询参数转化为 JSON 字符串。
  63645. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  63646. * @param {QueryByDistanceParameters} params - Distance 查询参数类。
  63647. * @returns {Object} 转化后的 JSON 字符串。
  63648. */
  63649. getJsonParameters(params) {
  63650. if (!(params instanceof QueryByDistanceParameters)) {
  63651. return;
  63652. }
  63653. var me = this,
  63654. jsonParameters = "",
  63655. qp = me.getQueryParameters(params);
  63656. var sg = ServerGeometry.fromGeometry(params.geometry);
  63657. jsonParameters += params.isNearest ? "'queryMode':'FindNearest','queryParameters':" : "'queryMode':'DistanceQuery','queryParameters':";
  63658. jsonParameters += Util_Util.toJSON(qp);
  63659. jsonParameters += ",'geometry':" + Util_Util.toJSON(sg) + ",'distance':" + params.distance;
  63660. jsonParameters = "{" + jsonParameters + "}";
  63661. return jsonParameters;
  63662. }
  63663. }
  63664. ;// CONCATENATED MODULE: ./src/common/iServer/QueryBySQLParameters.js
  63665. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  63666. * This program are made available under the terms of the Apache License, Version 2.0
  63667. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63668. /**
  63669. * @class QueryBySQLParameters
  63670. * @deprecatedclass SuperMap.QueryBySQLParameters
  63671. * @category iServer Map QueryResults
  63672. * @classdesc SQL 查询参数类。
  63673. * 该类用于设置 SQL 查询的相关参数。
  63674. * @extends {QueryParameters}
  63675. * @param {Object} options - 参数。
  63676. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  63677. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  63678. * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  63679. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  63680. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  63681. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  63682. * @param {number} [options.startRecord=0] - 查询起始记录号。
  63683. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  63684. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  63685. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  63686. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  63687. * @usage
  63688. */
  63689. class QueryBySQLParameters extends QueryParameters {
  63690. constructor(options) {
  63691. options = options || {};
  63692. super(options);
  63693. /**
  63694. * @member {boolean} [QueryBySQLParameters.prototype.returnContent=true]
  63695. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  63696. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  63697. * 为 false,则返回的是查询结果资源的 URI。
  63698. */
  63699. this.returnContent = true;
  63700. Util_Util.extend(this, options);
  63701. this.CLASS_NAME = "SuperMap.QueryBySQLParameters";
  63702. }
  63703. /**
  63704. * @function QueryBySQLParameters.prototype.destroy
  63705. * @description 释放资源,将引用资源的属性置空。
  63706. */
  63707. destroy() {
  63708. super.destroy();
  63709. var me = this;
  63710. me.returnContent = null;
  63711. }
  63712. }
  63713. ;// CONCATENATED MODULE: ./src/common/iServer/QueryBySQLService.js
  63714. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  63715. * This program are made available under the terms of the Apache License, Version 2.0
  63716. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63717. /**
  63718. * @class QueryBySQLService
  63719. * @deprecatedclass SuperMap.QueryBySQLService
  63720. * @category iServer Map QueryResults
  63721. * @classdesc SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
  63722. * @extends {QueryServiceBase}
  63723. * @example
  63724. * var queryParam = new FilterParameter({
  63725. * name: "Countries@World.1",
  63726. * attributeFilter: "Pop_1994>1000000000 and SmArea>900"
  63727. * });
  63728. * var queryBySQLParams = new QueryBySQLParameters({
  63729. * queryParams: [queryParam]
  63730. * });
  63731. * var myQueryBySQLService = new QueryBySQLService(url, {eventListeners: {
  63732. * "processCompleted": queryCompleted,
  63733. * "processFailed": queryError
  63734. * }
  63735. * });
  63736. * queryBySQLService.processAsync(queryBySQLParams);
  63737. * function queryCompleted(object){//todo};
  63738. * function queryError(object){//todo};
  63739. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  63740. * @param {Object} options - 参数。
  63741. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  63742. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  63743. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  63744. * @param {Object} [options.headers] - 请求头。
  63745. * @usage
  63746. */
  63747. class QueryBySQLService extends QueryServiceBase {
  63748. constructor(url, options) {
  63749. super(url, options);
  63750. this.CLASS_NAME = "SuperMap.QueryBySQLService";
  63751. }
  63752. /**
  63753. * @override
  63754. */
  63755. destroy() {
  63756. super.destroy();
  63757. }
  63758. /**
  63759. * @function QueryBySQLService.prototype.getJsonParameters
  63760. * @description 将查询参数转化为 JSON 字符串。
  63761. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  63762. * @param {QueryBySQLParameters} params - SQL 查询参数类。
  63763. * @returns {Object} 转化后的 JSON 字符串。
  63764. */
  63765. getJsonParameters(params) {
  63766. if (!(params instanceof QueryBySQLParameters)) {
  63767. return;
  63768. }
  63769. var me = this,
  63770. jsonParameters = "",
  63771. qp = null;
  63772. qp = me.getQueryParameters(params);
  63773. jsonParameters += "'queryMode':'SqlQuery','queryParameters':";
  63774. jsonParameters += Util_Util.toJSON(qp);
  63775. jsonParameters = "{" + jsonParameters + "}";
  63776. return jsonParameters;
  63777. }
  63778. }
  63779. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryParameters.js
  63780. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  63781. * This program are made available under the terms of the Apache License, Version 2.0
  63782. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63783. /**
  63784. * @class QueryByGeometryParameters
  63785. * @deprecatedclass SuperMap.QueryByGeometryParameters
  63786. * @category iServer Map QueryResults
  63787. * @classdesc Geometry 查询参数类。
  63788. * 该类用于设置 Geometry查询的相关参数。
  63789. * @extends {QueryParameters}
  63790. * @param {Object} options - 参数。
  63791. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  63792. * @param {GeoJSONObject} options.geometry - 查询的几何对象。
  63793. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  63794. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  63795. * @param {Object} [options.prjCoordSys] -自定义参数,供SuperMap Online提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  63796. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  63797. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  63798. * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
  63799. * @param {number} [options.startRecord=0] - 查询起始记录号。
  63800. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  63801. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  63802. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  63803. * @param {SpatialQueryMode} [spatialQueryMode=SpatialQueryMode.INTERSECT] - 空间查询模式。
  63804. * @usage
  63805. */
  63806. class QueryByGeometryParameters extends QueryParameters {
  63807. constructor(options) {
  63808. options = options || {};
  63809. super(options);
  63810. /**
  63811. * @member {boolean} [QueryByGeometryParameters.prototype.returnContent=true]
  63812. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。<br>
  63813. * 如果为 true,则直接返回新创建资源,即查询结果的表述。<br>
  63814. * 为 false,则返回的是查询结果资源的 URI。
  63815. */
  63816. this.returnContent = true;
  63817. /**
  63818. * @member {GeoJSONObject} QueryByGeometryParameters.prototype.geometry
  63819. * @description 用于查询的几何对象。<br>
  63820. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLat}|{@link mapboxgl.Point}|{@link GeoJSONObject}。<br>
  63821. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  63822. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
  63823. */
  63824. this.geometry = null;
  63825. /**
  63826. * @member {SpatialQueryMode} [QueryByGeometryParameters.prototype.spatialQueryMode=SpatialQueryMode.INTERSECT]
  63827. * @description 空间查询模式。
  63828. */
  63829. this.spatialQueryMode = SpatialQueryMode.INTERSECT;
  63830. Util_Util.extend(this, options);
  63831. this.CLASS_NAME = "SuperMap.QueryByGeometryParameters";
  63832. }
  63833. /**
  63834. * @function QueryByGeometryParameters.prototype.destroy
  63835. * @description 释放资源,将引用资源的属性置空。
  63836. */
  63837. destroy() {
  63838. super.destroy();
  63839. var me = this;
  63840. me.returnContent = null;
  63841. me.geometry = null;
  63842. me.spatialQueryMode = null;
  63843. }
  63844. }
  63845. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryService.js
  63846. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  63847. * This program are made available under the terms of the Apache License, Version 2.0
  63848. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63849. /**
  63850. * @class QueryByGeometryService
  63851. * @deprecatedclass SuperMap.QueryByGeometryService
  63852. * @category iServer Map QueryResults
  63853. * @classdesc Geometry查询服务类。
  63854. * @extends {QueryServiceBase}
  63855. * @example
  63856. * var myQueryByGeometryService = new QueryByGeometryService(url, {
  63857. * eventListeners: {
  63858. * "processCompleted": queryCompleted,
  63859. * "processFailed": queryError
  63860. * }
  63861. * });
  63862. * function queryCompleted(object){//todo};
  63863. * function queryError(object){//todo};
  63864. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  63865. * @param {Object} options - 参数。
  63866. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  63867. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  63868. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  63869. * @param {Object} [options.headers] - 请求头。
  63870. * @usage
  63871. */
  63872. class QueryByGeometryService extends QueryServiceBase {
  63873. constructor(url, options) {
  63874. super(url, options);
  63875. this.CLASS_NAME = "SuperMap.QueryByGeometryService";
  63876. }
  63877. /**
  63878. * @override
  63879. */
  63880. destroy() {
  63881. super.destroy();
  63882. }
  63883. /**
  63884. * @function QueryByGeometryService.prototype.getJsonParameters
  63885. * @description 将查询参数转化为 JSON 字符串。
  63886. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  63887. * @param {QueryByGeometryParameters} params - Geometry 查询参数类。
  63888. * @returns {Object} 转化后的 JSON 字符串。
  63889. */
  63890. getJsonParameters(params) {
  63891. if (!(params instanceof QueryByGeometryParameters)) {
  63892. return;
  63893. }
  63894. var me = this,
  63895. jsonParameters = "",
  63896. qp = null,
  63897. geometry = params.geometry,
  63898. sg = ServerGeometry.fromGeometry(geometry);
  63899. qp = me.getQueryParameters(params);
  63900. jsonParameters += "'queryMode':'SpatialQuery','queryParameters':";
  63901. jsonParameters += Util_Util.toJSON(qp) + ",'geometry':" + Util_Util.toJSON(sg)
  63902. + ",'spatialQueryMode':" + Util_Util.toJSON(params.spatialQueryMode);
  63903. jsonParameters = "{" + jsonParameters + "}";
  63904. return jsonParameters;
  63905. }
  63906. }
  63907. ;// CONCATENATED MODULE: ./src/common/iServer/QueryService.js
  63908. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  63909. * This program are made available under the terms of the Apache License, Version 2.0
  63910. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63911. /**
  63912. * @class QueryService
  63913. * @category iServer Map QueryResults
  63914. * @classdesc 地图查询服务类。
  63915. * 提供:范围查询,SQL 查询,几何查询,距离查询。
  63916. * @extends {ServiceBase}
  63917. * @param {string} url - 服务地址。
  63918. * @param {Object} options - 参数。
  63919. * @param {string} [options.proxy] - 服务代理地址。
  63920. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  63921. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  63922. * @param {Object} [options.headers] - 请求头。
  63923. * @example
  63924. * new QueryService(url)
  63925. * .queryByBounds(param,function(result){
  63926. * //doSomething
  63927. * })
  63928. * @usage
  63929. */
  63930. class QueryService_QueryService {
  63931. constructor(url, options) {
  63932. this.options = options || {};
  63933. this.url = url;
  63934. }
  63935. /**
  63936. * @function QueryService.prototype.queryByBounds
  63937. * @description Bounds 查询地图服务。
  63938. * @param {QueryByBoundsParameters} params - Bounds 查询参数类。
  63939. * @param {RequestCallback} callback - 回调函数。
  63940. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63941. */
  63942. queryByBounds(params, callback, resultFormat) {
  63943. var me = this;
  63944. var queryService = new QueryByBoundsService(me.url, {
  63945. proxy: me.options.proxy,
  63946. withCredentials: me.options.withCredentials,
  63947. crossOrigin: me.options.crossOrigin,
  63948. headers: me.options.headers,
  63949. eventListeners: {
  63950. scope: me,
  63951. processCompleted: callback,
  63952. processFailed: callback
  63953. },
  63954. format: me._processFormat(resultFormat)
  63955. });
  63956. queryService.processAsync(params);
  63957. }
  63958. /**
  63959. * @function QueryService.prototype.queryByDistance
  63960. * @description 地图距离查询服务。
  63961. * @param {QueryByDistanceParameters} params - Distance 查询参数类。
  63962. * @param {RequestCallback} callback - 回调函数。
  63963. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型
  63964. */
  63965. queryByDistance(params, callback, resultFormat) {
  63966. var me = this;
  63967. var queryByDistanceService = new QueryByDistanceService(me.url, {
  63968. proxy: me.options.proxy,
  63969. withCredentials: me.options.withCredentials,
  63970. crossOrigin: me.options.crossOrigin,
  63971. headers: me.options.headers,
  63972. eventListeners: {
  63973. scope: me,
  63974. processCompleted: callback,
  63975. processFailed: callback
  63976. },
  63977. format: resultFormat
  63978. });
  63979. queryByDistanceService.processAsync(params);
  63980. }
  63981. /**
  63982. * @function QueryService.prototype.queryBySQL
  63983. * @description 地图 SQL 查询服务。
  63984. * @param {QueryBySQLParameters} params - SQL 查询参数类。
  63985. * @param {RequestCallback} callback - 回调函数。
  63986. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  63987. */
  63988. queryBySQL(params, callback, resultFormat) {
  63989. var me = this;
  63990. var queryBySQLService = new QueryBySQLService(me.url, {
  63991. proxy: me.options.proxy,
  63992. withCredentials: me.options.withCredentials,
  63993. crossOrigin: me.options.crossOrigin,
  63994. headers: me.options.headers,
  63995. eventListeners: {
  63996. scope: me,
  63997. processCompleted: callback,
  63998. processFailed: callback
  63999. },
  64000. format: resultFormat
  64001. });
  64002. queryBySQLService.processAsync(params);
  64003. }
  64004. /**
  64005. * @function QueryService.prototype.queryByGeometry
  64006. * @description 地图几何查询服务。
  64007. * @param {QueryByGeometryParameters} params - Geometry 查询参数类。
  64008. * @param {RequestCallback} callback - 回调函数。
  64009. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  64010. */
  64011. queryByGeometry(params, callback, resultFormat) {
  64012. var me = this;
  64013. var queryByGeometryService = new QueryByGeometryService(me.url, {
  64014. proxy: me.options.proxy,
  64015. withCredentials: me.options.withCredentials,
  64016. crossOrigin: me.options.crossOrigin,
  64017. headers: me.options.headers,
  64018. eventListeners: {
  64019. scope: me,
  64020. processCompleted: callback,
  64021. processFailed: callback
  64022. },
  64023. format: resultFormat
  64024. });
  64025. queryByGeometryService.processAsync(params);
  64026. }
  64027. _processFormat(resultFormat) {
  64028. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  64029. }
  64030. }
  64031. ;// CONCATENATED MODULE: ./src/mapboxgl/services/QueryService.js
  64032. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64033. * This program are made available under the terms of the Apache License, Version 2.0
  64034. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64035. /**
  64036. * @class QueryService
  64037. * @category iServer Map QueryResults
  64038. * @classdesc 地图查询服务类。
  64039. * 提供:范围查询,SQL 查询,几何查询,距离查询。
  64040. * @modulecategory Services
  64041. * @extends {ServiceBase}
  64042. * @param {string} url - 服务地址。
  64043. * @param {Object} options - 参数。
  64044. * @param {string} [options.proxy] - 服务代理地址。
  64045. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  64046. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  64047. * @param {Object} [options.headers] - 请求头。
  64048. * @example
  64049. * new QueryService(url)
  64050. * .queryByBounds(param,function(result){
  64051. * //doSomething
  64052. * })
  64053. * @usage
  64054. */
  64055. class QueryService extends ServiceBase {
  64056. constructor(url, options) {
  64057. super(url, options);
  64058. this._queryService = new QueryService_QueryService(url, options);
  64059. }
  64060. /**
  64061. * @function QueryService.prototype.queryByBounds
  64062. * @description Bounds 查询地图服务。
  64063. * @param {QueryByBoundsParameters} params - Bounds 查询参数类。
  64064. * @param {RequestCallback} callback - 回调函数。
  64065. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  64066. */
  64067. queryByBounds(params, callback, resultFormat) {
  64068. params = this._processParams(params);
  64069. this._queryService.queryByBounds(params, callback, resultFormat);
  64070. }
  64071. /**
  64072. * @function QueryService.prototype.queryByDistance
  64073. * @description 地图距离查询服务。
  64074. * @param {QueryByDistanceParameters} params - Distance 查询参数类。
  64075. * @param {RequestCallback} callback - 回调函数。
  64076. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型
  64077. */
  64078. queryByDistance(params, callback, resultFormat) {
  64079. params = this._processParams(params);
  64080. this._queryService.queryByDistance(params, callback, resultFormat);
  64081. }
  64082. /**
  64083. * @function QueryService.prototype.queryBySQL
  64084. * @description 地图 SQL 查询服务。
  64085. * @param {QueryBySQLParameters} params - SQL 查询参数类。
  64086. * @param {RequestCallback} callback - 回调函数。
  64087. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  64088. */
  64089. queryBySQL(params, callback, resultFormat) {
  64090. params = this._processParams(params);
  64091. this._queryService.queryBySQL(params, callback, resultFormat);
  64092. }
  64093. /**
  64094. * @function QueryService.prototype.queryByGeometry
  64095. * @description 地图几何查询服务。
  64096. * @param {QueryByGeometryParameters} params - Geometry 查询参数类。
  64097. * @param {RequestCallback} callback - 回调函数。
  64098. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  64099. */
  64100. queryByGeometry(params, callback, resultFormat) {
  64101. params = this._processParams(params);
  64102. this._queryService.queryByGeometry(params, callback, resultFormat);
  64103. }
  64104. _processParams(params) {
  64105. if (!params) {
  64106. return {};
  64107. }
  64108. params.returnContent = params.returnContent == null ? true : params.returnContent;
  64109. if (params.queryParams && !core_Util_Util.isArray(params.queryParams)) {
  64110. params.queryParams = [params.queryParams];
  64111. }
  64112. if (params.bounds) {
  64113. if (params.bounds instanceof Array) {
  64114. params.bounds = new Bounds(params.bounds[0], params.bounds[1], params.bounds[2], params.bounds[3]);
  64115. }
  64116. if (params.bounds instanceof (external_mapboxgl_default()).LngLatBounds) {
  64117. params.bounds = new Bounds(
  64118. params.bounds.getSouthWest().lng,
  64119. params.bounds.getSouthWest().lat,
  64120. params.bounds.getNorthEast().lng,
  64121. params.bounds.getNorthEast().lat
  64122. );
  64123. }
  64124. }
  64125. if (params.geometry) {
  64126. if (params.geometry instanceof (external_mapboxgl_default()).LngLat) {
  64127. params.geometry = new Point(params.geometry.lng, params.geometry.lat);
  64128. }
  64129. if (params.geometry instanceof (external_mapboxgl_default()).Point) {
  64130. params.geometry = new Point(params.geometry.x, params.geometry.y);
  64131. }
  64132. if (params.geometry instanceof (external_mapboxgl_default()).LngLatBounds) {
  64133. params.geometry = core_Util_Util.toSuperMapPolygon(params.geometry);
  64134. }
  64135. if (!(params.geometry instanceof Geometry_Geometry)) {
  64136. params.geometry = core_Util_Util.toSuperMapGeometry(params.geometry);
  64137. }
  64138. }
  64139. return params;
  64140. }
  64141. }
  64142. ;// CONCATENATED MODULE: ./src/common/iServer/SpatialAnalystBase.js
  64143. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64144. * This program are made available under the terms of the Apache License, Version 2.0
  64145. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64146. /**
  64147. * @class SpatialAnalystBase
  64148. * @deprecatedclass SuperMap.SpatialAnalystBase
  64149. * @category iServer Core
  64150. * @classdesc 空间分析服务基类。
  64151. * @param {string} url - 地址。
  64152. * @param {Object} options - 可选参数。
  64153. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  64154. * @param {Object} [options.headers] - 请求头。
  64155. * @extends {CommonServiceBase}
  64156. * @usage
  64157. */
  64158. class SpatialAnalystBase extends CommonServiceBase {
  64159. constructor(url, options) {
  64160. super(url, options);
  64161. /**
  64162. * @member {DataFormat} [SpatialAnalystBase.prototype.format=DataFormat.GEOJSON]
  64163. * @description 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  64164. */
  64165. this.format = options.format || DataFormat.GEOJSON;
  64166. this.CLASS_NAME = "SuperMap.SpatialAnalystBase";
  64167. }
  64168. /**
  64169. * @function SpatialAnalystBase.prototype.destroy
  64170. * @override
  64171. */
  64172. destroy() {
  64173. super.destroy();
  64174. this.format = null;
  64175. }
  64176. /**
  64177. * @function SpatialAnalystBase.prototype.serviceProcessCompleted
  64178. * @description 分析完成,执行此方法。
  64179. * @param {Object} result - 服务器返回的结果对象。
  64180. */
  64181. serviceProcessCompleted(result, options) {
  64182. var me = this, analystResult;
  64183. result = Util_Util.transformResult(result);
  64184. if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
  64185. //批量分析时会返回多个结果
  64186. if (Util_Util.isArray(result)) {
  64187. for (var i = 0; i < result.length; i++) {
  64188. result[i] = me.toGeoJSONResult(result[i])
  64189. }
  64190. analystResult = result;
  64191. } else {
  64192. analystResult = me.toGeoJSONResult(result);
  64193. }
  64194. }
  64195. if (!analystResult) {
  64196. analystResult = result;
  64197. }
  64198. me.events.triggerEvent("processCompleted", {result: analystResult, options});
  64199. }
  64200. /**
  64201. * @function SpatialAnalystBase.prototype.toGeoJSONResult
  64202. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  64203. * @param {Object} result - 服务器返回的结果对象。
  64204. *
  64205. */
  64206. toGeoJSONResult(result) {
  64207. if (!result) {
  64208. return null;
  64209. }
  64210. //批量叠加分析时结果这样处理
  64211. if (result.result && result.result.resultGeometry) {
  64212. result = result.result
  64213. }
  64214. var geoJSONFormat = new GeoJSON();
  64215. if (result.recordsets) {
  64216. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  64217. if (recordsets[i].features) {
  64218. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  64219. }
  64220. }
  64221. } else if (result.recordset && result.recordset.features) {
  64222. result.recordset.features =geoJSONFormat.toGeoJSON(result.recordset.features);
  64223. }
  64224. if (result.resultGeometry) {
  64225. result.resultGeometry = geoJSONFormat.toGeoJSON(result.resultGeometry);
  64226. }
  64227. if (result.regions) {
  64228. result.regions = geoJSONFormat.toGeoJSON(result.regions);
  64229. }
  64230. return result;
  64231. }
  64232. }
  64233. ;// CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationParameters.js
  64234. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64235. * This program are made available under the terms of the Apache License, Version 2.0
  64236. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64237. /**
  64238. * @class AreaSolarRadiationParameters
  64239. * @deprecatedclass SuperMap.AreaSolarRadiationParameters
  64240. * @category iServer SpatialAnalyst SolarRadiationAnalyst
  64241. * @classdesc 地区太阳辐射参数类。
  64242. * @param {Object} options - 参数。
  64243. * @param {string} options.dataset - 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"的形式来表示,例如:JingjinTerrain@Jingjin。
  64244. * @param {string} options.targetDatasourceName - 指定的存储结果数据集的数据源名称, 例如:"Jingjin"。
  64245. * @param {string} options.totalGridName - 指定地区太阳辐射总辐射量数据集的名称。
  64246. * @param {string} options.diffuseDatasetGridName - 指定地区太阳辐射散射辐射量数据集的名称。
  64247. * @param {string} options.durationDatasetGridName - 指定地区太阳辐射太阳直射持续时间数据集的名称。
  64248. * @param {string} options.directDatasetGridName - 指定地区太阳辐射直射辐射量数据集的名称。
  64249. * @param {number} options.latitude - 待计算区域的纬度值。
  64250. * @param {string} [options.timeMode = 'MULTIDAYS'] - 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
  64251. * @param {number} options.dayStart - 起始日期(年内的第几天)。
  64252. * @param {number} options.dayEnd - 结束日期(年内的第几天)。
  64253. * @param {number} [options.hourStart] - 起始时间(一天中的第几个小时)。
  64254. * @param {number} [options.hourEnd] - 结束时间(一天中的第几个小时)。
  64255. * @param {number} [options.transmittance] - 太阳辐射穿过大气的透射率。
  64256. * @param {number} [options.hourInterval=0.5] - 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确,如果修改此参数,必须使用整数)。
  64257. * @param {number} [options.dayInterval=5] - 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确,必须使用整数)。
  64258. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  64259. * @usage
  64260. */
  64261. class AreaSolarRadiationParameters {
  64262. constructor(options) {
  64263. /**
  64264. * @member {string} AreaSolarRadiationParameters.prototype.dataset
  64265. * @description 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示,例如:JingjinTerrain@Jingjin。注:地区太阳辐射数据必须为栅格数据集。
  64266. */
  64267. this.dataset = null;
  64268. /**
  64269. * @member {string} AreaSolarRadiationParameters.prototype.targetDatasourceName
  64270. * @description 指定的存储结果数据集的数据源名称,例如:"Jingjin"。
  64271. */
  64272. this.targetDatasourceName = null;
  64273. /**
  64274. * @member {string} AreaSolarRadiationParameters.prototype.totalGridName
  64275. * @description 指定地区太阳辐射总辐射量数据集的名称。
  64276. */
  64277. this.totalGridName = null;
  64278. /**
  64279. * @member {string} AreaSolarRadiationParameters.prototype.diffuseDatasetGridName
  64280. * @description 指定地区太阳辐射散射辐射量数据集的名称。
  64281. */
  64282. this.diffuseDatasetGridName = null;
  64283. /**
  64284. * @member {string} AreaSolarRadiationParameters.prototype.durationDatasetGridName
  64285. * @description 指定地区太阳辐射太阳直射持续时间数据集的名称。
  64286. */
  64287. this.durationDatasetGridName = null;
  64288. /**
  64289. * @member {string} AreaSolarRadiationParameters.prototype.directDatasetGridName
  64290. * @description 指定地区太阳辐射直射辐射量数据集的名称。
  64291. */
  64292. this.directDatasetGridName = null;
  64293. /**
  64294. * @member {number} AreaSolarRadiationParameters.prototype.latitude
  64295. * @description 待计算区域的纬度值。
  64296. */
  64297. this.latitude = null;
  64298. /**
  64299. * @member {string} [AreaSolarRadiationParameters.prototype.timeMode='MULTIDAYS']
  64300. * @description 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
  64301. */
  64302. this.timeMode = "MULTIDAYS";
  64303. /**
  64304. * @member {number} AreaSolarRadiationParameters.prototype.dayStart
  64305. * @description 起始日期(年内的第几天)。
  64306. */
  64307. this.dayStart = null;
  64308. /**
  64309. * @member {number} AreaSolarRadiationParameters.prototype.dayEnd
  64310. * @description 结束日期(年内的第几天)。
  64311. */
  64312. this.dayEnd = null;
  64313. /**
  64314. * @member {number} [AreaSolarRadiationParameters.prototype.hourStart]
  64315. * @description 起始时间(一天中的第几个小时)。
  64316. */
  64317. this.hourStart = null;
  64318. /**
  64319. * @member {number} [AreaSolarRadiationParameters.prototype.hourEnd]
  64320. * @description 结束时间(一天中的第几个小时)。
  64321. */
  64322. this.hourEnd = null;
  64323. /**
  64324. * @member {number} [AreaSolarRadiationParameters.prototype.transmittance]
  64325. * @description 太阳辐射穿过大气的透射率。
  64326. */
  64327. this.transmittance = null;
  64328. /**
  64329. * @member {number} [AreaSolarRadiationParameters.prototype.hourInterval=0.5]
  64330. * @description 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确, 如果修改此参数,必须使用整数)
  64331. */
  64332. this.hourInterval = null;
  64333. /**
  64334. * @member {number} [AreaSolarRadiationParameters.prototype.dayInterval=5]
  64335. * @description 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确, 必须使用整数)
  64336. */
  64337. this.dayInterval = null;
  64338. /**
  64339. * @member {boolean} [AreaSolarRadiationParameters.prototype.deleteExistResultDataset=false]
  64340. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  64341. */
  64342. this.deleteExistResultDataset = false;
  64343. Util_Util.extend(this, options);
  64344. this.CLASS_NAME = "SuperMap.AreaSolarRadiationParameters";
  64345. }
  64346. /**
  64347. * @function AreaSolarRadiationParameters.prototype.destroy
  64348. * @description 释放资源,将引用资源的属性置空。
  64349. */
  64350. destroy() {
  64351. var me = this;
  64352. me.dataset = null;
  64353. me.zFactor = 1.0;
  64354. me.averageCurvatureName = null;
  64355. me.profileCurvatureName = null;
  64356. me.planCurvatureName = null;
  64357. me.deleteExistResultDataset = true;
  64358. }
  64359. /**
  64360. * @function AreaSolarRadiationParameters.toObject
  64361. * @param {AreaSolarRadiationParameters} param - 地区太阳辐射参数类。
  64362. * @param {AreaSolarRadiationParameters} tempObj - 地区太阳辐射参数对象。
  64363. * @returns {Object} JSON对象。
  64364. * @description 将AreaSolarRadiationParameters对象转换成JSON对象。
  64365. */
  64366. static toObject(param, tempObj) {
  64367. var parameter = {};
  64368. for (var name in param) {
  64369. if (name !== "dataset") {
  64370. var name1 = (name === "latitude" || name === "timeMode" || name === "dayStart");
  64371. var name2 = (name === "dayEnd" || name === "hourStart" || name === "hourEnd");
  64372. var name3 = (name === "transmittance" || name === "hourInterval" || name === "dayInterval");
  64373. if (name1 || name2 || name3) {
  64374. parameter[name] = param[name];
  64375. } else {
  64376. tempObj[name] = param[name];
  64377. }
  64378. }
  64379. }
  64380. tempObj["parameter"] = parameter;
  64381. }
  64382. }
  64383. ;// CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationService.js
  64384. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64385. * This program are made available under the terms of the Apache License, Version 2.0
  64386. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64387. /**
  64388. * @class AreaSolarRadiationService
  64389. * @deprecatedclass SuperMap.AreaSolarRadiationService
  64390. * @category iServer SpatialAnalyst SolarRadiationAnalyst
  64391. * @classdesc 地区太阳辐射服务类。
  64392. * @param {string} url - 服务的访问地址。如:</br>http://localhost:8090/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst。</br>
  64393. * @param {Object} options - 参数。</br>
  64394. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  64395. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  64396. * @param {Object} [options.headers] - 请求头。
  64397. * @extends {SpatialAnalystBase}
  64398. * @example 例如:
  64399. * (start code)
  64400. * var myAreaSolarRadiationService = new AreaSolarRadiationService(url);
  64401. * myAreaSolarRadiationService.on({
  64402. * "processCompleted": processCompleted,
  64403. * "processFailed": processFailed
  64404. * }
  64405. * );
  64406. * (end)
  64407. * @usage
  64408. */
  64409. class AreaSolarRadiationService extends SpatialAnalystBase {
  64410. constructor(url, options) {
  64411. super(url, options);
  64412. this.CLASS_NAME = "SuperMap.AreaSolarRadiationService";
  64413. }
  64414. /**
  64415. * @function AreaSolarRadiationService.prototype.destroy
  64416. * @override
  64417. */
  64418. destroy() {
  64419. super.destroy();
  64420. }
  64421. /**
  64422. * @function AreaSolarRadiationService.prototype.processAsync
  64423. * @description 负责将客户端的查询参数传递到服务端。
  64424. * @param {AreaSolarRadiationParameters} parameter - 地区太阳辐射参数。
  64425. */
  64426. processAsync(parameter) {
  64427. if (!(parameter instanceof AreaSolarRadiationParameters)) {
  64428. return;
  64429. }
  64430. var me = this;
  64431. var parameterObject = {};
  64432. if (parameter instanceof AreaSolarRadiationParameters) {
  64433. me.url = Util_Util.urlPathAppend(me.url, `datasets/${parameter.dataset}/solarradiation`);
  64434. }
  64435. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  64436. AreaSolarRadiationParameters.toObject(parameter, parameterObject);
  64437. var jsonParameters = Util_Util.toJSON(parameterObject);
  64438. me.request({
  64439. method: 'POST',
  64440. data: jsonParameters,
  64441. scope: me,
  64442. success: me.serviceProcessCompleted,
  64443. failure: me.serviceProcessFailed
  64444. });
  64445. }
  64446. }
  64447. ;// CONCATENATED MODULE: ./src/common/iServer/BufferDistance.js
  64448. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64449. * This program are made available under the terms of the Apache License, Version 2.0
  64450. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64451. /**
  64452. * @class BufferDistance
  64453. * @deprecatedclass SuperMap.BufferDistance
  64454. * @category iServer SpatialAnalyst BufferAnalyst
  64455. * @classdesc 缓冲区分析的缓冲距离类。通过该类可以设置缓冲区分析的缓冲距离,距离可以是数值也可以是数值型的字段表达式。
  64456. * @param {Object} options - 可选参数。
  64457. * @param {string} [options.exp] - 以数值型的字段表达式作为缓冲区分析的距离值。
  64458. * @param {number} [options.value=100] - 以数值作为缓冲区分析的距离值。单位:米。
  64459. * @usage
  64460. */
  64461. class BufferDistance {
  64462. constructor(options) {
  64463. /**
  64464. * @member {string} [BufferDistance.prototype.exp]
  64465. * @description 以数值型的字段表达式作为缓冲区分析的距离值。
  64466. */
  64467. this.exp = null;
  64468. /**
  64469. * @member {number} [BufferDistance.prototype.value=100]
  64470. * @description 以数值作为缓冲区分析的距离值。单位:米。
  64471. */
  64472. this.value = 100;
  64473. Util_Util.extend(this, options);
  64474. this.CLASS_NAME = "SuperMap.BufferDistance";
  64475. }
  64476. /**
  64477. * @function BufferDistance.prototype.destroy
  64478. * @description 释放资源,将引用资源的属性置空。
  64479. */
  64480. destroy() {
  64481. this.exp = null;
  64482. this.value = null;
  64483. }
  64484. }
  64485. ;// CONCATENATED MODULE: ./src/common/iServer/BufferSetting.js
  64486. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64487. * This program are made available under the terms of the Apache License, Version 2.0
  64488. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64489. /**
  64490. * @class BufferSetting
  64491. * @deprecatedclass SuperMap.BufferSetting
  64492. * @category iServer SpatialAnalyst BufferAnalyst
  64493. * @classdesc 缓冲区分析通用设置类。
  64494. * @param {Object} options - 可选参数。
  64495. * @param {BufferEndType} [options.endType=BufferEndType.FLAT] - 缓冲区端点枚举值。
  64496. * @param {BufferDistance} [options.leftDistance=100] - 左侧缓冲距离。
  64497. * @param {BufferDistance} [options.rightDistance=100] - 右侧缓冲距离。
  64498. * @param {number} [options.semicircleLineSegment=4] - 圆头缓冲圆弧处线段的个数。
  64499. * @param {BufferRadiusUnit} [options.radiusUnit=BufferRadiusUnit.METER] - 缓冲半径单位。
  64500. * @usage
  64501. */
  64502. class BufferSetting {
  64503. constructor(options) {
  64504. /**
  64505. * @member {BufferEndType} [BufferSetting.prototype.endType = BufferEndType.FLAT]
  64506. * @description 缓冲区端点枚举值。分为平头和圆头两种。
  64507. */
  64508. this.endType = BufferEndType.FLAT;
  64509. /**
  64510. * @member {BufferDistance} [BufferSetting.prototype.leftDistance=100]
  64511. * @description 左侧缓冲距离。
  64512. * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
  64513. * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting.radiusUnit}设置(默认全部为米)。
  64514. */
  64515. this.leftDistance = new BufferDistance();
  64516. /**
  64517. * @member {BufferDistance} [BufferSetting.prototype.rightDistance=100]
  64518. * @description 右侧缓冲距离。
  64519. * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
  64520. * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting#radiusUnit}设置(默认全部为米)。
  64521. */
  64522. this.rightDistance = new BufferDistance();
  64523. /**
  64524. * @member {number} [BufferSetting.prototype.semicircleLineSegment=4]
  64525. * @description 圆头缓冲圆弧处线段的个数。即用多少个线段来模拟一个半圆。
  64526. */
  64527. this.semicircleLineSegment = 4;
  64528. /**
  64529. * @member {BufferRadiusUnit} [BufferSetting.prototype.radiusUnit = BufferRadiusUnit.METER]
  64530. * @description 缓冲半径单位,可以是{@link BufferRadiusUnit.METER}、{@link BufferRadiusUnit.MILLIMETER}、
  64531. * {@link BufferRadiusUnit.CENTIMETER}、{@link BufferRadiusUnit.DECIMETER}、{@link BufferRadiusUnit.KILOMETER}、
  64532. * {@link BufferRadiusUnit.FOOT}、{@link BufferRadiusUnit.INCH}、{@link BufferRadiusUnit.MILE}、{@link BufferRadiusUnit.YARD}。
  64533. * 仅对BufferAnalyst有效。
  64534. */
  64535. this.radiusUnit = BufferRadiusUnit.METER;
  64536. if (options) {
  64537. Util_Util.extend(this, options);
  64538. }
  64539. this.CLASS_NAME = "SuperMap.BufferSetting";
  64540. }
  64541. /**
  64542. * @function BufferSetting.prototype.destroy
  64543. * @description 释放资源,将引用资源的属性置空。
  64544. */
  64545. destroy() {
  64546. let me = this;
  64547. me.endType = null;
  64548. if (me.leftDistance) {
  64549. me.leftDistance.destroy();
  64550. me.leftDistance = null;
  64551. }
  64552. if (me.rightDistance) {
  64553. me.rightDistance.destroy();
  64554. me.rightDistance = null;
  64555. }
  64556. me.semicircleLineSegment = null;
  64557. me.radiusUnit = null;
  64558. }
  64559. }
  64560. ;// CONCATENATED MODULE: ./src/common/iServer/BufferAnalystParameters.js
  64561. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64562. * This program are made available under the terms of the Apache License, Version 2.0
  64563. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64564. /**
  64565. * @class BufferAnalystParameters
  64566. * @deprecatedclass SuperMap.BufferAnalystParameters
  64567. * @category iServer SpatialAnalyst BufferAnalyst
  64568. * @classdesc 缓冲区分析参数基类。
  64569. * @param {Object} options - 参数。
  64570. * @param {BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
  64571. * @usage
  64572. */
  64573. class BufferAnalystParameters {
  64574. constructor(options) {
  64575. var me = this;
  64576. /**
  64577. * @member {BufferSetting} [BufferAnalystParameters.prototype.bufferSetting]
  64578. * @description 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
  64579. */
  64580. me.bufferSetting = new BufferSetting();
  64581. Util_Util.extend(this, options);
  64582. this.CLASS_NAME = "SuperMap.BufferAnalystParameters";
  64583. }
  64584. /**
  64585. * @function BufferAnalystParameters.prototype.destroy
  64586. * @description 释放资源,将引用资源的属性置空。
  64587. */
  64588. destroy() {
  64589. var me = this;
  64590. if (me.bufferSetting) {
  64591. me.bufferSetting.destroy();
  64592. me.bufferSetting = null;
  64593. }
  64594. }
  64595. }
  64596. ;// CONCATENATED MODULE: ./src/common/iServer/DataReturnOption.js
  64597. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64598. * This program are made available under the terms of the Apache License, Version 2.0
  64599. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64600. /**
  64601. * @class DataReturnOption
  64602. * @deprecatedclass SuperMap.DataReturnOption
  64603. * @category iServer Data Dataset
  64604. * @classdesc 数据返回设置类。
  64605. * @param {Object} options - 参数。
  64606. * @param {number} [options.expectCount=1000] - 设置返回的最大记录数,小于或者等于 0 时表示返回所有记录数。
  64607. * @param {string} [options.dataset] - 设置结果数据集标识,当 dataReturnMode 为 {@link DataReturnMode.DATASET_ONLY}或{@link DataReturnMode.DATASET_AND_RECORDSET}时有效,
  64608. * 作为返回数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  64609. * @param {DataReturnMode} [options.dataReturnMode=DataReturnMode.RECORDSET_ONLY] - 数据返回模式。
  64610. * @param {boolean} [options.deleteExistResultDataset=true] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  64611. * @usage
  64612. */
  64613. class DataReturnOption {
  64614. constructor(options) {
  64615. /**
  64616. * @member {number} [DataReturnOption.prototype.expectCount=1000]
  64617. * @description 设置返回的最大记录数,小于或者等于0时表示返回所有记录数。
  64618. */
  64619. this.expectCount = 1000;
  64620. /**
  64621. * @member {string} [DataReturnOption.prototype.dataset]
  64622. * @description 设置结果数据集标识,当dataReturnMode为 {@link DataReturnMode.DATASET_ONLY}
  64623. * 或{@link DataReturnMode.DATASET_AND_RECORDSET}时有效,
  64624. * 作为返回数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
  64625. */
  64626. this.dataset = null;
  64627. /**
  64628. * @member {DataReturnMode} [DataReturnOption.prototype.dataReturnMode=DataReturnMode.RECORDSET_ONLY]
  64629. * @description 数据返回模式。
  64630. */
  64631. this.dataReturnMode = DataReturnMode.RECORDSET_ONLY;
  64632. /**
  64633. * @member {boolean} [DataReturnOption.prototype.deleteExistResultDataset=true]
  64634. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  64635. */
  64636. this.deleteExistResultDataset = true;
  64637. Util_Util.extend(this, options);
  64638. this.CLASS_NAME = "SuperMap.DataReturnOption";
  64639. }
  64640. /**
  64641. * @function DataReturnOption.prototype.destroy
  64642. * @description 释放资源,将引用资源的属性置空。
  64643. */
  64644. destroy() {
  64645. var me = this;
  64646. me.expectCount = null;
  64647. me.dataset = null;
  64648. me.dataReturnMode = null;
  64649. me.deleteExistResultDataset = null;
  64650. }
  64651. }
  64652. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetBufferAnalystParameters.js
  64653. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64654. * This program are made available under the terms of the Apache License, Version 2.0
  64655. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64656. /**
  64657. * @class DatasetBufferAnalystParameters
  64658. * @deprecatedclass SuperMap.DatasetBufferAnalystParameters
  64659. * @category iServer SpatialAnalyst BufferAnalyst
  64660. * @classdesc 数据集缓冲区分析参数类。
  64661. * @param {Object} options - 参数。
  64662. * @param {string} options.dataset - 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  64663. * @param {FilterParameter} [options.filterQueryParameter] - 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
  64664. * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
  64665. * @param {boolean} [options.isAttributeRetained=true] - 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
  64666. * @param {boolean} [options.isUnion=false] - 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
  64667. * @param {BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
  64668. *
  64669. * @extends {BufferAnalystParameters}
  64670. * @usage
  64671. */
  64672. class DatasetBufferAnalystParameters extends BufferAnalystParameters {
  64673. constructor(options) {
  64674. super(options);
  64675. /**
  64676. * @member {string} DatasetBufferAnalystParameters.prototype.dataset
  64677. * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  64678. */
  64679. this.dataset = null;
  64680. /**
  64681. * @member {FilterParameter} [DatasetBufferAnalystParameters.prototype.filterQueryParameter]
  64682. * @description 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
  64683. */
  64684. this.filterQueryParameter = new FilterParameter();
  64685. /**
  64686. * @member {DataReturnOption} [DatasetBufferAnalystParameters.prototype.resultSetting]
  64687. * @description 结果返回设置类。
  64688. */
  64689. this.resultSetting = new DataReturnOption();
  64690. /**
  64691. * @member {boolean} [DatasetBufferAnalystParameters.prototype.isAttributeRetained=true]
  64692. * @description 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
  64693. */
  64694. this.isAttributeRetained = true;
  64695. /**
  64696. * @member {boolean} [DatasetBufferAnalystParameters.prototype.isUnion=false]
  64697. * @description 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
  64698. */
  64699. this.isUnion = false;
  64700. Util_Util.extend(this, options);
  64701. this.CLASS_NAME = "SuperMap.DatasetBufferAnalystParameters";
  64702. }
  64703. /**
  64704. * @function DatasetBufferAnalystParameters.prototype.destroy
  64705. * @override
  64706. */
  64707. destroy() {
  64708. super.destroy();
  64709. var me = this;
  64710. me.dataset = null;
  64711. if (me.filterQueryParameter) {
  64712. me.filterQueryParameter.destroy();
  64713. me.filterQueryParameter = null;
  64714. }
  64715. if (me.resultSetting) {
  64716. me.resultSetting.destroy();
  64717. me.resultSetting = null;
  64718. }
  64719. me.isAttributeRetained = null;
  64720. me.isUnion = null;
  64721. }
  64722. /**
  64723. * @function DatasetBufferAnalystParameters.toObject
  64724. * @param {DatasetBufferAnalystParameters} datasetBufferAnalystParameters - 数据集缓冲区分析参数类。
  64725. * @param {DatasetBufferAnalystParameters} tempObj - 数据集缓冲区分析参数对象。
  64726. * @description 将数据集缓冲区分析参数对象转换为 JSON 对象。
  64727. * @returns {Object} JSON 对象。
  64728. */
  64729. static toObject(datasetBufferAnalystParameters, tempObj) {
  64730. for (var name in datasetBufferAnalystParameters) {
  64731. if (name === "bufferSetting") {
  64732. datasetBufferAnalystParameters.bufferSetting.radiusUnit = datasetBufferAnalystParameters.bufferSetting.radiusUnit.toUpperCase();
  64733. tempObj.bufferAnalystParameter = datasetBufferAnalystParameters.bufferSetting;
  64734. } else if (name === "resultSetting") {
  64735. tempObj.dataReturnOption = datasetBufferAnalystParameters.resultSetting;
  64736. } else if (name === "dataset") {
  64737. continue;
  64738. } else {
  64739. tempObj[name] = datasetBufferAnalystParameters[name];
  64740. }
  64741. }
  64742. }
  64743. }
  64744. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryBufferAnalystParameters.js
  64745. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64746. * This program are made available under the terms of the Apache License, Version 2.0
  64747. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64748. /**
  64749. * @class GeometryBufferAnalystParameters
  64750. * @deprecatedclass SuperMap.GeometryBufferAnalystParameters
  64751. * @category iServer SpatialAnalyst BufferAnalyst
  64752. * @classdesc 几何对象缓冲区分析参数类。
  64753. * 对指定的某个几何对象做缓冲区分析。通过该类可以指定要做缓冲区分析的几何对象、缓冲区参数等。
  64754. * @param {Object} options - 参数。
  64755. * @param {GeoJSONObject} options.sourceGeometry - 要做缓冲区分析的几何对象。
  64756. * @param {number} options.sourceGeometrySRID - 缓冲区几何对象投影坐标参数, 如 4326,3857。
  64757. * @param {BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
  64758. * @extends {BufferAnalystParameters}
  64759. * @usage
  64760. */
  64761. class GeometryBufferAnalystParameters extends BufferAnalystParameters {
  64762. constructor(options) {
  64763. super(options);
  64764. /**
  64765. * @member {GeoJSONObject} GeometryBufferAnalystParameters.prototype.sourceGeometry
  64766. * @description 要做缓冲区分析的几何对象。<br>
  64767. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。</br>
  64768. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。</br>
  64769. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  64770. */
  64771. this.sourceGeometry = null;
  64772. /**
  64773. * @member {number} GeometryBufferAnalystParameters.prototype.sourceGeometrySRID
  64774. * @description 缓冲区几何对象投影坐标参数, 如 4326,3857。
  64775. */
  64776. this.sourceGeometrySRID = null;
  64777. if (options) {
  64778. Util_Util.extend(this, options);
  64779. }
  64780. this.CLASS_NAME = " SuperMap.GeometryBufferAnalystParameters";
  64781. }
  64782. /**
  64783. * @function GeometryBufferAnalystParameters.prototype.destroy
  64784. * @override
  64785. */
  64786. destroy() {
  64787. super.destroy();
  64788. var me = this;
  64789. if (me.sourceGeometry) {
  64790. me.sourceGeometry.destroy();
  64791. me.sourceGeometry = null;
  64792. }
  64793. }
  64794. /**
  64795. * @function GeometryBufferAnalystParameters.toObject
  64796. * @param {GeometryBufferAnalystParameters} geometryBufferAnalystParameters - 几何对象缓冲区分析参数类。
  64797. * @param {GeometryBufferAnalystParameters} tempObj - 几何对象缓冲区分析参数对象。
  64798. * @description 将几何对象缓冲区分析参数对象转换为 JSON 对象。
  64799. * @returns {Object} JSON 对象。
  64800. */
  64801. static toObject(geometryBufferAnalystParameters, tempObj) {
  64802. for (var name in geometryBufferAnalystParameters) {
  64803. if (name === "bufferSetting") {
  64804. var tempBufferSetting = {};
  64805. for (var key in geometryBufferAnalystParameters.bufferSetting) {
  64806. tempBufferSetting[key] = geometryBufferAnalystParameters.bufferSetting[key];
  64807. }
  64808. tempObj.analystParameter = tempBufferSetting;
  64809. } else if (name === "sourceGeometry") {
  64810. tempObj.sourceGeometry = ServerGeometry.fromGeometry(geometryBufferAnalystParameters.sourceGeometry);
  64811. } else {
  64812. tempObj[name] = geometryBufferAnalystParameters[name];
  64813. }
  64814. }
  64815. }
  64816. }
  64817. ;// CONCATENATED MODULE: ./src/common/iServer/BufferAnalystService.js
  64818. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64819. * This program are made available under the terms of the Apache License, Version 2.0
  64820. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64821. /**
  64822. * @class BufferAnalystService
  64823. * @deprecatedclass SuperMap.BufferAnalystService
  64824. * @category iServer SpatialAnalyst BufferAnalyst
  64825. * @classdesc 缓冲区分析服务类。
  64826. * 该类负责将客户设置的缓冲区分析参数传递给服务端,并接收服务端返回的缓冲区分析结果数据。
  64827. * 缓冲区分析结果通过该类支持的事件的监听函数参数获取。
  64828. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  64829. * @param {Object} options - 参数。
  64830. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  64831. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  64832. * @param {Object} [options.headers] - 请求头。
  64833. * @extends {SpatialAnalystBase}
  64834. * @example 例如:
  64835. * (start code)
  64836. * var myBufferAnalystService = new BufferAnalystService(url, {
  64837. * eventListeners: {
  64838. * "processCompleted": bufferCompleted,
  64839. * "processFailed": bufferFailed
  64840. * }
  64841. * });
  64842. * (end)
  64843. * @usage
  64844. */
  64845. class BufferAnalystService extends SpatialAnalystBase {
  64846. constructor(url, options) {
  64847. super(url, options);
  64848. /**
  64849. * @member {string} BufferAnalystService.prototype.mode
  64850. * @description 缓冲区分析类型
  64851. */
  64852. this.mode = null;
  64853. if (options) {
  64854. Util_Util.extend(this, options);
  64855. }
  64856. this.CLASS_NAME = "SuperMap.BufferAnalystService";
  64857. }
  64858. /**
  64859. * @function BufferAnalystService.prototype.destroy
  64860. * @override
  64861. */
  64862. destroy() {
  64863. super.destroy();
  64864. this.mode = null;
  64865. }
  64866. /**
  64867. * @method BufferAnalystService.prototype.processAsync
  64868. * @description 负责将客户端的查询参数传递到服务端。
  64869. * @param {BufferAnalystParameters} parameter - 缓冲区分析参数
  64870. */
  64871. processAsync(parameter) {
  64872. var parameterObject = {};
  64873. var me = this;
  64874. if (parameter instanceof DatasetBufferAnalystParameters) {
  64875. me.mode = 'datasets';
  64876. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/buffer');
  64877. DatasetBufferAnalystParameters.toObject(parameter, parameterObject);
  64878. } else if (parameter instanceof GeometryBufferAnalystParameters) {
  64879. me.mode = 'geometry';
  64880. me.url = Util_Util.urlPathAppend(me.url, 'geometry/buffer');
  64881. GeometryBufferAnalystParameters.toObject(parameter, parameterObject);
  64882. }
  64883. var jsonParameters = Util_Util.toJSON(parameterObject);
  64884. this.returnContent = true;
  64885. me.request({
  64886. method: "POST",
  64887. data: jsonParameters,
  64888. scope: me,
  64889. success: me.serviceProcessCompleted,
  64890. failure: me.serviceProcessFailed
  64891. });
  64892. }
  64893. dataFormat() {
  64894. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  64895. }
  64896. }
  64897. ;// CONCATENATED MODULE: ./src/common/iServer/DensityKernelAnalystParameters.js
  64898. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64899. * This program are made available under the terms of the Apache License, Version 2.0
  64900. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64901. /**
  64902. * @class DensityKernelAnalystParameters
  64903. * @deprecatedclass SuperMap.DensityKernelAnalystParameters
  64904. * @category iServer SpatialAnalyst DensityAnalyst
  64905. * @classdesc 核密度分析参数类。
  64906. * @param {Object} options - 参数。
  64907. * @param {string} options.dataset - 要用来做核密度分析数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:BaseMap_P@Jingjin。
  64908. * @param {string} options.fieldName - 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
  64909. * @param {string} options.resultGridName - 指定结果数据集名称。
  64910. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.bounds] - 核密度分析的范围,用于确定结果栅格数据集的范围。如果缺省,则默认为原数据集的范围。
  64911. * @param {number} [options.searchRadius] - 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
  64912. * @param {number} [options.resultGridDatasetResolution] - 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
  64913. * @param {string} [options.targetDatasource] - 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
  64914. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  64915. * @usage
  64916. */
  64917. class DensityKernelAnalystParameters {
  64918. constructor(options) {
  64919. /**
  64920. * @member {string} DensityKernelAnalystParameters.prototype.dataset
  64921. * @description 要用来做核密度分析数据源中数据集的名称。
  64922. * 该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Railway@Changchun。
  64923. * 注:核密度分析支持点数据集和线数据集。
  64924. */
  64925. this.dataset = null;
  64926. /**
  64927. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [DensityKernelAnalystParameters.prototype.bounds]
  64928. * @description 核密度分析的范围,用于确定结果栅格数据集的范围。
  64929. * 如果缺省,则默认为原数据集的范围。
  64930. */
  64931. this.bounds = null;
  64932. /**
  64933. * @member {string} DensityKernelAnalystParameters.prototype.fieldName
  64934. * @description 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
  64935. */
  64936. this.fieldName = null;
  64937. /**
  64938. * @member {number} [DensityKernelAnalystParameters.prototype.resultGridDatasetResolution]
  64939. * @description 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
  64940. */
  64941. this.resultGridDatasetResolution = null;
  64942. /**
  64943. * @member {number} [DensityKernelAnalystParameters.prototype.searchRadius]
  64944. * @description 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
  64945. */
  64946. this.searchRadius = null;
  64947. /**
  64948. * @member {string} [DensityKernelAnalystParameters.prototype.targetDatasource]
  64949. * @description 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
  64950. */
  64951. this.targetDatasource = null;
  64952. /**
  64953. * @member {string} DensityKernelAnalystParameters.prototype.resultGridName
  64954. * @description 指定结果数据集名称。
  64955. */
  64956. this.resultGridName = null;
  64957. /**
  64958. * @member {boolean} [DensityKernelAnalystParameters.prototype.deleteExistResultDataset=false]
  64959. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  64960. */
  64961. this.deleteExistResultDataset = false;
  64962. Util_Util.extend(this, options);
  64963. this.CLASS_NAME = "SuperMap.DensityKernelAnalystParameters";
  64964. }
  64965. /**
  64966. * @function DensityKernelAnalystParameters.prototype.destroy
  64967. * @description 释放资源,将引用资源的属性置空。
  64968. */
  64969. destroy() {
  64970. var me = this;
  64971. me.dataset = null;
  64972. me.bounds = null;
  64973. me.fieldName = null;
  64974. me.resultGridDatasetResolution = null;
  64975. me.searchRadius = null;
  64976. me.targetDatasource = null;
  64977. me.resultGridName = null;
  64978. me.deleteExistResultDataset = null;
  64979. }
  64980. /**
  64981. * @function DensityKernelAnalystParameters.toObject
  64982. * @param {DensityKernelAnalystParameters} densityKernelAnalystParameters -核密度分析参数类。
  64983. * @param {DensityKernelAnalystParameters} tempObj - 核密度分析参数对象。
  64984. * @description 将核密度分析参数对象转换成 JSON 对象。
  64985. * @returns JSON 对象。
  64986. */
  64987. static toObject(densityKernelAnalystParameters, tempObj) {
  64988. for (var name in densityKernelAnalystParameters) {
  64989. if (name !== "dataset") {
  64990. tempObj[name] = densityKernelAnalystParameters[name];
  64991. }
  64992. }
  64993. }
  64994. }
  64995. ;// CONCATENATED MODULE: ./src/common/iServer/DensityAnalystService.js
  64996. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64997. * This program are made available under the terms of the Apache License, Version 2.0
  64998. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64999. /**
  65000. * @class DensityAnalystService
  65001. * @deprecatedclass SuperMap.DensityAnalystService
  65002. * @category iServer SpatialAnalyst DensityAnalyst
  65003. * @classdesc
  65004. * 密度分析服务类,密度分析可计算每个输出栅格像元周围圆形邻域内输入的点或线对象的密度。
  65005. * 密度分析,在某种意义上来说,相当于在表面上将输入的点线对象的测量值散开来,将每个点或线对象的测量量分布在整个研究区域,并计算输出栅格中每个像元的密度值。目前提供1种密度分析:核密度分析(Kernel)。
  65006. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
  65007. * @param {Object} options - 参数。
  65008. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  65009. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  65010. * @param {Object} [options.headers] - 请求头。
  65011. * @extends {SpatialAnalystBase}
  65012. * @example 例如:
  65013. * var myDensityAnalystService = new DensityAnalystService(url);
  65014. * myDensityAnalystService.on({
  65015. * "processCompleted": processCompleted,
  65016. * "processFailed": processFailed
  65017. * }
  65018. * );
  65019. * @usage
  65020. */
  65021. class DensityAnalystService extends SpatialAnalystBase {
  65022. constructor(url, options) {
  65023. super(url, options);
  65024. /**
  65025. * @member {string} DensityAnalystService.prototype.mode
  65026. * @description 密度分析类型。
  65027. */
  65028. this.mode = null;
  65029. if (options) {
  65030. Util_Util.extend(this, options);
  65031. }
  65032. this.CLASS_NAME = "SuperMap.DensityAnalystService";
  65033. }
  65034. /**
  65035. * @function DensityAnalystService.prototype.destroy
  65036. * @description 释放资源,将引用资源的属性置空。
  65037. */
  65038. destroy() {
  65039. super.destroy();
  65040. this.mode = null;
  65041. }
  65042. /**
  65043. * @function DensityAnalystService.prototype.processAsync
  65044. * @description 负责将客户端的查询参数传递到服务端。
  65045. * @param {DensityKernelAnalystParameters} parameter - 核密度分析参数。
  65046. */
  65047. processAsync(parameter) {
  65048. var me = this;
  65049. var parameterObject = new Object();
  65050. if (parameter instanceof DensityKernelAnalystParameters) {
  65051. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/densityanalyst/kernel');
  65052. me.mode = "kernel";
  65053. }
  65054. DensityKernelAnalystParameters.toObject(parameter, parameterObject);
  65055. var jsonParameters = Util_Util.toJSON(parameterObject);
  65056. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  65057. me.request({
  65058. method: "POST",
  65059. data: jsonParameters,
  65060. scope: me,
  65061. success: me.serviceProcessCompleted,
  65062. failure: me.serviceProcessFailed
  65063. });
  65064. }
  65065. }
  65066. ;// CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataParameters.js
  65067. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65068. * This program are made available under the terms of the Apache License, Version 2.0
  65069. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65070. /**
  65071. * @class GenerateSpatialDataParameters
  65072. * @deprecatedclass SuperMap.GenerateSpatialDataParameters
  65073. * @category iServer SpatialAnalyst GenerateSpatialData
  65074. * @classdesc 动态分段操作参数类。通过该类可以为动态分段提供参数信息。
  65075. * @param {Object} options - 参数。
  65076. * @param {string} options.routeTable - 路由数据集。
  65077. * @param {string} options.routeIDField - 路由数据集的标识字段。
  65078. * @param {string} options.eventTable - 用于生成空间数据的事件表名。
  65079. * @param {DataReturnOption} options.dataReturnOption - 设置数据返回选项。
  65080. * @param {string} [options.attributeFilter] - 属性过滤条件。
  65081. * @param {string} options.eventRouteIDField - 用于生成空间数据的事件表的路由标识字段。
  65082. * @param {string} [options.measureField] - 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义。
  65083. * @param {string} [options.measureStartField] - 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
  65084. * @param {string} [options.measureEndField] - 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
  65085. * @param {string} [options.measureOffsetField] - 刻度偏移量字段。
  65086. * @param {string} [options.errorInfoField] - 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
  65087. * @param {Array.<string>} [options.retainedFields] - 欲保留到结果空间数据中的字段集合(系统字段除外)。
  65088. * @usage
  65089. */
  65090. class GenerateSpatialDataParameters {
  65091. constructor(options) {
  65092. /**
  65093. * @member {string} GenerateSpatialDataParameters.prototype.routeTable
  65094. * @description 路由数据集。
  65095. */
  65096. this.routeTable = null;
  65097. /**
  65098. * @member {string} GenerateSpatialDataParameters.prototype.routeIDField
  65099. * @description 路由数据集的标识字段。
  65100. */
  65101. this.routeIDField = null;
  65102. /**
  65103. * @member {string} [GenerateSpatialDataParameters.prototype.attributeFilter]
  65104. * @description 属性过滤条件。
  65105. * 当 {@link GenerateSpatialDataParameters.prototype.dataReturnOption.dataReturnMode} 为 {@link DataReturnMode.DATASET_AND_RECORDSET} 或 {@link DataReturnMode.RECORDSET_ONLY} 时有效。
  65106. */
  65107. this.attributeFilter = null;
  65108. /**
  65109. * @member {string} GenerateSpatialDataParameters.prototype.eventTable
  65110. * @description 用于生成空间数据的事件表名。
  65111. */
  65112. this.eventTable = null;
  65113. /**
  65114. * @member {string} GenerateSpatialDataParameters.prototype.eventRouteIDField
  65115. * @description 用于生成空间数据的事件表的路由标识字段。
  65116. */
  65117. this.eventRouteIDField = null;
  65118. /**
  65119. * @member {string} [GenerateSpatialDataParameters.prototype.measureField]
  65120. * @description 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义。
  65121. */
  65122. this.measureField = null;
  65123. /**
  65124. * @member {string} [GenerateSpatialDataParameters.prototype.measureStartField]
  65125. * @description 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
  65126. */
  65127. this.measureStartField = null;
  65128. /**
  65129. * @member {string} [GenerateSpatialDataParameters.prototype.measureEndField]
  65130. * @description 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
  65131. */
  65132. this.measureEndField = null;
  65133. /**
  65134. * @member {string} [GenerateSpatialDataParameters.prototype.measureOffsetField]
  65135. * @description 刻度偏移量字段。
  65136. */
  65137. this.measureOffsetField = null;
  65138. /**
  65139. * @member {string} [GenerateSpatialDataParameters.prototype.errorInfoField]
  65140. * @description 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
  65141. */
  65142. this.errorInfoField = null;
  65143. /**
  65144. * @member {Array.<string>} [GenerateSpatialDataParameters.prototype.retainedFields]
  65145. * @description 欲保留到结果空间数据中的字段集合(系统字段除外)。
  65146. * 生成空间数据时,无论是否指定保留字段,路由 ID 字段、刻度偏移量字段、刻度值字段(点事件为刻度字段,线事件是起始和终止刻度字段)都会保留到结果空间数据中;
  65147. * 如果没有指定 retainedFields 参数或者 retainedFields 参数数组长度为 0,则返回所有用户字段。
  65148. */
  65149. this.retainedFields = null;
  65150. /**
  65151. * @member {DataReturnOption} GenerateSpatialDataParameters.prototype.dataReturnOption
  65152. * @description 设置数据返回的选项。
  65153. */
  65154. this.dataReturnOption = null;
  65155. if (options) {
  65156. Util_Util.extend(this, options);
  65157. }
  65158. this.CLASS_NAME = "SuperMap.GenerateSpatialDataParameters";
  65159. }
  65160. /**
  65161. * @function GenerateSpatialDataParameters.prototype.destroy
  65162. * @description 释放资源,将引用资源的属性置空。
  65163. */
  65164. destroy() {
  65165. var me = this;
  65166. if (me.routeTable) {
  65167. me.routeTable = null;
  65168. }
  65169. me.routeIDField = null;
  65170. me.attributeFilter = null;
  65171. me.eventTable = null;
  65172. me.eventRouteIDField = null;
  65173. me.measureField = null;
  65174. me.measureStartField = null;
  65175. me.measureEndField = null;
  65176. me.measureOffsetField = null;
  65177. me.errorInfoField = null;
  65178. if (me.dataReturnOption) {
  65179. me.dataReturnOption.destroy();
  65180. me.dataReturnOption = null;
  65181. }
  65182. }
  65183. }
  65184. ;// CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataService.js
  65185. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65186. * This program are made available under the terms of the Apache License, Version 2.0
  65187. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65188. /**
  65189. * @class GenerateSpatialDataService
  65190. * @deprecatedclass SuperMap.GenerateSpatialDataService
  65191. * @category iServer SpatialAnalyst GenerateSpatialData
  65192. * @classdesc 动态分段分析服务类。该类负责将客户设置的动态分段分析服务参数传递给服务端,并接收服务端返回的动态分段分析结果数据。
  65193. * 获取的结果数据包括 originResult 、result 两种,其中,originResult 为服务端返回的用 JSON 对象表示的动态分段分析结果数据,result 为服务端返回的动态分段分析结果数据。
  65194. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  65195. * @param {Object} options - 参数。</br>
  65196. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  65197. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  65198. * @param {Object} [options.headers] - 请求头。
  65199. * @extends {SpatialAnalystBase}
  65200. * @example 实例化该类如下例所示:
  65201. * (start code)
  65202. * function GenerateSpatialData(){
  65203. *
  65204. * //配置数据返回选项(option)
  65205. * var option = new DataReturnOption({
  65206. * expectCount: 1000,
  65207. * dataset: "generateSpatialData",
  65208. * deleteExistResultDataset: true,
  65209. * dataReturnMode: DataReturnMode.DATASET_ONLY
  65210. * }),
  65211. * //配置动态分段参数(Parameters)
  65212. * parameters = new GenerateSpatialDataParameters({
  65213. * routeTable: "RouteDT_road@Changchun",
  65214. * routeIDField: "RouteID",
  65215. * eventTable: "LinearEventTabDT@Changchun",
  65216. * eventRouteIDField: "RouteID",
  65217. * measureField: "",
  65218. * measureStartField: "LineMeasureFrom",
  65219. * measureEndField: "LineMeasureTo",
  65220. * measureOffsetField: "",
  65221. * errorInfoField: "",
  65222. * retainedFields:[],
  65223. * dataReturnOption: option
  65224. * }),
  65225. * //配置动态分段iService
  65226. * iService = new GenerateSpatialDataService(Changchun_spatialanalyst, {
  65227. * eventListeners: {
  65228. * processCompleted: generateCompleted,
  65229. * processFailed: generateFailded
  65230. * }
  65231. * });
  65232. * //执行
  65233. * iService.processAsync(parameters);
  65234. * function Completed(generateSpatialDataEventArgs){//todo};
  65235. * function Error(generateSpatialDataEventArgs){//todo};
  65236. * (end)
  65237. * @usage
  65238. */
  65239. class GenerateSpatialDataService extends SpatialAnalystBase {
  65240. constructor(url, options) {
  65241. super(url, options);
  65242. this.CLASS_NAME = "SuperMap.GenerateSpatialDataService";
  65243. }
  65244. /**
  65245. * @function GenerateSpatialDataService.prototype.destroy
  65246. * @override
  65247. */
  65248. destroy() {
  65249. super.destroy();
  65250. }
  65251. /**
  65252. * @function GenerateSpatialDataService.prototype.processAsync
  65253. * @description 负责将客户端的动态分段服务参数传递到服务端。
  65254. * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
  65255. */
  65256. processAsync(params) {
  65257. if (!(params instanceof GenerateSpatialDataParameters)) {
  65258. return;
  65259. }
  65260. var me = this,
  65261. jsonParameters;
  65262. jsonParameters = me.getJsonParameters(params);
  65263. me.request({
  65264. method: "POST",
  65265. data: jsonParameters,
  65266. scope: me,
  65267. success: me.serviceProcessCompleted,
  65268. failure: me.serviceProcessFailed
  65269. });
  65270. }
  65271. /**
  65272. * @function GenerateSpatialDataService.prototype.getJsonParameters
  65273. * @description 将参数转化为 JSON 字符串。
  65274. * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
  65275. * @returns {string}转化后的JSON字符串。
  65276. */
  65277. getJsonParameters(params) {
  65278. var jsonParameters = "",
  65279. jsonStr = "datasets/" + params.routeTable + "/linearreferencing/generatespatialdata",
  65280. me = this;
  65281. me.url = Util_Util.urlPathAppend(me.url, jsonStr);
  65282. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  65283. jsonParameters = Util_Util.toJSON(params);
  65284. return jsonParameters;
  65285. }
  65286. }
  65287. ;// CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystParameters.js
  65288. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65289. * This program are made available under the terms of the Apache License, Version 2.0
  65290. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65291. /**
  65292. * @class GeoRelationAnalystParameters
  65293. * @deprecatedclass SuperMap.GeoRelationAnalystParameters
  65294. * @category iServer SpatialAnalyst GeoRelationAnalyst
  65295. * @classdesc 空间关系分析服务参数类。使用该类可以为空间关系分析服务提供所需的参数信息。
  65296. * @param {Object} options - 参数。
  65297. * @param {FilterParameter} options.sourceFilter - 空间关系分析中的源数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
  65298. * @param {FilterParameter} options.referenceFilter - 空间关系分析中的参考数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
  65299. * @param {SpatialRelationType} options.spatialRelationType - 指定的空间关系类型。
  65300. * @param {boolean} [options.isBorderInside] - 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
  65301. * @param {boolean} [options.returnFeature] - 是否返回 Feature 信息。
  65302. * @param {boolean} [options.returnGeoRelatedOnly=true] - 仅返回满足指定空间关系的空间对象。
  65303. * @param {number} [options.startRecord=0] - 分析结果起始记录位置。
  65304. * @param {number} [options.expectCount=500] - 空间关系分析期望返回结果记录数,如果实际不足500条结果则返回所有分析结果。
  65305. * @usage
  65306. */
  65307. class GeoRelationAnalystParameters {
  65308. constructor(options) {
  65309. /**
  65310. * @member {string} GeoRelationAnalystParameters.prototype.dataset
  65311. * @description 源数据集名称。
  65312. */
  65313. this.dataset = null;
  65314. /**
  65315. * @member {FilterParameter} GeoRelationAnalystParameters.prototype.sourceFilter
  65316. * @description 空间关系分析中的源数据集查询参数。仅 ids、attributeFilter 和 fields 字段有效。
  65317. */
  65318. this.sourceFilter = null;
  65319. /**
  65320. * @member {FilterParameter} GeoRelationAnalystParameters.prototype.referenceFilter
  65321. * @description 空间关系分析中的参考数据集查询参数。仅 name,ids,attributeFilter 和 fields 字段有效。
  65322. */
  65323. this.referenceFilter = null;
  65324. /**
  65325. * @member {SpatialRelationType} GeoRelationAnalystParameters.prototype.spatialRelationType
  65326. * @description 指定的空间关系类型。
  65327. */
  65328. this.spatialRelationType = null;
  65329. /**
  65330. * @member {boolean} [GeoRelationAnalystParameters.prototype.isBorderInside]
  65331. * @description 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
  65332. */
  65333. this.isBorderInside = null;
  65334. /**
  65335. * @member {boolean} [GeoRelationAnalystParameters.prototype.returnFeature]
  65336. * @description 是否返回 Feature 信息。
  65337. */
  65338. this.returnFeature = null;
  65339. /**
  65340. * @member {boolean} [GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=true]
  65341. * @description 是否仅返回满足指定空间关系的空间对象。
  65342. */
  65343. this.returnGeoRelatedOnly = null;
  65344. /**
  65345. * @member {number} [GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=0]
  65346. * @description 分析结果起始记录位置。
  65347. */
  65348. this.startRecord = 0;
  65349. /**
  65350. * @member {number} [GeoRelationAnalystParameters.prototype.expectCount=500]
  65351. * @description 空间关系分析期望返回结果记录数,如果实际不足 500 条结果则返回所有分析结果。
  65352. */
  65353. this.expectCount = 500;
  65354. if (options) {
  65355. Util_Util.extend(this, options);
  65356. }
  65357. this.CLASS_NAME = "SuperMap.GeoRelationAnalystParameters";
  65358. }
  65359. /**
  65360. * @function GeoRelationAnalystParameters.prototype.destroy
  65361. * @description 释放资源,将引用资源的属性置空。
  65362. */
  65363. destroy() {
  65364. var me = this;
  65365. if (me.sourceFilter) {
  65366. me.sourceFilter.destroy();
  65367. }
  65368. me.sourceFilter = null;
  65369. if (me.referenceFilter) {
  65370. me.referenceFilter.destroy();
  65371. }
  65372. me.referenceFilter = null;
  65373. me.dataset = null;
  65374. me.spatialRelationType = null;
  65375. me.isBorderInside = null;
  65376. me.returnFeature = null;
  65377. me.returnGeoRelatedOnly = null;
  65378. me.startRecord = null;
  65379. me.expectCount = null;
  65380. }
  65381. }
  65382. ;// CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystService.js
  65383. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65384. * This program are made available under the terms of the Apache License, Version 2.0
  65385. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65386. /**
  65387. * @class GeoRelationAnalystService
  65388. * @deprecatedclass SuperMap.GeoRelationAnalystService
  65389. * @category iServer SpatialAnalyst GeoRelationAnalyst
  65390. * @classdesc 空间关系分析服务类。该类负责将客户设置的空间关系分析服务参数传递给服务端,并接收服务端返回的空间关系分析结果数据。
  65391. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  65392. * @param {Object} options - 参数。
  65393. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  65394. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  65395. * @param {Object} [options.headers] - 请求头。
  65396. * @extends {SpatialAnalystBase}
  65397. * @example 实例化该类如下例所示:
  65398. * (start code)
  65399. * function datasetGeoRelationAnalystProcess() {
  65400. * var referenceFilter = new FilterParameter({
  65401. * name:"Frame_R@Changchun",
  65402. * attributeFilter:"SmID>0"});
  65403. * var sourceFilter = new FilterParameter({
  65404. * attributeFilter:"SmID>0"});
  65405. * //初始化服务类
  65406. * var datasetGeoRelationService = new GeoRelationAnalystService(
  65407. * "http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst/"),
  65408. * //构建参数类
  65409. * datasetGeoRelationParameters = new GeoRelationAnalystParameters({
  65410. * dataset: "Park@Changchun",
  65411. * startRecord: 0,
  65412. * expectCount: 20,
  65413. * sourceFilter: sourceFilter,
  65414. * referenceFilter: referenceFilter,
  65415. * spatialRelationType: SpatialRelationType.INTERSECT,
  65416. * isBorderInside: true,
  65417. * returnFeature: true,
  65418. * returnGeoRelatedOnly: true
  65419. * });
  65420. * datasetGeoRelationService.events.on({
  65421. * "processCompleted": datasetGeoRelationAnalystCompleted,
  65422. * "processFailed": datasetGeoRelationAnalystFailed});
  65423. * //执行
  65424. * datasetGeoRelationService.processAsync(datasetGeoRelationParameters);
  65425. * }
  65426. * function Completed(datasetGeoRelationAnalystCompleted){//todo};
  65427. * function Error(datasetGeoRelationAnalystFailed){//todo};
  65428. * (end)
  65429. * @usage
  65430. */
  65431. class GeoRelationAnalystService extends SpatialAnalystBase {
  65432. constructor(url, options) {
  65433. super(url, options);
  65434. this.CLASS_NAME = "SuperMap.GeoRelationAnalystService";
  65435. }
  65436. /**
  65437. * @function GeoRelationAnalystService.prototype.destroy
  65438. * @override
  65439. */
  65440. destroy() {
  65441. super.destroy();
  65442. }
  65443. /**
  65444. * @function GeoRelationAnalystService.prototype.processAsync
  65445. * @description 负责将客户端的空间关系分析参数传递到服务端
  65446. * @param {GeoRelationAnalystParameters} parameter - 空间关系分析所需的参数信息。
  65447. */
  65448. processAsync(parameter) {
  65449. if (!(parameter instanceof GeoRelationAnalystParameters)) {
  65450. return;
  65451. }
  65452. var me = this;
  65453. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/georelation');
  65454. var jsonParameters = Util_Util.toJSON(parameter);
  65455. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  65456. me.request({
  65457. method: "POST",
  65458. data: jsonParameters,
  65459. scope: me,
  65460. success: me.serviceProcessCompleted,
  65461. failure: me.serviceProcessFailed
  65462. });
  65463. }
  65464. }
  65465. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystParameters.js
  65466. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65467. * This program are made available under the terms of the Apache License, Version 2.0
  65468. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65469. /**
  65470. * @class InterpolationAnalystParameters
  65471. * @deprecatedclass SuperMap.InterpolationAnalystParameters
  65472. * @category iServer SpatialAnalyst InterpolationAnalyst
  65473. * @classdesc 插值分析参数类。
  65474. * @param {Object} options - 参数。
  65475. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  65476. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  65477. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  65478. * @param {string} [options.zValueFieldName] - 进行插值分析的字段名称,插值分析不支持文本类型的字段。
  65479. * @param {string} [options.dataset] - 待分析的数据集名称。当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
  65480. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
  65481. * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  65482. * @param {number} [options.zValueScale=1] - 进行插值分析值的缩放比率。
  65483. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  65484. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  65485. * @param {PixelFormat} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  65486. * @param {string} [options.InterpolationAnalystType="dataset"] - 插值分析类型("dataset" 或 "geometry")。
  65487. * @usage
  65488. */
  65489. class InterpolationAnalystParameters {
  65490. constructor(options) {
  65491. if (!options) {
  65492. return;
  65493. }
  65494. /**
  65495. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} InterpolationAnalystParameters.prototype.bounds
  65496. * @description 插值分析的范围,用于确定结果栅格数据集的范围。
  65497. * 如果缺省,则默认为原数据集的范围。鉴于此插值方法为内插方法,原数据集的范围内的插值结果才相对有参考价值,
  65498. * 因此建议此参数不大于原数据集范围。
  65499. */
  65500. this.bounds = null;
  65501. /**
  65502. * @member {number} [InterpolationAnalystParameters.prototype.searchRadius=0]
  65503. * @description 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  65504. * 计算某个位置的 Z 值时,会以该位置为圆心,以查找范围的值为半径,落在这个范围内的采样点都将参与运算。
  65505. * 该值需要根据待插值点数据的分布状况和点数据集范围进行设置。
  65506. */
  65507. this.searchRadius = 0;
  65508. /**
  65509. * @member {string} InterpolationAnalystParameters.prototype.zValueFieldName
  65510. * @description 数据集插值分析中,用于指定进行插值分析的目标字段名,插值分析不支持文本类型的字段。
  65511. * 含义为每个插值点在插值过程中的权重,可以将所有点此字段值设置为 1,即所有点在整体插值中权重相同。
  65512. * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
  65513. */
  65514. this.zValueFieldName = null;
  65515. /**
  65516. * @member {number} [InterpolationAnalystParameters.prototype.zValueScale=1]
  65517. * @description 用于进行插值分析值的缩放比率。
  65518. * 参加插值分析的值将乘以该参数值后再进行插值,也就是对进行插值分析的值进行统一的扩大或缩小。
  65519. */
  65520. this.zValueScale = 1;
  65521. /**
  65522. * @member {number} InterpolationAnalystParameters.prototype.resolution
  65523. * @description 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  65524. * 该值不能超过待分析数据集的范围边长。
  65525. * 且该值设置时,应该考虑点数据集范围大小来取值,一般为结果栅格行列值(即结果栅格数据集范围除以分辨率),在 500 以内可以较好地体现密度走势。
  65526. */
  65527. this.resolution = null;
  65528. /**
  65529. * @member {FilterParameter} [InterpolationAnalystParameters.prototype.filterQueryParameter]
  65530. * @description 过滤条件,对分析数据集中的点进行过滤,设置为 null 表示对数据集中的所有点进行分析。
  65531. */
  65532. this.filterQueryParameter = null;
  65533. /**
  65534. * @member {string} InterpolationAnalystParameters.prototype.outputDatasetName
  65535. * @description 插值分析结果数据集的名称。
  65536. */
  65537. this.outputDatasetName = null;
  65538. /**
  65539. * @member {string} InterpolationAnalystParameters.prototype.outputDatasourceName
  65540. * @description 插值分析结果数据源的名称。
  65541. */
  65542. this.outputDatasourceName = null;
  65543. /**
  65544. * @member {PixelFormat} [InterpolationAnalystParameters.prototype.pixelFormat]
  65545. * @description 指定结果栅格数据集存储的像素格式。支持存储的像素格式有 BIT16、BIT32、DOUBLE、SINGLE、UBIT1、UBIT4、UBIT8、UBIT24、UBIT32。
  65546. */
  65547. this.pixelFormat = null;
  65548. /**
  65549. * @member {string} [InterpolationAnalystParameters.prototype.dataset]
  65550. * @description 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。
  65551. * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
  65552. */
  65553. this.dataset = null;
  65554. /**
  65555. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [InterpolationAnalystParameters.prototype.inputPoints]
  65556. * @description 用于做插值分析的离散点(离散点包括Z值)集合。
  65557. * 当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
  65558. * 通过离散点直接进行插值分析不需要指定输入数据集inputDatasourceName,inputDatasetName以及zValueFieldName。
  65559. */
  65560. this.inputPoints = null;
  65561. /**
  65562. * @member {string} [InterpolationAnalystParameters.prototype.InterpolationAnalystType="dataset"]
  65563. * @description 插值分析类型。插值分析包括数据集插值分析和几何插值分析两类,
  65564. * "dataset" 表示对数据集进行插值分析,"geometry" 表示对离散点数组进行插值分析。
  65565. */
  65566. this.InterpolationAnalystType = "dataset";
  65567. /**
  65568. * @member {ClipParameter} InterpolationAnalystParameters.prototype.clipParam
  65569. * @description 对插值分析结果进行裁剪的参数。
  65570. */
  65571. this.clipParam = null;
  65572. Util_Util.extend(this, options);
  65573. this.CLASS_NAME = "SuperMap.InterpolationAnalystParameters";
  65574. }
  65575. /**
  65576. * @function InterpolationAnalystParameters.prototype.destroy
  65577. * @description 释放资源,将引用资源的属性置空。
  65578. */
  65579. destroy() {
  65580. var me = this;
  65581. me.bounds = null;
  65582. me.searchRadius = null;
  65583. me.zValueFieldName = null;
  65584. me.zValueScale = null;
  65585. me.resolution = null;
  65586. me.filterQueryParameter = null;
  65587. me.outputDatasetName = null;
  65588. me.pixelFormat = null;
  65589. }
  65590. /**
  65591. * @function InterpolationAnalystParameters.toObject
  65592. * @param {InterpolationAnalystParameters} interpolationAnalystParameters - 插值分析参数类。
  65593. * @param {InterpolationAnalystParameters} tempObj - 插值分析参数对象。
  65594. * @description 将插值分析参数对象转换成 JSON 对象。
  65595. * @returns JSON 对象。
  65596. */
  65597. static toObject(interpolationAnalystParameters, tempObj) {
  65598. for (var name in interpolationAnalystParameters) {
  65599. if (name === "inputPoints" && interpolationAnalystParameters.InterpolationAnalystType === "geometry") {
  65600. var objs = [];
  65601. for (var i = 0; i < interpolationAnalystParameters.inputPoints.length; i++) {
  65602. var item = interpolationAnalystParameters.inputPoints[i];
  65603. var obj = {
  65604. x: item.x,
  65605. y: item.y,
  65606. z: item.tag
  65607. };
  65608. objs.push(obj);
  65609. }
  65610. tempObj[name] = objs;
  65611. } else {
  65612. tempObj[name] = interpolationAnalystParameters[name];
  65613. }
  65614. }
  65615. }
  65616. }
  65617. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationRBFAnalystParameters.js
  65618. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65619. * This program are made available under the terms of the Apache License, Version 2.0
  65620. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65621. /**
  65622. * @class InterpolationRBFAnalystParameters
  65623. * @deprecatedclass SuperMap.InterpolationRBFAnalystParameters
  65624. * @category iServer SpatialAnalyst InterpolationAnalyst
  65625. * @classdesc 样条插值(径向基函数插值法)分析参数类。
  65626. * @extends {InterpolationAnalystParameters}
  65627. * @param {Object} options - 参数。
  65628. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  65629. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
  65630. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  65631. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  65632. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  65633. * @param {number} [options.smooth=0.1] - 光滑系数,该值表示插值函数曲线与点的逼近程度,值域为0到1。
  65634. * @param {number} [options.tension=40] - 张力系数,用于调整结果栅格数据表面的特性。
  65635. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置参与插值运算的点数。
  65636. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
  65637. * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
  65638. * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
  65639. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  65640. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  65641. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  65642. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  65643. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(InterpolationAnalystType)为 dataset 时。此为必选参数。
  65644. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时。此为必选参数。
  65645. * @example
  65646. * var myInterpolationRBFAnalystParameters = new InterpolationRBFAnalystParameters({
  65647. * dataset:"SamplesP@Interpolation",
  65648. * smooth: 0.1,
  65649. * tension: 40,
  65650. * searchMode: "QUADTREE",
  65651. * maxPointCountForInterpolation: 20,
  65652. * maxPointCountInNode: 5,
  65653. * pixelFormat: "BIT16",
  65654. * zValueFieldName: "AVG_TMP",
  65655. * resolution: 3000,
  65656. * filterQueryParameter: {
  65657. * attributeFilter: ""
  65658. * },
  65659. * outputDatasetName: "myRBF"
  65660. * });
  65661. * @usage
  65662. */
  65663. class InterpolationRBFAnalystParameters extends InterpolationAnalystParameters {
  65664. constructor(options) {
  65665. super(options);
  65666. /**
  65667. * @member {number} [InterpolationRBFAnalystParameters.prototype.smooth=0.1]
  65668. * @description 光滑系数,值域为 0 到 1,常用取值如 0、0.001、0.01、0.1、和 0.5。
  65669. * 该值表示插值函数曲线与点的逼近程度,此数值越大,函数曲线与点的偏差越大,反之越小。
  65670. */
  65671. this.smooth = 0.1;
  65672. /**
  65673. * @member {number} [InterpolationRBFAnalystParameters.prototype.tension=40]
  65674. * @description 张力系数,常用取值如 0、1、5 和 10。
  65675. * 用于调整结果栅格数据表面的特性,张力越大,插值时每个点对计算结果影响越小,反之越大。
  65676. */
  65677. this.tension = 40;
  65678. /**
  65679. * @member {SearchMode} InterpolationRBFAnalystParameters.prototype.searchMode
  65680. * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。必设参数。
  65681. * 具体如下:
  65682. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
  65683. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
  65684. * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
  65685. */
  65686. this.searchMode = null;
  65687. /**
  65688. * @member {number} [InterpolationRBFAnalystParameters.prototype.expectedCount=12]
  65689. * @description 【固定点数查找】方式下,设置待查找的点数,即参与插值运算的点数。
  65690. */
  65691. this.expectedCount = 12;
  65692. /**
  65693. * @member {number} [InterpolationRBFAnalystParameters.prototype.maxPointCountForInterpolation=200]
  65694. * @description 【块查找】方式下,最多参与插值的点数。
  65695. */
  65696. this.maxPointCountForInterpolation = 200;
  65697. /**
  65698. * @member {number} [InterpolationRBFAnalystParameters.prototype.maxPointCountInNode=50]
  65699. * @description 【块查找】方式下,单个块内最多参与运算点数。
  65700. */
  65701. this.maxPointCountInNode = 50;
  65702. if (options) {
  65703. Util_Util.extend(this, options);
  65704. }
  65705. this.CLASS_NAME = "SuperMap.InterpolationRBFAnalystParameters";
  65706. }
  65707. /**
  65708. * @function InterpolationRBFAnalystParameters.prototype.destroy
  65709. * @description 释放资源,将引用资源的属性置空。
  65710. */
  65711. destroy() {
  65712. super.destroy();
  65713. var me = this;
  65714. me.smooth = null;
  65715. me.tension = null;
  65716. me.searchMode = null;
  65717. me.expectedCount = null;
  65718. me.maxPointCountForInterpolation = null;
  65719. me.maxPointCountInNode = null;
  65720. }
  65721. /**
  65722. * @function InterpolationRBFAnalystParameters.toObject
  65723. * @param {InterpolationRBFAnalystParameters} datasetInterpolationRBFAnalystParameters - 样条插值(径向基函数插值法)分析参数类。
  65724. * @param {InterpolationRBFAnalystParameters} tempObj - 样条插值(径向基函数插值法)分析参数对象。
  65725. * @description 将样条插值(径向基函数插值法)分析参数对象转换为 JSON 对象。
  65726. * @returns JSON 对象。
  65727. */
  65728. static toObject(datasetInterpolationRBFAnalystParameters, tempObj) {
  65729. for (var name in datasetInterpolationRBFAnalystParameters) {
  65730. tempObj[name] = datasetInterpolationRBFAnalystParameters[name];
  65731. }
  65732. }
  65733. }
  65734. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationDensityAnalystParameters.js
  65735. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65736. * This program are made available under the terms of the Apache License, Version 2.0
  65737. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65738. /**
  65739. * @class InterpolationDensityAnalystParameters
  65740. * @deprecatedclass SuperMap.InterpolationDensityAnalystParameters
  65741. * @category iServer SpatialAnalyst InterpolationAnalyst
  65742. * @classdesc 点密度插值分析参数类。
  65743. * @param {Object} options - 参数。
  65744. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  65745. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  65746. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  65747. * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  65748. * @param {string} [options.zValueFieldName] - 进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时。此为必选参数。
  65749. * @param {number} [options.zValueScale=1] - 进行插值分析值的缩放比率。
  65750. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  65751. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  65752. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  65753. * @param {string} [options.dataset] - 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时,此为必选参数。
  65754. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 geometry 时,此为必选参数。
  65755. * @extends {InterpolationAnalystParameters}
  65756. * @example
  65757. * var myInterpolationDensityAnalystParameters = new InterpolationDensityAnalystParameters({
  65758. * dataset: "SamplesP@Interpolation",
  65759. * searchRadius: "100000",
  65760. * pixelFormat: "BIT16",
  65761. * zValueFieldName: "AVG_TMP",
  65762. * resolution: 3000,
  65763. * filterQueryParameter: {
  65764. * attributeFilter: ""
  65765. * },
  65766. * outputDatasetName: "myDensity"
  65767. * });
  65768. * @usage
  65769. */
  65770. class InterpolationDensityAnalystParameters extends InterpolationAnalystParameters {
  65771. constructor(options) {
  65772. super(options);
  65773. if (options) {
  65774. Util_Util.extend(this, options);
  65775. }
  65776. this.CLASS_NAME = "SuperMap.InterpolationDensityAnalystParameters";
  65777. }
  65778. /**
  65779. * @function InterpolationDensityAnalystParameters.prototype.destroy
  65780. * @description 释放资源,将引用资源的属性置空。
  65781. */
  65782. destroy() {
  65783. super.destroy();
  65784. }
  65785. }
  65786. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationIDWAnalystParameters.js
  65787. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65788. * This program are made available under the terms of the Apache License, Version 2.0
  65789. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65790. /**
  65791. * @class InterpolationIDWAnalystParameters
  65792. * @deprecatedclass SuperMap.InterpolationIDWAnalystParameters
  65793. * @category iServer SpatialAnalyst InterpolationAnalyst
  65794. * @classdesc 反距离加权插值(IDW)分析参数类。
  65795. * @param {Object} options - 参数。
  65796. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  65797. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
  65798. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  65799. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  65800. * @param {string} [options.zValueFieldName] - 进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  65801. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数,即参与插值运算的点数。
  65802. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置查找半径,即参与运算点的查找范围,与点数据集单位相同。
  65803. * @param {number} [options.power=2] - 距离权重计算的幂次。
  65804. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  65805. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  65806. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  65807. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  65808. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  65809. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(SuperMap.InterpolationAnalystType)为 geometry 时,此为必选参数。
  65810. * @extends {InterpolationAnalystParameters}
  65811. * @example 例如:
  65812. * var myInterpolationIDWAnalystParameters = new InterpolationIDWAnalystParameters({
  65813. * dataset:"SamplesP@Interpolation",
  65814. * power: 2,
  65815. * searchMode: "KDTREE_FIXED_COUNT",
  65816. * expectedCount: 12,
  65817. * pixelFormat: "BIT16",
  65818. * zValueFieldName: "AVG_TMP",
  65819. * resolution: 3000,
  65820. * filterQueryParameter: {
  65821. * attributeFilter: ""
  65822. * },
  65823. * outputDatasetName: "myIDW"
  65824. * });
  65825. * @usage
  65826. */
  65827. class InterpolationIDWAnalystParameters extends InterpolationAnalystParameters {
  65828. constructor(options) {
  65829. super(options);
  65830. /**
  65831. * @member {number} [InterpolationIDWAnalystParameters.prototype.power=2]
  65832. * @description 距离权重计算的幂次。
  65833. * 该值决定了权值下降的速度,幂次越大,随距离的增大权值下降越快,距离预测点越远的点的权值也越小。
  65834. * 理论上,参数值必须大于0,但是0.5到3之间时运算结果更合理,因此推荐值为0.5~3。
  65835. */
  65836. this.power = 2;
  65837. /**
  65838. * @member {SearchMode} InterpolationIDWAnalystParameters.prototype.searchMode
  65839. * @description 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
  65840. * 具体如下:
  65841. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
  65842. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
  65843. */
  65844. this.searchMode = null;
  65845. /**
  65846. * @member {number} [InterpolationIDWAnalystParameters.prototype.expectedCount=12]
  65847. * @description 【固定点数查找】方式下,设置待查找的点数,即参与插值运算的点数。
  65848. */
  65849. this.expectedCount = 12;
  65850. if (options) {
  65851. Util_Util.extend(this, options);
  65852. }
  65853. this.CLASS_NAME = "SuperMap.InterpolationIDWAnalystParameters";
  65854. }
  65855. /**
  65856. * @function InterpolationIDWAnalystParameters.prototype.destroy
  65857. * @description 释放资源,将引用资源的属性置空。
  65858. */
  65859. destroy() {
  65860. super.destroy();
  65861. var me = this;
  65862. me.power = null;
  65863. me.searchMode = null;
  65864. me.expectedCount = null;
  65865. }
  65866. }
  65867. ;// CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystParameters.js
  65868. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65869. * This program are made available under the terms of the Apache License, Version 2.0
  65870. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65871. /**
  65872. * @class ThiessenAnalystParameters
  65873. * @deprecatedclass SuperMap.ThiessenAnalystParameters
  65874. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  65875. * @classdesc 泰森多边形分析参数基类。
  65876. * @param {Object} options - 可选参数。
  65877. * @param {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [options.clipRegion] - 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
  65878. * @param {boolean} [options.createResultDataset=false] - 是否返回结果数据集。
  65879. * @param {string} [options.resultDatasetName] - 指定结果数据集名称。
  65880. * @param {string} [options.resultDatasourceName] - 指定结果数据集所在数据源,默认为当前数据源。
  65881. * @param {boolean} [options.returnResultRegion=true] - 是否返回分析得到的多边形面数组。
  65882. * @usage
  65883. */
  65884. class ThiessenAnalystParameters {
  65885. constructor(options) {
  65886. if (!options) {
  65887. return;
  65888. }
  65889. /**
  65890. * @member {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [ThiessenAnalystParameters.prototype.clipRegion]
  65891. * @description 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
  65892. */
  65893. this.clipRegion = null;
  65894. /**
  65895. * @member {boolean} [ThiessenAnalystParameters.prototype.createResultDataset=false]
  65896. * @description 是否返回结果数据集。如果为 true,则必须设置属性 resultDatasetName 和 resultDatasourceName。
  65897. */
  65898. this.createResultDataset = false;
  65899. /**
  65900. * @member {string} ThiessenAnalystParameters.prototype.resultDatasetName
  65901. * @description 指定结果数据集名称。
  65902. */
  65903. this.resultDatasetName = null;
  65904. /**
  65905. * @member {string} ThiessenAnalystParameters.prototype.resultDatasourceName
  65906. * @description 指定结果数据集所在数据源。
  65907. */
  65908. this.resultDatasourceName = null;
  65909. /**
  65910. * @member {boolean} ThiessenAnalystParameters.prototype.returnResultRegion
  65911. * @description 是否返回分析得到的多边形面数组。
  65912. */
  65913. this.returnResultRegion = true;
  65914. Util_Util.extend(this, options);
  65915. this.CLASS_NAME = "SuperMap.ThiessenAnalystParameters";
  65916. }
  65917. /**
  65918. * @function ThiessenAnalystParameters.prototype.destroy
  65919. * @description 释放资源,将引用资源的属性置空。
  65920. */
  65921. destroy() {
  65922. var me = this;
  65923. if (me.clipRegion) {
  65924. me.clipRegion.destroy();
  65925. me.clipRegion = null;
  65926. }
  65927. me.createResultDataset = null;
  65928. me.resultDatasetName = null;
  65929. me.resultDatasourceName = null;
  65930. me.returnResultRegion = null;
  65931. }
  65932. }
  65933. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationKrigingAnalystParameters.js
  65934. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65935. * This program are made available under the terms of the Apache License, Version 2.0
  65936. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65937. /**
  65938. * @class InterpolationKrigingAnalystParameters
  65939. * @deprecatedclass SuperMap.InterpolationKrigingAnalystParameters
  65940. * @category iServer SpatialAnalyst InterpolationAnalyst
  65941. * @classdesc 克吕金插值分析参数类。通过该类可以设置克吕金插值分析所需的参数。
  65942. * 克吕金(Kriging)法为地统计学上一种空间数据内插处理方法,主要的目的是利用各数据点间变异数(variance)的大小来推求某一未知点与各已知点的权重关系,
  65943. * 再由各数据点的值和其与未知点的权重关系推求未知点的值。Kriging 法最大的特色不仅是提供一个最小估计误差的预测值,并且可明确地指出误差值的大小。
  65944. * 一般而言,许多地质参数,如地形面,本身即具有连续性,故在一段距离内的任两点必有空间上的关系。反之,在一不规则面上的两点若相距甚远,
  65945. * 则在统计意义上可视为互为独立 (stastically indepedent)。这种随距离而改变的空间上连续性,可用半变异图 (semivariogram) 来表现。
  65946. * 因此,若想由已知的散乱点来推求某一未知点的值,则可利用半变异图推求各已知点与未知点的空间关系,即以下四个参数:<br>
  65947. * 1.块金值(nugget):当采样点间距为0时,理论上半变异函数值为0,但时间上两采样点非常接近时半变异函数值并不为0,即产生了块金效应,
  65948. * 对应的半变异函数值为块金值。块金值可能由于测量误差或者空间变异产生。<br>
  65949. * 2.基台值(sill):随着采样点间距的不断增大,半变异函数的值趋向一个稳定的常数,该常数成为基台值。到达基台值后,半变异函数的值不再随采样点间距而改变,
  65950. * 即大于此间距的采样点不再具有空间相关性。<br>
  65951. * 3.偏基台值:基台值与块金值的差值。<br>
  65952. * 4.自相关阈值(range):也称变程,是半变异函数值达到基台值时,采样点的间距。超过自相关阈值的采样点不再具有空间相关性,将不对预测结果产生影响。<br>
  65953. * 然后,由此空间参数推求半变异数,由各数据点间的半变异数可推求未知点与已知点间的权重关系,进而推求出未知点的值。
  65954. * 克吕金法的优点是以空间统计学作为其坚实的理论基础,物理含义明确;不但能估计测定参数的空间变异分布,而且还可以估算参数的方差分布。克吕金法的缺点是计算步骤较烦琐,
  65955. * 计算量大,且变异函数有时需要根据经验人为选定。
  65956. *
  65957. * 由上述可知,半变异函数是克吕金插值的关键,因此选择合适的半变异函数模型非常重要,SuperMap 提供了以下三种半变异函数模型:<br>
  65958. * 1.指数型(EXPONENTIAL):适用于空间相关关系随样本间距的增加呈指数递减的情况,其空间自相关关系在样本间距的无穷远处完全消失。<br>
  65959. * 2.球型(SPHERICAL):适用于空间自相关关系随样本间距的增加而逐渐减少,直到超出一定的距离时空间自相关关系消失的情况。<br>
  65960. * 3.高斯型(GAUSSIAN):适用于半变异函数值渐进地逼近基台值的情况。<br>
  65961. *
  65962. * 半变异函数中,有一个关键参数即插值的字段值的期望(平均值),由于对于此参数的不同处理方法而衍生出了不同的 Kriging 方法。SuperMap的插值功能基于以下三种常用 Kriging 算法:<br>
  65963. * 1.简单克吕金(Simple Kriging):该方法假定用于插值的字段值的期望(平均值)为已知的某一常数。<br>
  65964. * 2.普通克吕金(Kriging):该方法假定用于插值的字段值的期望(平均值)未知且恒定。它利用一定的数学函数,通过对给定的空间点进行拟合来估算单元格的值,
  65965. * 生成格网数据集。它不仅可以生成一个表面,还可以给出预测结果的精度或者确定性的度量。因此,此方法计算精度较高,常用于地学领域。<br>
  65966. * 3.泛克吕金(Universal Kriging):该方法假定用于插值的字段值的期望(平均值)是未知的变量。在样点数据中存在某种主导趋势且该趋势可以通过某一个确定
  65967. * 的函数或者多项式进行拟合的情况下,适用泛克吕金插值法。<br>
  65968. * @param {Object} options - 参数。
  65969. * @param {string} options.type - 克吕金插值的类型。
  65970. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  65971. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
  65972. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  65973. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  65974. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时,此为必选参数。
  65975. * @param {number} [options.mean] - 【简单克吕金】类型下,插值字段的平均值。
  65976. * @param {number} [options.angle=0] - 克吕金算法中旋转角度值。
  65977. * @param {number} [options.nugget=0] - 克吕金算法中块金效应值。
  65978. * @param {number} [options.range=0] - 克吕金算法中自相关阈值,单位与原数据集单位相同。
  65979. * @param {number} [options.sill=0] - 克吕金算法中基台值。
  65980. * @param {string} [options.variogramMode="SPHERICAL"] - 克吕金插值时的半变函数类型。
  65981. * @param {string} [options.exponent='exp1'] - 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数,可选值为 exp1、exp2。
  65982. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数;【定长查找】方式下,设置查找的最小点数。
  65983. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
  65984. * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
  65985. * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
  65986. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  65987. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  65988. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  65989. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  65990. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如 ”数据集名称@数据源别名” 形式来表示。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时。
  65991. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 geometry 时。
  65992. * @extends {InterpolationAnalystParameters}
  65993. * @example 例如:
  65994. * var myInterpolationKrigingAnalystParameters = new InterpolationKrigingAnalystParameters({
  65995. * dataset:"SamplesP@Interpolation",
  65996. * type: "KRIGING",
  65997. * angle: 0,
  65998. * mean: 5,
  65999. * nugget: 30,
  66000. * range: 50,
  66001. * sill: 300,
  66002. * variogramMode: "EXPONENTIAL",
  66003. * searchMode: "QUADTREE",
  66004. * maxPointCountForInterpolation: 20,
  66005. * maxPointCountInNode: 5,
  66006. * pixelFormat: "BIT16",
  66007. * zValueFieldName: "AVG_TMP",
  66008. * resolution: 30000,
  66009. * filterQueryParameter: {
  66010. * attributeFilter: ""
  66011. * },
  66012. * outputDatasetName: "myKriging"
  66013. * });
  66014. * @usage
  66015. */
  66016. class InterpolationKrigingAnalystParameters extends InterpolationAnalystParameters {
  66017. constructor(options) {
  66018. super(options);
  66019. /**
  66020. * @member {InterpolationAlgorithmType} InterpolationKrigingAnalystParameters.prototype.type
  66021. * @description 克吕金插值的类型。
  66022. * 具体如下:<br>
  66023. * {KRIGING} 普通克吕金插值法。
  66024. * {SimpleKriging} 简单克吕金插值法。
  66025. * {UniversalKriging} 泛克吕金插值法。
  66026. */
  66027. this.type = null;
  66028. /**
  66029. * @member {number} InterpolationKrigingAnalystParameters.prototype.mean
  66030. * @description 【简单克吕金】方式下,插值字段的平均值。
  66031. * 即采样点插值字段值总和除以采样点数目。
  66032. */
  66033. this.mean = null;
  66034. /**
  66035. * @member {number} [InterpolationKrigingAnalystParameters.prototype.angle=0]
  66036. * @description 克吕金算法中旋转角度值。
  66037. * 此角度值指示了每个查找邻域相对于水平方向逆时针旋转的角度。
  66038. */
  66039. this.angle = 0;
  66040. /**
  66041. * @member {number} [InterpolationKrigingAnalystParameters.prototype.nugget=0]
  66042. * @description 克吕金算法中块金效应值。
  66043. */
  66044. this.nugget = 0;
  66045. /**
  66046. * @member {number} [InterpolationKrigingAnalystParameters.prototype.range=0]
  66047. * @description 克吕金算法中自相关阈值,单位与原数据集单位相同。
  66048. */
  66049. this.range = 0;
  66050. /**
  66051. * @member {number} [InterpolationKrigingAnalystParameters.prototype.sill=0]
  66052. * @description 克吕金算法中基台值。
  66053. */
  66054. this.sill = 0;
  66055. /**
  66056. * @member {VariogramMode} [InterpolationKrigingAnalystParameters.prototype.variogramMode=VariogramMode.SPHERICAL]
  66057. * @description 克吕金插值时的半变函数类型。
  66058. * 用户所选择的半变函数类型会影响未知点的预测,特别是曲线在原点处的不同形状有重要意义。
  66059. * 曲线在原点处越陡,则较近领域对该预测值的影响就越大,因此输出表面就会越不光滑。
  66060. */
  66061. this.variogramMode = VariogramMode.SPHERICAL;
  66062. /**
  66063. * @member {Exponent} [InterpolationKrigingAnalystParameters.prototype.exponent=Exponent.EXP1]
  66064. * @description 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数。
  66065. */
  66066. this.exponent = Exponent.EXP1;
  66067. /**
  66068. * @member {SearchMode} InterpolationKrigingAnalystParameters.prototype.searchMode
  66069. * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。此为必选参数。
  66070. * 简单克吕金和泛克吕金不支持块查找。
  66071. * 具体如下:<br>
  66072. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。<br>
  66073. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。<br>
  66074. * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
  66075. */
  66076. this.searchMode = null;
  66077. /**
  66078. * @member {number} [InterpolationKrigingAnalystParameters.prototype.expectedCount=12]
  66079. * @description 【固定点数查找】方式下,设置待查找的点数,即参与插值运算的点数,默认值为12。
  66080. * 【定长查找】方式下,设置查找的最小点数,默认值为12。
  66081. */
  66082. this.expectedCount = 12;
  66083. /**
  66084. * @member {number} [InterpolationKrigingAnalystParameters.prototype.maxPointCountForInterpolation=200]
  66085. * @description 【块查找】方式下,最多参与插值的点数。
  66086. * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
  66087. */
  66088. this.maxPointCountForInterpolation = 200;
  66089. /**
  66090. * @member {number} [InterpolationKrigingAnalystParameters.prototype.maxPointCountInNode=50]
  66091. * @description 【块查找】方式下,设置单个块内最多参与运算点数。
  66092. * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
  66093. */
  66094. this.maxPointCountInNode = 50;
  66095. if (options) {
  66096. Util_Util.extend(this, options);
  66097. }
  66098. this.CLASS_NAME = "SuperMap.InterpolationKrigingAnalystParameters";
  66099. }
  66100. /**
  66101. * @function InterpolationKrigingAnalystParameters.prototype.destroy
  66102. * @description 释放资源,将引用资源的属性置空。
  66103. */
  66104. destroy() {
  66105. super.destroy();
  66106. var me = this;
  66107. me.type = null;
  66108. me.mean = null;
  66109. me.angle = null;
  66110. me.nugget = null;
  66111. me.range = null;
  66112. me.sill = null;
  66113. me.variogramMode = null;
  66114. me.exponent = null;
  66115. me.searchMode = null;
  66116. me.expectedCount = null;
  66117. me.maxPointCountForInterpolation = null;
  66118. me.maxPointCountInNode = null;
  66119. }
  66120. }
  66121. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystService.js
  66122. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66123. * This program are made available under the terms of the Apache License, Version 2.0
  66124. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66125. /**
  66126. * @class InterpolationAnalystService
  66127. * @deprecatedclass SuperMap.InterpolationAnalystService
  66128. * @category iServer SpatialAnalyst InterpolationAnalyst
  66129. * @classdesc 插值分析服务类。
  66130. * 插值分析可以将有限的采样点数据,通过插值算法对采样点周围的数值情况进行预测,可以掌握研究区域内数据的总体分布状况,从而使采样的离散点不仅仅反映其所在位置的数值情况,
  66131. * 还可以反映区域的数值分布。目前SuperMap iServer的插值功能提供从点数据集插值得到栅格数据集的功能,支持以下常用的内插方法,
  66132. * 包括:反距离加权插值、克吕金(Kriging)插值法、样条(径向基函数,Radial Basis Function)插值、点密度插值。
  66133. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  66134. * @param {Object} options - 参数。
  66135. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  66136. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66137. * @param {Object} [options.headers] - 请求头。
  66138. * @extends {SpatialAnalystBase}
  66139. * @example 例如:
  66140. * (start code)
  66141. * var myTInterpolationAnalystService = new InterpolationAnalystService(url);
  66142. * myTInterpolationAnalystService.events.on({
  66143. * "processCompleted": processCompleted,
  66144. * "processFailed": processFailed
  66145. * }
  66146. * );
  66147. * (end)
  66148. * @usage
  66149. */
  66150. class InterpolationAnalystService extends SpatialAnalystBase {
  66151. constructor(url, options) {
  66152. super(url, options);
  66153. /**
  66154. * @member {string} InterpolationAnalystService.prototype.mode
  66155. * @description 插值分析类型。
  66156. */
  66157. this.mode = null;
  66158. if (options) {
  66159. Util_Util.extend(this, options);
  66160. }
  66161. }
  66162. /**
  66163. * @function InterpolationAnalystService.prototype.destroy
  66164. * @description 释放资源,将引用资源的属性置空。
  66165. */
  66166. destroy() {
  66167. super.destroy();
  66168. this.mode = null;
  66169. this.CLASS_NAME = "SuperMap.InterpolationAnalystService";
  66170. }
  66171. /**
  66172. * @function InterpolationAnalystService.prototype.processAsync
  66173. * @description 负责将客户端的查询参数传递到服务端。
  66174. * @param {InterpolationDensityAnalystParameters|InterpolationIDWAnalystParameters|InterpolationRBFAnalystParameters|InterpolationKrigingAnalystParameters} parameter - 插值分析参数类。
  66175. */
  66176. processAsync(parameter) {
  66177. var parameterObject = {};
  66178. var me = this;
  66179. if (parameter instanceof InterpolationDensityAnalystParameters) {
  66180. me.mode = 'Density';
  66181. if (parameter.InterpolationAnalystType === 'geometry') {
  66182. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/density');
  66183. } else {
  66184. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/density');
  66185. }
  66186. } else if (parameter instanceof InterpolationIDWAnalystParameters) {
  66187. me.mode = 'IDW';
  66188. if (parameter.InterpolationAnalystType === 'geometry') {
  66189. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/idw');
  66190. } else {
  66191. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/idw');
  66192. }
  66193. } else if (parameter instanceof InterpolationRBFAnalystParameters) {
  66194. me.mode = 'RBF';
  66195. if (parameter.InterpolationAnalystType === 'geometry') {
  66196. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/rbf');
  66197. } else {
  66198. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/rbf');
  66199. }
  66200. } else if (parameter instanceof InterpolationKrigingAnalystParameters) {
  66201. me.mode = 'Kriging';
  66202. if (parameter.InterpolationAnalystType === 'geometry') {
  66203. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/kriging');
  66204. } else {
  66205. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/kriging');
  66206. }
  66207. }
  66208. InterpolationAnalystParameters.toObject(parameter, parameterObject);
  66209. var jsonParameters = Util_Util.toJSON(parameterObject);
  66210. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  66211. me.request({
  66212. method: "POST",
  66213. data: jsonParameters,
  66214. scope: me,
  66215. success: me.serviceProcessCompleted,
  66216. failure: me.serviceProcessFailed
  66217. });
  66218. }
  66219. }
  66220. ;// CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisParameters.js
  66221. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66222. * This program are made available under the terms of the Apache License, Version 2.0
  66223. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66224. /**
  66225. * @class MathExpressionAnalysisParameters
  66226. * @deprecatedclass SuperMap.MathExpressionAnalysisParameters
  66227. * @category iServer SpatialAnalyst GridMathAnalyst
  66228. * @classdesc 栅格代数运算参数类。
  66229. * @param {Object} options - 参数。
  66230. * @param {string} options.dataset - 指定栅格代数运算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:BaseMap_P@Jingjin。
  66231. * @param {string} options.resultGridName - 指定结果数据集名称。
  66232. * @param {string} options.expression - 指定的栅格运算表达式。如:[DatasourceAlias1.Raster1]*2-10。
  66233. * @param {string} options.targetDatasource - 指定存储结果数据集的数据源。
  66234. * @param {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [options.extractRegion] - 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
  66235. * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
  66236. * @param {boolean} [options.isZip=false] - 是否对结果数据集进行压缩处理。
  66237. * @param {boolean} [options.ignoreNoValue=false] - 是否忽略无值栅格数据。true 表示忽略无值数据,即无值栅格不参与运算。
  66238. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  66239. * @usage
  66240. */
  66241. class MathExpressionAnalysisParameters {
  66242. constructor(options) {
  66243. if (!options) {
  66244. return;
  66245. }
  66246. /**
  66247. * @member {string} MathExpressionAnalysisParameters.prototype.dataset
  66248. * @description 要用来做栅格代数运算数据源中数据集的名称。
  66249. * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  66250. *
  66251. */
  66252. this.dataset = null;
  66253. /**
  66254. * @member {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [MathExpressionAnalysisParameters.prototype.extractRegion]
  66255. * @description 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
  66256. * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
  66257. */
  66258. this.extractRegion = null;
  66259. /**
  66260. * @member {string} MathExpressionAnalysisParameters.prototype.expression
  66261. * @description 指定的栅格运算表达式。如:"[DatasourceAlias1.Raster1]*2-10"。
  66262. */
  66263. this.expression = null;
  66264. /**
  66265. * @member {boolean} [MathExpressionAnalysisParameters.prototype.isZip=false]
  66266. * @description 是否对结果数据集进行压缩处理。
  66267. */
  66268. this.isZip = false;
  66269. /**
  66270. * @member {boolean} [MathExpressionAnalysisParameters.prototype.ignoreNoValue=false]
  66271. * @description 是否忽略无值栅格数据。
  66272. */
  66273. this.ignoreNoValue = false;
  66274. /**
  66275. * @member {string} MathExpressionAnalysisParameters.prototype.targetDatasource
  66276. * @description 指定存储结果数据集的数据源。
  66277. */
  66278. this.targetDatasource = null;
  66279. /**
  66280. * @member {string} MathExpressionAnalysisParameters.prototype.resultGridName
  66281. * @description 指定结果数据集名称。
  66282. */
  66283. this.resultGridName = null;
  66284. /**
  66285. * @member {boolean} [MathExpressionAnalysisParameters.prototype.deleteExistResultDataset=false]
  66286. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  66287. */
  66288. this.deleteExistResultDataset = false;
  66289. Util_Util.extend(this, options);
  66290. this.CLASS_NAME = "SuperMap.MathExpressionAnalysisParameters"
  66291. }
  66292. /**
  66293. * @function MathExpressionAnalysisParameters.prototype.destroy
  66294. * @description 释放资源,将引用资源的属性置空。
  66295. */
  66296. destroy() {
  66297. var me = this;
  66298. me.dataset = null;
  66299. me.bounds = null;
  66300. me.expression = null;
  66301. me.isZip = true;
  66302. me.ignoreNoValue = true;
  66303. me.targetDatasource = null;
  66304. me.resultGridName = null;
  66305. me.deleteExistResultDataset = null;
  66306. }
  66307. /**
  66308. * @function MathExpressionAnalysisParameters.toObject
  66309. * @param {Object} mathExpressionAnalysisParameters - 栅格代数运算参数。
  66310. * @param {Object} tempObj - 目标对象。
  66311. * @description 生成栅格代数运算对象。
  66312. */
  66313. static toObject(mathExpressionAnalysisParameters, tempObj) {
  66314. for (var name in mathExpressionAnalysisParameters) {
  66315. if (name !== "dataset") {
  66316. tempObj[name] = mathExpressionAnalysisParameters[name];
  66317. }
  66318. if (name === "extractRegion") {
  66319. if (mathExpressionAnalysisParameters[name]) {
  66320. var bs = mathExpressionAnalysisParameters[name].components[0].components;
  66321. var region = {},
  66322. points = [],
  66323. type = "REGION";
  66324. var len = bs.length;
  66325. for (var i = 0; i < len - 1; i++) {
  66326. var poi = {};
  66327. poi["x"] = bs[i].x;
  66328. poi["y"] = bs[i].y;
  66329. points.push(poi);
  66330. }
  66331. region["points"] = points;
  66332. region["type"] = type;
  66333. tempObj[name] = region;
  66334. }
  66335. }
  66336. }
  66337. }
  66338. }
  66339. ;// CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisService.js
  66340. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66341. * This program are made available under the terms of the Apache License, Version 2.0
  66342. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66343. /**
  66344. * @class MathExpressionAnalysisService
  66345. * @deprecatedclass SuperMap.MathExpressionAnalysisService
  66346. * @category iServer SpatialAnalyst GridMathAnalyst
  66347. * @classdesc 栅格代数运算服务类。
  66348. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  66349. * @param {Object} options - 参数。
  66350. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  66351. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66352. * @param {Object} [options.headers] - 请求头。
  66353. * @extends {SpatialAnalystBase}
  66354. * @example 例如:
  66355. * (start code)
  66356. * var myMathExpressionAnalysisService = new MathExpressionAnalysisService(url);
  66357. * myMathExpressionAnalysisService.on({
  66358. * "processCompleted": processCompleted,
  66359. * "processFailed": processFailed
  66360. * }
  66361. * );
  66362. * (end)
  66363. * @usage
  66364. */
  66365. class MathExpressionAnalysisService extends SpatialAnalystBase {
  66366. constructor(url, options) {
  66367. super(url, options);
  66368. this.CLASS_NAME = "SuperMap.MathExpressionAnalysisService";
  66369. }
  66370. /**
  66371. * @override
  66372. */
  66373. destroy() {
  66374. super.destroy();
  66375. }
  66376. /**
  66377. * @function MathExpressionAnalysisService.prototype.processAsync
  66378. * @description 负责将客户端的查询参数传递到服务端。
  66379. * @param {MathExpressionAnalysisParameters} parameter - 栅格代数运算参数类。
  66380. */
  66381. processAsync(parameter) {
  66382. var me = this;
  66383. var parameterObject = {};
  66384. if (parameter instanceof MathExpressionAnalysisParameters) {
  66385. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/mathanalyst');
  66386. }
  66387. MathExpressionAnalysisParameters.toObject(parameter, parameterObject);
  66388. var jsonParameters = Util_Util.toJSON(parameterObject);
  66389. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  66390. me.request({
  66391. method: "POST",
  66392. data: jsonParameters,
  66393. scope: me,
  66394. success: me.serviceProcessCompleted,
  66395. failure: me.serviceProcessFailed
  66396. });
  66397. }
  66398. }
  66399. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystParameters.js
  66400. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66401. * This program are made available under the terms of the Apache License, Version 2.0
  66402. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66403. /**
  66404. * @class OverlayAnalystParameters
  66405. * @deprecatedclass SuperMap.OverlayAnalystParameters
  66406. * @category iServer SpatialAnalyst OverlayAnalyst
  66407. * @classdesc 叠加分析参数基类。数据集叠加分析参数和几何对象叠加分析参数均继承此基类。
  66408. * @param {Object} options - 参数。
  66409. * @usage
  66410. */
  66411. class OverlayAnalystParameters {
  66412. constructor(options) {
  66413. /**
  66414. * @member {OverlayOperationType} [OverlayAnalystParameters.prototype.operation=OverlayOperationType.UNION]
  66415. * @description 指定叠加分析操作类型。
  66416. */
  66417. this.operation = OverlayOperationType.UNION;
  66418. if (options) {
  66419. Util_Util.extend(this, options);
  66420. }
  66421. this.CLASS_NAME = "SuperMap.OverlayAnalystParameters";
  66422. }
  66423. /**
  66424. * @function OverlayAnalystParameters.prototype.destroy
  66425. * @description 释放资源,将引用资源的属性置空。
  66426. */
  66427. destroy() {
  66428. var me = this;
  66429. me.operation = null;
  66430. }
  66431. }
  66432. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetOverlayAnalystParameters.js
  66433. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66434. * This program are made available under the terms of the Apache License, Version 2.0
  66435. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66436. /**
  66437. * @class DatasetOverlayAnalystParameters
  66438. * @deprecatedclass SuperMap.DatasetOverlayAnalystParameters
  66439. * @category iServer SpatialAnalyst OverlayAnalyst
  66440. * @classdesc 数据集叠加分析参数类。
  66441. * @param {Object} options - 参数。
  66442. * @param {string} options.operateDataset -数据集名称。
  66443. * @param {string} options.sourceDataset - 源数据集名称。
  66444. * @param {Array.<string>} [options.operateDatasetFields] - 叠加分析中操作数据集保留在结果数据集中的字段名列表。
  66445. * @param {FilterParameter} [options.operateDatasetFilter] - 设置操作数据集中空间对象过滤条件。
  66446. * @param {Array.<GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject>} [options.operateRegions] - 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
  66447. * @param {Array.<string>} [options.sourceDatasetFields] - 叠加分析中源数据集保留在结果数据集中的字段名列表。
  66448. * @param {FilterParameter} [options.sourceDatasetFilter] - 设置源数据集中空间对象过滤条件。
  66449. * @param {number} [options.tolerance=0] - 容限。
  66450. * @param {OverlayOperationType} options.operation - 叠加操作枚举值。
  66451. * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
  66452. * @extends {GetFeaturesParametersBase}
  66453. * @usage
  66454. */
  66455. class DatasetOverlayAnalystParameters extends OverlayAnalystParameters {
  66456. constructor(options) {
  66457. super(options);
  66458. /**
  66459. * @member {string} DatasetOverlayAnalystParameters.prototype.operateDataset
  66460. * @description 叠加分析中操作数据集的名称。
  66461. */
  66462. this.operateDataset = null;
  66463. /**
  66464. * @member {Array.<string>} [DatasetOverlayAnalystParameters.prototype.operateDatasetFields]
  66465. * @description 叠加分析中操作数据集保留在结果数据集中的字段名列表。
  66466. */
  66467. this.operateDatasetFields = [];
  66468. /**
  66469. * @member {FilterParameter} DatasetOverlayAnalystParameters.prototype.operateDatasetFilter
  66470. * @description 设置操作数据集中空间对象过滤条件。
  66471. */
  66472. this.operateDatasetFilter = new FilterParameter();
  66473. /**
  66474. * @member {Array.<GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject>} [DatasetOverlayAnalystParameters.prototype.operateRegions]
  66475. * @description 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
  66476. */
  66477. this.operateRegions = [];
  66478. /**
  66479. * @member {string} DatasetOverlayAnalystParameters.prototype.sourceDataset
  66480. * @description 叠加分析中源数据集的名称。
  66481. */
  66482. this.sourceDataset = null;
  66483. /**
  66484. * @member {Array.<string>} [DatasetOverlayAnalystParameters.prototype.sourceDatasetFields]
  66485. * @description 叠加分析中源数据集保留在结果数据集中的字段名列表。
  66486. */
  66487. this.sourceDatasetFields = [];
  66488. /**
  66489. * @member {FilterParameter} [DatasetOverlayAnalystParameters.prototype.filterQueryParameter]
  66490. * @description 设置源数据集中空间对象过滤条件。
  66491. */
  66492. this.sourceDatasetFilter = new FilterParameter();
  66493. /**
  66494. * @member {number} [DatasetOverlayAnalystParameters.prototype.tolerance=0]
  66495. * @description 容限。
  66496. */
  66497. this.tolerance = 0;
  66498. /**
  66499. * @member {DataReturnOption} [DatasetOverlayAnalystParameters.prototype.resultSetting]
  66500. * @description 结果返回设置类。
  66501. */
  66502. this.resultSetting = new DataReturnOption();
  66503. Util_Util.extend(this, options);
  66504. this.CLASS_NAME = "SuperMap.DatasetOverlayAnalystParameters";
  66505. }
  66506. /**
  66507. * @function DatasetOverlayAnalystParameters.prototype.destroy
  66508. * @override
  66509. */
  66510. destroy() {
  66511. super.destroy();
  66512. var me = this;
  66513. me.operateDataset = null;
  66514. me.operateDatasetFields = null;
  66515. if (me.operateDatasetFilter) {
  66516. me.operateDatasetFilter.destroy();
  66517. me.operateDatasetFilter = null;
  66518. }
  66519. if (me.operateRegions) {
  66520. for (var i = 0, opRegions = me.operateRegions, len = opRegions.length; i < len; i++) {
  66521. opRegions[i].destroy();
  66522. }
  66523. me.operateRegions = null;
  66524. }
  66525. me.sourceDataset = null;
  66526. me.sourceDatasetFields = null;
  66527. if (me.sourceDatasetFilter) {
  66528. me.sourceDatasetFilter.destroy();
  66529. me.sourceDatasetFilter = null;
  66530. }
  66531. me.tolerance = null;
  66532. if (me.resultSetting) {
  66533. me.resultSetting.destroy();
  66534. me.resultSetting = null;
  66535. }
  66536. }
  66537. /**
  66538. * @function DatasetOverlayAnalystParameters.toObject
  66539. * @param {DatasetOverlayAnalystParameters} datasetOverlayAnalystParameters - 数据集叠加分析参数类。
  66540. * @param {DatasetOverlayAnalystParameters} tempObj - 数据集叠加分析参数对象。
  66541. * @description 将数据集叠加分析参数类转换为 JSON 对象。
  66542. * @returns {Object} JSON 对象。
  66543. */
  66544. static toObject(datasetOverlayAnalystParameters, tempObj) {
  66545. for (var name in datasetOverlayAnalystParameters) {
  66546. if (name === "sourceDataset") {
  66547. continue;
  66548. } else if (name === "operateRegions") {
  66549. tempObj.operateRegions = [];
  66550. var ors = datasetOverlayAnalystParameters.operateRegions;
  66551. for (var index in ors) {
  66552. if (ors.hasOwnProperty(index)) { //icl542
  66553. tempObj.operateRegions[index] = ServerGeometry.fromGeometry(ors[index]);
  66554. }
  66555. }
  66556. } else if (name === "resultSetting") {
  66557. tempObj.dataReturnOption = datasetOverlayAnalystParameters.resultSetting;
  66558. } else {
  66559. tempObj[name] = datasetOverlayAnalystParameters[name];
  66560. }
  66561. }
  66562. }
  66563. }
  66564. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryOverlayAnalystParameters.js
  66565. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66566. * This program are made available under the terms of the Apache License, Version 2.0
  66567. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66568. /**
  66569. * @class GeometryOverlayAnalystParameters
  66570. * @deprecatedclass SuperMap.GeometryOverlayAnalystParameters
  66571. * @category iServer SpatialAnalyst OverlayAnalyst
  66572. * @classdesc
  66573. * 几何对象叠加分析参数类。对指定的某两个几何对象做叠加分析。通过该类可以指定要做叠加分析的几何对象、叠加操作类型。
  66574. * @param {Object} options - 参数。
  66575. * @param {GeoJSONObject} options.operateGeometry - 叠加分析的操作几何对象。<br>
  66576. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  66577. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link GeoJSONObject}。<br>
  66578. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link GeoJSONObject}。<br>
  66579. * @param {GeoJSONObject} options.sourceGeometry - 叠加分析的源几何对象。
  66580. * @param {Array.<GeoJSONFeature>} [options.operateGeometries] - 批量叠加分析的操作几何对象数组。
  66581. * @param {Array.<GeoJSONFeature>} [options.sourceGeometries] -批量叠加分析的源几何对象数组。
  66582. * @param {OverlayOperationType} [options.operation] - 叠加操作枚举值。
  66583. * @extends {OverlayAnalystParameters}
  66584. * @usage
  66585. */
  66586. class GeometryOverlayAnalystParameters extends OverlayAnalystParameters {
  66587. constructor(options) {
  66588. super(options);
  66589. if (options && options.operateGeometry) {
  66590. this.operateGeometry = options.operateGeometry;
  66591. }
  66592. if (options && options.sourceGeometry) {
  66593. this.sourceGeometry = options.sourceGeometry;
  66594. }
  66595. if (options && options.operateGeometries) {
  66596. this.operateGeometries = options.operateGeometries;
  66597. }
  66598. if (options && options.sourceGeometries) {
  66599. this.sourceGeometries = options.sourceGeometries;
  66600. }
  66601. if (options) {
  66602. Util_Util.extend(this, options);
  66603. }
  66604. this.CLASS_NAME = "SuperMap.GeometryOverlayAnalystParameters";
  66605. }
  66606. /**
  66607. * @function GeometryOverlayAnalystParameters.prototype.destroy
  66608. * @override
  66609. */
  66610. destroy() {
  66611. super.destroy();
  66612. var me = this;
  66613. if (me.sourceGeometry) {
  66614. me.sourceGeometry.destroy();
  66615. me.sourceGeometry = null;
  66616. }
  66617. if (me.sourceGeometries) {
  66618. me.sourceGeometries.destroy();
  66619. me.sourceGeometries = null;
  66620. }
  66621. if (me.sourceGeometry) {
  66622. me.sourceGeometry.destroy();
  66623. me.sourceGeometry = null;
  66624. }
  66625. if (me.operateGeometries) {
  66626. me.operateGeometries.destroy();
  66627. me.operateGeometries = null;
  66628. }
  66629. }
  66630. /**
  66631. * @function GeometryOverlayAnalystParameters.toObject
  66632. * @param {GeometryOverlayAnalystParameters} geometryOverlayAnalystParameters - 几何对象叠加分析参数类。
  66633. * @param {GeometryOverlayAnalystParameters} tempObj - 几何对象叠加分析参数对象。
  66634. * @description 将几何对象叠加分析参数对象转换为 JSON 对象。
  66635. * @returns {Object} JSON 对象。
  66636. */
  66637. static toObject(geometryOverlayAnalystParameters, tempObj) {
  66638. for (var name in geometryOverlayAnalystParameters) {
  66639. if (name === "sourceGeometry") {
  66640. tempObj.sourceGeometry = ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometry);
  66641. } else if (name === "sourceGeometries") {
  66642. var sourceGeometries = [];
  66643. for (var i = 0; i < geometryOverlayAnalystParameters.sourceGeometries.length; i++) {
  66644. sourceGeometries.push(ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometries[i]));
  66645. }
  66646. tempObj.sourceGeometries = sourceGeometries;
  66647. } else if (name === "operateGeometry") {
  66648. tempObj.operateGeometry = ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometry);
  66649. } else if (name === "operateGeometries") {
  66650. var operateGeometries = [];
  66651. for (var j = 0; j < geometryOverlayAnalystParameters.operateGeometries.length; j++) {
  66652. operateGeometries.push(ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometries[j]));
  66653. }
  66654. tempObj.operateGeometries = operateGeometries;
  66655. } else {
  66656. tempObj[name] = geometryOverlayAnalystParameters[name];
  66657. }
  66658. }
  66659. }
  66660. }
  66661. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystService.js
  66662. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66663. * This program are made available under the terms of the Apache License, Version 2.0
  66664. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66665. /**
  66666. * @class OverlayAnalystService
  66667. * @deprecatedclass SuperMap.OverlayAnalystService
  66668. * @category iServer SpatialAnalyst OverlayAnalyst
  66669. * @classdesc 叠加分析服务类。
  66670. * 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
  66671. * 叠加分析结果通过该类支持的事件的监听函数参数获取
  66672. * @param {string} url - 服务地址。如http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  66673. * @param {Object} options - 参数。
  66674. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  66675. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66676. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  66677. * @param {Object} [options.headers] - 请求头。
  66678. * @extends {CommonServiceBase}
  66679. * @example 例如:
  66680. * (start code)
  66681. * var myOverlayAnalystService = new OverlayAnalystService(url, {
  66682. * eventListeners: {
  66683. * "processCompleted": OverlayCompleted,
  66684. * "processFailed": OverlayFailed
  66685. * }
  66686. * });
  66687. * (end)
  66688. * @usage
  66689. */
  66690. class OverlayAnalystService extends SpatialAnalystBase {
  66691. constructor(url, options) {
  66692. super(url, options);
  66693. /**
  66694. * @member {string} OverlayAnalystService.prototype.mode
  66695. * @description 叠加分析类型
  66696. */
  66697. this.mode = null;
  66698. if (options) {
  66699. Util_Util.extend(this, options);
  66700. }
  66701. this.CLASS_NAME = "SuperMap.OverlayAnalystService";
  66702. }
  66703. /**
  66704. * @override
  66705. */
  66706. destroy() {
  66707. super.destroy();
  66708. this.mode = null;
  66709. }
  66710. /**
  66711. * @function OverlayAnalystService.prototype.processAsync
  66712. * @description 负责将客户端的查询参数传递到服务端。
  66713. * @param {OverlayAnalystParameters} parameter - 叠加分析参数类。
  66714. */
  66715. processAsync(parameter) {
  66716. var parameterObject = {};
  66717. var me = this;
  66718. if (parameter instanceof DatasetOverlayAnalystParameters) {
  66719. me.mode = "datasets";
  66720. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.sourceDataset + '/overlay');
  66721. DatasetOverlayAnalystParameters.toObject(parameter, parameterObject);
  66722. } else if (parameter instanceof GeometryOverlayAnalystParameters) {
  66723. me.mode = "geometry";
  66724. //支持传入多个几何要素进行叠加分析
  66725. if(parameter.operateGeometries && parameter.sourceGeometries){
  66726. me.url = Util_Util.urlPathAppend(me.url, 'geometry/overlay/batch');
  66727. me.url = Util_Util.urlAppend(me.url, 'ignoreAnalystParam=true');
  66728. }else {
  66729. me.url = Util_Util.urlPathAppend(me.url, 'geometry/overlay');
  66730. }
  66731. GeometryOverlayAnalystParameters.toObject(parameter, parameterObject);
  66732. }
  66733. this.returnContent = true;
  66734. var jsonParameters = Util_Util.toJSON(parameterObject);
  66735. me.request({
  66736. method: "POST",
  66737. data: jsonParameters,
  66738. scope: me,
  66739. success: me.serviceProcessCompleted,
  66740. failure: me.serviceProcessFailed
  66741. });
  66742. }
  66743. dataFormat() {
  66744. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  66745. }
  66746. }
  66747. ;// CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureParameters.js
  66748. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66749. * This program are made available under the terms of the Apache License, Version 2.0
  66750. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66751. /**
  66752. * @class RouteCalculateMeasureParameters
  66753. * @deprecatedclass SuperMap.RouteCalculateMeasureParameters
  66754. * @category iServer SpatialAnalyst RouteCalculateMeasure
  66755. * @classdesc 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
  66756. * @param {Object} options - 参数。
  66757. * @param {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} options.sourceRoute - 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
  66758. * @param {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>} options.point - 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
  66759. * @param {number} [options.tolerance] - 容限值。
  66760. * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。
  66761. * @usage
  66762. */
  66763. class RouteCalculateMeasureParameters {
  66764. constructor(options) {
  66765. if (!options) {
  66766. return this;
  66767. }
  66768. /**
  66769. * @member {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} RouteCalculateMeasureParameters.prototype.sourceRoute
  66770. * @description 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
  66771. */
  66772. this.sourceRoute = null;
  66773. /**
  66774. * @member {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>} RouteCalculateMeasureParameters.prototype.point
  66775. * @description 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
  66776. */
  66777. this.point = null;
  66778. /**
  66779. * @member {number} [RouteCalculateMeasureParameters.prototype.tolerance]
  66780. * @description 容限值。
  66781. */
  66782. this.tolerance = null;
  66783. /**
  66784. * @member {boolean} [RouteCalculateMeasureParameters.prototype.isIgnoreGap=false]
  66785. * @description 是否忽略子对象之间的距离。
  66786. */
  66787. this.isIgnoreGap = false;
  66788. Util_Util.extend(this, options);
  66789. this.CLASS_NAME = "SuperMap.RouteCalculateMeasureParameters";
  66790. }
  66791. /**
  66792. * @function RouteCalculateMeasureParameters.prototype.destroy
  66793. * @description 释放资源,将引用资源的属性置空。
  66794. */
  66795. destroy() {
  66796. var me = this;
  66797. me.sourceRoute = null;
  66798. me.point = null;
  66799. if (me.tolerance) {
  66800. me.tolerance = null;
  66801. }
  66802. if (me.isIgnoreGap) {
  66803. me.isIgnoreGap = false;
  66804. }
  66805. }
  66806. }
  66807. ;// CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureService.js
  66808. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66809. * This program are made available under the terms of the Apache License, Version 2.0
  66810. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66811. /**
  66812. * @class RouteCalculateMeasureService
  66813. * @deprecatedclass SuperMap.RouteCalculateMeasureService
  66814. * @category iServer SpatialAnalyst RouteCalculateMeasure
  66815. * @classdesc 基于路由对象计算指定点 M 值操作的服务类。
  66816. * 该类负责将客户设置的计算指定点的 M 值参数传递给服务端,并接收服务端返回的
  66817. * 指定点的 M 值。通过该类支持的事件的监听函数参数获取。
  66818. * @extends {SpatialAnalystBase}
  66819. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  66820. * @param {Object} options - 参数。
  66821. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  66822. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66823. * @param {Object} [options.headers] - 请求头。
  66824. * @example 实例化该类如下例所示:
  66825. * (start code)
  66826. * var parameters = new RouteCalculateMeasureParameters({
  66827. * "sourceRoute":{
  66828. * "type":"LINEM",
  66829. * "parts":[4],
  66830. * "points":[
  66831. * {
  66832. * "measure":0,
  66833. * "y":-6674.466867067764,
  66834. * "x":3817.3527876130133
  66835. * },
  66836. * {
  66837. * "measure":199.57954019411724,
  66838. * "y":-6670.830929417594,
  66839. * "x":3617.806369901496
  66840. * },
  66841. * {
  66842. * "measure":609.3656478634477,
  66843. * "y":-6877.837541432356,
  66844. * "x":3264.1498746678444
  66845. * },
  66846. * {
  66847. * "measure":936.0174126282958,
  66848. * "y":-7038.687780615184,
  66849. * "x":2979.846206068903
  66850. * }
  66851. * ]
  66852. * },
  66853. * "tolerance":1,
  66854. * "point":{
  66855. * "x":3330.7754269417,
  66856. * "y":-6838.8394457216
  66857. * },
  66858. * "isIgnoreGap":false
  66859. * });
  66860. *
  66861. * var routeCalculateMeasureService = new RouteCalculateMeasureService(spatialAnalystURL, {
  66862. * eventListeners:{
  66863. * processCompleted:calculateCompleted,
  66864. * processFailed:calculateFailded
  66865. * }
  66866. * );
  66867. * routeCalculateMeasureService.processAsync(parameters);
  66868. *
  66869. * //执行
  66870. * function calculateCompleted(){todo}
  66871. * function calculateFailded(){todo}
  66872. * (end)
  66873. * @usage
  66874. */
  66875. class RouteCalculateMeasureService extends SpatialAnalystBase {
  66876. constructor(url, options) {
  66877. super(url, options);
  66878. this.CLASS_NAME = "SuperMap.RouteCalculateMeasureService";
  66879. }
  66880. /**
  66881. * @override
  66882. */
  66883. destroy() {
  66884. super.destroy();
  66885. }
  66886. /**
  66887. * @function RouteCalculateMeasureService.prototype.processAsync
  66888. * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
  66889. * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  66890. */
  66891. processAsync(params) {
  66892. if (!(params instanceof RouteCalculateMeasureParameters)) {
  66893. return;
  66894. }
  66895. var me = this, jsonParameters;
  66896. jsonParameters = me.getJsonParameters(params);
  66897. me.request({
  66898. method: "POST",
  66899. data: jsonParameters,
  66900. scope: me,
  66901. success: me.serviceProcessCompleted,
  66902. failure: me.serviceProcessFailed
  66903. });
  66904. }
  66905. /**
  66906. * @function RouteCalculateMeasureService.prototype.getJsonParameters
  66907. * @description 将参数转化为 JSON 字符串。
  66908. * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  66909. * @returns {Object} 转化后的 JSON 字符串。
  66910. */
  66911. getJsonParameters(params) {
  66912. var jsonParameters, jsonStr = "geometry/calculatemeasure", me = this;
  66913. me.url = Util_Util.urlPathAppend(me.url, jsonStr);
  66914. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  66915. jsonParameters = Util_Util.toJSON(params);
  66916. return jsonParameters;
  66917. }
  66918. }
  66919. ;// CONCATENATED MODULE: ./src/common/iServer/RouteLocatorParameters.js
  66920. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66921. * This program are made available under the terms of the Apache License, Version 2.0
  66922. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66923. /**
  66924. * @class RouteLocatorParameters
  66925. * @deprecatedclass SuperMap.RouteLocatorParameters
  66926. * @category iServer SpatialAnalyst RouteLocator
  66927. * @classdesc 路由对象定位空间对象的参数类。
  66928. * 参数有两种方式,分别为 Geometry 和 Dataset 两种,前者需要指定 sourceRoute 对象作为参数,后者需要 dataset,routeIDField,routeID 三个参数。如果用户两种参数均设置,优先选择 Dataset 方式。
  66929. * @param {Object} options - 参数。
  66930. * @param {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} options.sourceRoute - 路由对象。
  66931. * @param {number} options.measure - 定位点的 M 值。只当路由对象定位点时有意义。
  66932. * @param {string} [options.type] - 类型:点 or 线。
  66933. * @param {number} [options.offset=0] - 定位点偏移量。只当路由对象定位点时有意义。
  66934. * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。即不忽略子对象之间的距离。
  66935. * @param {number} [options.startMeasure] - 定位线的起始 M 值。只当路由对象定位线时有意义。
  66936. * @param {number} [options.endMeasure] - 定位线的终止 M 值。只当路由对象定位线时有意义。
  66937. * @usage
  66938. */
  66939. class RouteLocatorParameters {
  66940. constructor(options) {
  66941. if (!options) {
  66942. return this;
  66943. }
  66944. /**
  66945. * @member {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} RouteLocatorParameters.prototype.sourceRoute
  66946. * @description 路由对象。
  66947. */
  66948. this.sourceRoute = null;
  66949. /**
  66950. * @member {string} RouteLocatorParameters.prototype.dataset
  66951. * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
  66952. */
  66953. this.dataset = null;
  66954. /**
  66955. * @member {string} RouteLocatorParameters.prototype.routeIDField
  66956. * @description 路由对象所在的字段名称。
  66957. *
  66958. */
  66959. this.routeIDField = null;
  66960. /**
  66961. * @member {number} RouteLocatorParameters.prototype.routeID
  66962. * @description 路由对象标识。
  66963. *
  66964. */
  66965. this.routeID = null;
  66966. /**
  66967. * @member {string} [RouteLocatorParameters.prototype.type]
  66968. * @description 类型:点 or 线。
  66969. * 可选值为:
  66970. * LINE :根据起始 M 值及终止 M 值定位线对象。
  66971. * POINT : 根据 M 值定位点对象。
  66972. */
  66973. this.type = null;
  66974. /**
  66975. * @member {number} RouteLocatorParameters.prototype.measure
  66976. * @description 定位点的 M 值。只当路由对象定位点时有意义。
  66977. */
  66978. this.measure = null;
  66979. /**
  66980. * @member {number} [RouteLocatorParameters.prototype.offset=0]
  66981. * @description 定位点偏移量。只当路由对象定位点时有意义。
  66982. */
  66983. this.offset = 0;
  66984. /**
  66985. * @member {boolean} [RouteLocatorParameters.prototype.isIgnoreGap=false]
  66986. * @description 是否忽略子对象之间的距离。
  66987. */
  66988. this.isIgnoreGap = false;
  66989. /**
  66990. * @member {number} [RouteLocatorParameters.prototype.startMeasure]
  66991. * @description 定位线的起始 M 值。只当路由对象定位线时有意义。
  66992. */
  66993. this.startMeasure = null;
  66994. /**
  66995. * @member {number} [RouteLocatorParameters.prototype.endMeasure]
  66996. * @description 定位线的终止 M 值。只当路由对象定位线时有意义。
  66997. */
  66998. this.endMeasure = null;
  66999. var routeFromClient = options.sourceRoute;
  67000. var routeHandle = {};
  67001. if (routeFromClient && routeFromClient instanceof Geometry_Geometry && routeFromClient.components) {
  67002. routeHandle.type = routeFromClient.type;
  67003. routeHandle.parts = routeFromClient.parts;
  67004. var parts = [];
  67005. for (var i = 0, len = routeFromClient.components.length; i < len; i++) {
  67006. parts = parts.concat(routeFromClient.components[i].components);
  67007. }
  67008. routeHandle.points = parts;
  67009. options.sourceRoute = routeHandle;
  67010. }
  67011. Util_Util.extend(this, options);
  67012. this.CLASS_NAME = "SuperMap.RouteLocatorParameters";
  67013. }
  67014. /**
  67015. * @function RouteLocatorParameters.prototype.destroy
  67016. * @description 释放资源,将引用资源的属性置空。
  67017. */
  67018. destroy() {
  67019. var me = this;
  67020. me.sourceRoute = null;
  67021. me.type = null;
  67022. me.measure = null;
  67023. me.offset = 0;
  67024. me.isIgnoreGap = false;
  67025. me.startMeasure = null;
  67026. me.endMeasure = null;
  67027. me.dataset = null;
  67028. me.routeID = null;
  67029. me.routeIDField = null;
  67030. }
  67031. }
  67032. ;// CONCATENATED MODULE: ./src/common/iServer/RouteLocatorService.js
  67033. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67034. * This program are made available under the terms of the Apache License, Version 2.0
  67035. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67036. /**
  67037. * @class RouteLocatorService
  67038. * @deprecatedclass SuperMap.RouteLocatorService
  67039. * @category iServer SpatialAnalyst RouteLocator
  67040. * @classdesc 路由对象定位空间对象的服务类。
  67041. * @extends {SpatialAnalystBase}
  67042. * @param {string} url -服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  67043. * @param {Object} options - 参数。
  67044. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  67045. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  67046. * @param {Object} [options.headers] - 请求头。
  67047. * @example 实例化该类如下例所示:
  67048. * (start code)
  67049. * var routeLocatorParameters_point = new RouteLocatorParameters({
  67050. * "sourceRoute":{
  67051. * "type":"LINEM",
  67052. * "parts":[4],
  67053. * "points":[
  67054. * {
  67055. * "measure":0,
  67056. * "y":-6674.466867067764,
  67057. * "x":3817.3527876130133
  67058. * },
  67059. * {
  67060. * "measure":199.57954019411724,
  67061. * "y":-6670.830929417594,
  67062. * "x":3617.806369901496
  67063. * },
  67064. * {
  67065. * "measure":609.3656478634477,
  67066. * "y":-6877.837541432356,
  67067. * "x":3264.1498746678444
  67068. * },
  67069. * {
  67070. * "measure":936.0174126282958,
  67071. * "y":-7038.687780615184,
  67072. * "x":2979.846206068903
  67073. * }
  67074. * ]
  67075. * },
  67076. * "type":"POINT",
  67077. * "measure":10,
  67078. * "offset":3,
  67079. * "isIgnoreGap":true
  67080. * });
  67081. * var routeLocatorService = new RouteLocatorService(spatialAnalystURL, {
  67082. * eventListeners:{
  67083. * processCompleted:routeLocatorCompleted,
  67084. * processFailed:routeLocatorFailded
  67085. * }
  67086. * );
  67087. * routeLocatorService.processAsync(routeLocatorParameters_point);
  67088. *
  67089. * //执行
  67090. * function routeLocatorCompleted(){todo}
  67091. * function routeLocatorFailded(){todo}
  67092. * (end)
  67093. * @usage
  67094. */
  67095. class RouteLocatorService extends SpatialAnalystBase {
  67096. constructor(url, options) {
  67097. super(url, options);
  67098. this.CLASS_NAME = "SuperMap.RouteLocatorService";
  67099. }
  67100. /**
  67101. * @override
  67102. */
  67103. destroy() {
  67104. super.destroy();
  67105. }
  67106. /**
  67107. * @function RouteLocatorService.prototype.processAsync
  67108. * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
  67109. * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  67110. */
  67111. processAsync(params) {
  67112. if (!(params instanceof RouteLocatorParameters)) {
  67113. return;
  67114. }
  67115. var me = this, jsonParameters;
  67116. jsonParameters = me.getJsonParameters(params);
  67117. me.request({
  67118. method: "POST",
  67119. data: jsonParameters,
  67120. scope: me,
  67121. success: me.serviceProcessCompleted,
  67122. failure: me.serviceProcessFailed
  67123. });
  67124. }
  67125. /**
  67126. * @function RouteLocatorService.prototype.processAsync
  67127. * @description 将参数转化为 JSON 字符串。
  67128. * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  67129. * @returns {Object} 转化后的JSON字符串。
  67130. */
  67131. getJsonParameters(params) {
  67132. var jsonParameters, jsonStr = "geometry/routelocator", me = this;
  67133. if (params.dataset) {
  67134. jsonStr = "datasets/" + params.dataset + "/linearreferencing/routelocator";
  67135. params.sourceRoute = null;
  67136. }
  67137. me.url = Util_Util.urlPathAppend(me.url, jsonStr);
  67138. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  67139. jsonParameters = Util_Util.toJSON(params);
  67140. return jsonParameters;
  67141. }
  67142. }
  67143. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParametersSetting.js
  67144. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67145. * This program are made available under the terms of the Apache License, Version 2.0
  67146. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67147. /**
  67148. * @class SurfaceAnalystParametersSetting
  67149. * @deprecatedclass SuperMap.SurfaceAnalystParametersSetting
  67150. * @category iServer SpatialAnalyst SurfaceAnalyst
  67151. * @classdesc 表面分析参数设置类。
  67152. * 通过该类可以设置表面分析提取等值线、提取等值面的一些参数,包括基准值、等值距、光滑度、光滑方法等。
  67153. * @param {Object} options - 参数。
  67154. * @param {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [options.clipRegion] - 裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
  67155. * @param {number} [options.datumValue=0] - 提取等值线、提取等值面的基准值。
  67156. * @param {Array.<number>} options.expectedZValues - 期望分析结果的 Z 值集合。
  67157. * @param {number} [options.interval=0] - 等值距。等值距是两条等值线之间的间隔值。
  67158. * @param {number} [options.resampleTolerance=0] - 重采样容限。
  67159. * @param {SmoothMethod} [options.smoothMethod=SmoothMethod.BSPLINE] - 光滑处理所使用的方法。
  67160. * @param {number} [options.smoothness=0] - 等值线或等值面的边界线的光滑度。
  67161. * @usage
  67162. */
  67163. class SurfaceAnalystParametersSetting {
  67164. constructor(options) {
  67165. /**
  67166. * @member {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [SurfaceAnalystParametersSetting.prototype.clipRegion]
  67167. * @description 获取或设置裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
  67168. */
  67169. this.clipRegion = null;
  67170. /**
  67171. * @member {number} [SurfaceAnalystParametersSetting.prototype.datumValue=0]
  67172. * @description 获取或设置表面分析中提取等值线、提取等值面的基准值。
  67173. * 基准值是作为一个生成等值线的初始起算值,并不一定是最小等值线的值。例如,高程范围为 220 -1550 的 DEM 栅格数据,
  67174. * 如果设基准值为 0,等值距为 50,则提取等值线时,以基准值 0 为起点,等值距 50 为间隔提取等值线,
  67175. * 因为给定高程的最小值是 220,所以,在给定范围内提取等值线的最小高程是 250。
  67176. * 提取等值线的结果是:最小等值线值为 250,最大等值线值为 1550。
  67177. */
  67178. this.datumValue = 0;
  67179. /**
  67180. * @member {Array.<number>} SurfaceAnalystParametersSetting.prototype.expectedZValues
  67181. * @description 获取或设置期望分析结果的 Z 值集合。
  67182. * Z 值集合存储一系列数值,该数值为待提取等值线的值。即仅高程值在 Z 值集合中的等值线会被提取。
  67183. */
  67184. this.expectedZValues = null;
  67185. /**
  67186. * @member {number} [SurfaceAnalystParametersSetting.prototype.interval=0]
  67187. * @description 获取或设置等值距。等值距是两条等值线之间的间隔值。
  67188. */
  67189. this.interval = 0;
  67190. /**
  67191. * @member {number} [SurfaceAnalystParametersSetting.prototype.resampleTolerance=0]
  67192. * @description 获取或设置重采样容限。
  67193. * 容限值越大,采样结果数据越简化。当分析结果出现交叉时,可通过调整重采样容限为较小的值来处理。
  67194. */
  67195. this.resampleTolerance = 0;
  67196. /**
  67197. * @member {SmoothMethod} [SurfaceAnalystParametersSetting.prototype.smoothMethod=SmoothMethod.BSPLINE]
  67198. * @description 获取或设置光滑处理所使用的方法。
  67199. */
  67200. this.smoothMethod = SmoothMethod.BSPLINE;
  67201. /**
  67202. * @member {number} [SurfaceAnalystParametersSetting.prototype.smoothness=0]
  67203. * @description 获取或设置表面分析中等值线或等值面的边界线的光滑度。
  67204. * 以为 0-5 为例,光滑度为 0 表示不进行光滑操作,值越大表示光滑度越高。
  67205. * 随着光滑度的增加,提取的等值线越光滑,当然光滑度越大,
  67206. * 计算所需的时间和占用的内存也就越大。而且,当等值距较小时,
  67207. * 光滑度太高会出现等值线相交的问题。
  67208. */
  67209. this.smoothness = 0;
  67210. if (options) {
  67211. Util_Util.extend(this, options);
  67212. }
  67213. this.CLASS_NAME = "SuperMap.SurfaceAnalystParametersSetting";
  67214. }
  67215. /**
  67216. * @function SurfaceAnalystParametersSetting.prototype.destroy
  67217. * @description 释放资源,将引用资源的属性置空。
  67218. */
  67219. destroy() {
  67220. var me = this;
  67221. if (me.clipRegion) {
  67222. me.clipRegion.destroy();
  67223. me.clipRegion = null;
  67224. }
  67225. me.datumValue = null;
  67226. me.expectedZValues = null;
  67227. me.interval = null;
  67228. me.resampleTolerance = null;
  67229. me.smoothMethod = null;
  67230. me.smoothness = null;
  67231. }
  67232. /**
  67233. * @function SurfaceAnalystParametersSetting.prototype.toJSON
  67234. * @description 将对象转化为 JSON 字符串。
  67235. * @returns {string} 对象 JSON 字符串。
  67236. */
  67237. toJSON() {
  67238. let json = "'datumValue':" + Util_Util.toJSON(this.datumValue);
  67239. json += ",'interval':" + Util_Util.toJSON(this.interval);
  67240. json += ",'resampleTolerance':" + Util_Util.toJSON(this.resampleTolerance);
  67241. json += ",'smoothMethod':" + Util_Util.toJSON(this.smoothMethod);
  67242. json += ",'smoothness':" + Util_Util.toJSON(this.smoothness);
  67243. if (this.expectedZValues != null) {
  67244. json += "," + "'expectedZValues':" + Util_Util.toJSON(this.expectedZValues);
  67245. }
  67246. if (this.clipRegion != null) {
  67247. var serverGeometry = this.clipRegion;
  67248. if (this.clipRegion instanceof Geometry_Geometry && this.clipRegion.components) {
  67249. serverGeometry = ServerGeometry.fromGeometry(this.clipRegion)
  67250. }
  67251. json += ",'clipRegion':" + Util_Util.toJSON(serverGeometry);
  67252. }
  67253. return "{" + json + "}";
  67254. }
  67255. }
  67256. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParameters.js
  67257. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67258. * This program are made available under the terms of the Apache License, Version 2.0
  67259. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67260. /**
  67261. * @class SurfaceAnalystParameters
  67262. * @deprecatedclass SuperMap.SurfaceAnalystParameters
  67263. * @category iServer SpatialAnalyst SurfaceAnalyst
  67264. * @classdesc 表面分析提取操作参数类。通过该类可以为进行表面分析提供参数信息,包括表面分析的方法提取等值线、提取等值面和中间结果的分辨率,
  67265. * {@link DatasetSurfaceAnalystParameters} 和 {@link GeometrySurfaceAnalystParameters} 继承自该类。
  67266. * @param {Object} options - 参数。
  67267. * @param {SurfaceAnalystParametersSetting} options.extractParameter - 表面分析参数设置类。
  67268. * @param {number} options.resolution - 指定中间结果(栅格数据集)的分辨率。
  67269. * @param {DataReturnOption} options.resultSetting - 结果返回设置类。
  67270. * @param {SurfaceAnalystMethod} [options.surfaceAnalystMethod=SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  67271. * @usage
  67272. */
  67273. class SurfaceAnalystParameters {
  67274. constructor(options) {
  67275. /**
  67276. * @member {number} SurfaceAnalystParameters.prototype.resolution
  67277. * @description 获取或设置指定中间结果(栅格数据集)的分辨率。
  67278. */
  67279. this.resolution = 0;
  67280. /**
  67281. * @member {SurfaceAnalystParametersSetting} SurfaceAnalystParameters.prototype.extractParameter
  67282. * @description 获取或设置表面分析参数。
  67283. * 在进行点数据集进行提取等值面分析时,暂时不支持 SurfaceAnalystParametersSetting 类中的 expectedZValues 字段。
  67284. */
  67285. this.extractParameter = new SurfaceAnalystParametersSetting();
  67286. /**
  67287. * @member {DataReturnOption} SurfaceAnalystParameters.prototype.resultSetting
  67288. * @description 结果返回设置类。
  67289. */
  67290. this.resultSetting = new DataReturnOption();
  67291. /**
  67292. * @member {SurfaceAnalystMethod} [SurfaceAnalystParameters.prototype.surfaceAnalystMethod=SurfaceAnalystMethod.ISOLINE]
  67293. * @description 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  67294. */
  67295. this.surfaceAnalystMethod = SurfaceAnalystMethod.ISOLINE;
  67296. if (options) {
  67297. Util_Util.extend(this, options);
  67298. }
  67299. this.CLASS_NAME = "SuperMap.SurfaceAnalystParameters";
  67300. }
  67301. /**
  67302. * @function SurfaceAnalystParameters.prototype.destroy
  67303. * @description 释放资源,将引用资源的属性置空。
  67304. */
  67305. destroy() {
  67306. var me = this;
  67307. me.resolution = null;
  67308. if (me.extractParameter) {
  67309. me.extractParameter.destroy();
  67310. me.extractParameter = null;
  67311. }
  67312. if (me.resultSetting) {
  67313. me.resultSetting.destroy();
  67314. me.resultSetting = null;
  67315. }
  67316. me.surfaceAnalystMethod = null;
  67317. }
  67318. }
  67319. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetSurfaceAnalystParameters.js
  67320. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67321. * This program are made available under the terms of the Apache License, Version 2.0
  67322. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67323. /**
  67324. * @class DatasetSurfaceAnalystParameters
  67325. * @deprecatedclass SuperMap.DatasetSurfaceAnalystParameters
  67326. * @category iServer SpatialAnalyst SurfaceAnalyst
  67327. * @classdesc 数据集表面分析参数类。该类对数据集表面分析所用到的参数进行设置。
  67328. * @param {Object} options - 参数。
  67329. * @param {string} options.dataset - 数据集名称。
  67330. * @param {string} options.zValueFieldName - 字段名称。
  67331. * @param {number} options.resolution - 指定中间结果(栅格数据集)的分辨率。
  67332. * @param {SurfaceAnalystParametersSetting} options.extractParameter - 表面分析参数设置类。获取或设置表面分析参数。
  67333. * @param {FilterParameter} [options.filterQueryParameter] - 查询过滤条件参数。
  67334. * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
  67335. * @param {SurfaceAnalystMethod} [options.surfaceAnalystMethod=SurfaceAnalystMethod.ISOLINE] - 表面分析的提取方法,提取等值线和提取等值面。
  67336. * @extends {SurfaceAnalystParameters}
  67337. * @usage
  67338. */
  67339. class DatasetSurfaceAnalystParameters extends SurfaceAnalystParameters {
  67340. constructor(options) {
  67341. super(options);
  67342. /**
  67343. * @member {string} DatasetSurfaceAnalystParameters.prototype.dataset
  67344. * @description 要用来做数据集表面分析的数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Country@World。
  67345. */
  67346. this.dataset = null;
  67347. /**
  67348. * @member {FilterParameter} DatasetSurfaceAnalystParameters.prototype.filterQueryParameter
  67349. * @description 获取或设置查询过滤条件参数。
  67350. */
  67351. this.filterQueryParameter = new FilterParameter();
  67352. /**
  67353. * @member {string} DatasetSurfaceAnalystParameters.prototype.zValueFieldName
  67354. * @description 获取或设置用于提取操作的字段名称。提取等值线时,将使用该字段中的值,对点记录集中的点数据进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
  67355. */
  67356. this.zValueFieldName = null;
  67357. if (options) {
  67358. Util_Util.extend(this, options);
  67359. }
  67360. this.CLASS_NAME = "SuperMap.DatasetSurfaceAnalystParameters";
  67361. }
  67362. /**
  67363. * @function DatasetSurfaceAnalystParameters.prototype.destroy
  67364. * @override
  67365. */
  67366. destroy() {
  67367. super.destroy();
  67368. var me = this;
  67369. me.dataset = null;
  67370. if (me.filterQueryParameter) {
  67371. me.filterQueryParameter.destroy();
  67372. me.filterQueryParameter = null;
  67373. }
  67374. me.zValueFieldName = null;
  67375. }
  67376. /**
  67377. * @function DatasetSurfaceAnalystParameters.toObject
  67378. * @param {DatasetSurfaceAnalystParameters} datasetSurfaceAnalystParameters - 数据集表面分析参数类。
  67379. * @param {DatasetSurfaceAnalystParameters} tempObj - 数据集表面分析参数对象。
  67380. * @description 将数据集表面分析参数对象转换为 JSON 对象。
  67381. * @returns JSON 对象。
  67382. */
  67383. static toObject(datasetSurfaceAnalystParameters, tempObj) {
  67384. for (var name in datasetSurfaceAnalystParameters) {
  67385. if (name === "filterQueryParameter") {
  67386. tempObj.filterQueryParameter = datasetSurfaceAnalystParameters.filterQueryParameter;
  67387. }
  67388. if (name === "extractParameter") {
  67389. if (datasetSurfaceAnalystParameters.extractParameter.clipRegion instanceof Geometry_Geometry && datasetSurfaceAnalystParameters.extractParameter.clipRegion.components) {
  67390. datasetSurfaceAnalystParameters.extractParameter.clipRegion = ServerGeometry.fromGeometry(datasetSurfaceAnalystParameters.extractParameter.clipRegion);
  67391. }
  67392. tempObj.extractParameter = datasetSurfaceAnalystParameters.extractParameter;
  67393. } else if (name === "dataset") {
  67394. continue;
  67395. } else if (name === "surfaceAnalystMethod") {
  67396. continue;
  67397. } else {
  67398. tempObj[name] = datasetSurfaceAnalystParameters[name];
  67399. }
  67400. }
  67401. }
  67402. }
  67403. ;// CONCATENATED MODULE: ./src/common/iServer/GeometrySurfaceAnalystParameters.js
  67404. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67405. * This program are made available under the terms of the Apache License, Version 2.0
  67406. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67407. /**
  67408. * @class GeometrySurfaceAnalystParameters
  67409. * @deprecatedclass SuperMap.GeometrySurfaceAnalystParameters
  67410. * @category iServer SpatialAnalyst SurfaceAnalyst
  67411. * @classdesc 几何对象表面分析参数类。该类对几何对象表面分析所用到的参数进行设置。
  67412. * @param {Object} options - 参数。
  67413. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} options.points - 表面分析的坐标点数组。
  67414. * @param {Array.<number>} options.zValues - 表面分析的坐标点的 Z 值数组。
  67415. * @param {number} [options.resolution] - 获取或设置指定中间结果(栅格数据集)的分辨率。
  67416. * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
  67417. * @param {SurfaceAnalystParametersSetting} options.extractParameter - 获取或设置表面分析参数。
  67418. * @param {SurfaceAnalystMethod} [options.surfaceAnalystMethod = SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  67419. * @extends {SurfaceAnalystParameters}
  67420. * @usage
  67421. */
  67422. class GeometrySurfaceAnalystParameters extends SurfaceAnalystParameters {
  67423. constructor(options) {
  67424. super(options);
  67425. /**
  67426. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} GeometrySurfaceAnalystParameters.prototype.points
  67427. * @description 获取或设置用于表面分析的坐标点数组。
  67428. */
  67429. this.points = null;
  67430. /**
  67431. * @member {Array.<number>} GeometrySurfaceAnalystParameters.prototype.zValues
  67432. * @description 获取或设置用于提取操作的值。提取等值线时,将使用该数组中的值,
  67433. * 对几何对象中的坐标点数组进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
  67434. */
  67435. this.zValues = null;
  67436. if (options) {
  67437. Util_Util.extend(this, options);
  67438. }
  67439. this.CLASS_NAME = "SuperMap.GeometrySurfaceAnalystParameters";
  67440. }
  67441. /**
  67442. * @function GeometrySurfaceAnalystParameters.prototype.destroy
  67443. * @override
  67444. */
  67445. destroy() {
  67446. super.destroy();
  67447. var me = this;
  67448. if (me.points) {
  67449. for (var i = 0, points = me.points, len = points.length; i < len; i++) {
  67450. points[i].destroy();
  67451. }
  67452. me.points = null;
  67453. }
  67454. me.zValues = null;
  67455. }
  67456. }
  67457. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystService.js
  67458. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67459. * This program are made available under the terms of the Apache License, Version 2.0
  67460. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67461. /**
  67462. * @class SurfaceAnalystService
  67463. * @deprecatedclass SuperMap.SurfaceAnalystService
  67464. * @category iServer SpatialAnalyst SurfaceAnalyst
  67465. * @classdesc 表面分析服务类。
  67466. * 该类负责将客户设置的表面分析服务参数传递给服务端,并接收服务端返回的表面分析服务分析结果数据。
  67467. * 表面分析结果通过该类支持的事件的监听函数参数获取
  67468. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  67469. * @param {Object} options - 参数。
  67470. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  67471. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  67472. * @param {Object} [options.headers] - 请求头。
  67473. * @extends {SpatialAnalystBase}
  67474. * @example 例如:
  67475. * (start code)
  67476. * var mySurfaceAnalystService = new SurfaceAnalystService(url, {
  67477. * eventListeners: {
  67478. * "processCompleted": surfaceAnalysCompleted,
  67479. * "processFailed": surfaceAnalysFailed
  67480. * }
  67481. * });
  67482. * (end)
  67483. * @usage
  67484. */
  67485. class SurfaceAnalystService extends SpatialAnalystBase {
  67486. constructor(url, options) {
  67487. super(url, options);
  67488. this.CLASS_NAME = "SuperMap.SurfaceAnalystService";
  67489. }
  67490. /**
  67491. * @function SurfaceAnalystService.prototype.destroy
  67492. * @description 释放资源,将引用的资源属性置空。
  67493. */
  67494. destroy() {
  67495. super.destroy();
  67496. }
  67497. /**
  67498. * @function SurfaceAnalystService.prototype.processAsync
  67499. * @description 负责将客户端的表面分析服务参数传递到服务端。
  67500. * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  67501. */
  67502. processAsync(params) {
  67503. if (!(params instanceof SurfaceAnalystParameters)) {
  67504. return;
  67505. }
  67506. var me = this, jsonParameters;
  67507. jsonParameters = me.getJsonParameters(params);
  67508. me.request({
  67509. method: "POST",
  67510. data: jsonParameters,
  67511. scope: me,
  67512. success: me.serviceProcessCompleted,
  67513. failure: me.serviceProcessFailed
  67514. });
  67515. }
  67516. /**
  67517. * @function SurfaceAnalystService.prototype.getJsonParameters
  67518. * @description 将参数转化为 JSON 字符串。
  67519. * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  67520. * @returns {Object} 转化后的JSON字符串。
  67521. */
  67522. getJsonParameters(params) {
  67523. var jsonParameters = '';
  67524. var parameterObject = {};
  67525. var me = this;
  67526. if (params instanceof DatasetSurfaceAnalystParameters) {
  67527. me.url = Util_Util.urlPathAppend(
  67528. me.url,
  67529. 'datasets/' + params.dataset + '/' + params.surfaceAnalystMethod.toLowerCase()
  67530. );
  67531. DatasetSurfaceAnalystParameters.toObject(params, parameterObject);
  67532. jsonParameters = Util_Util.toJSON(parameterObject);
  67533. } else if (params instanceof GeometrySurfaceAnalystParameters) {
  67534. me.url = Util_Util.urlPathAppend(me.url, 'geometry/' + params.surfaceAnalystMethod.toLowerCase());
  67535. jsonParameters = Util_Util.toJSON(params);
  67536. } else {
  67537. return;
  67538. }
  67539. this.returnContent = true;
  67540. return jsonParameters;
  67541. }
  67542. dataFormat() {
  67543. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  67544. }
  67545. }
  67546. ;// CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationParameters.js
  67547. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67548. * This program are made available under the terms of the Apache License, Version 2.0
  67549. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67550. /**
  67551. * @class TerrainCurvatureCalculationParameters
  67552. * @deprecatedclass SuperMap.TerrainCurvatureCalculationParameters
  67553. * @category iServer SpatialAnalyst TerrainCalculation
  67554. * @classdesc 地形曲率计算参数类。
  67555. * @param {Object} options - 参数。
  67556. * @param {string} options.dataset - 地形曲率计算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  67557. * @param {string} options.averageCurvatureName - 结果数据集:平均曲率数据集的名称。
  67558. * @param {string} options.profileCurvatureName - 结果数据集:剖面曲率数据集的名称。
  67559. * @param {string} options.planCurvatureName - 结果数据集:平面曲率数据集的名称。
  67560. * @param {number} [options.zFactor=1.0] - 指定的高程缩放系数。1.0 表示不缩放。
  67561. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  67562. * @usage
  67563. */
  67564. class TerrainCurvatureCalculationParameters {
  67565. constructor(options) {
  67566. if (!options) {
  67567. return;
  67568. }
  67569. /**
  67570. * @member {string} TerrainCurvatureCalculationParameters.prototype.dataset
  67571. * @description 要用来做地形曲率计算数据源中数据集的名称。
  67572. * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  67573. * 注:地形曲率计算必须为栅格数据集。
  67574. */
  67575. this.dataset = null;
  67576. /**
  67577. * @member {number} [TerrainCurvatureCalculationParameters.prototype.zFactor=1.0]
  67578. * @description 指定的高程缩放系数。1.0 表示不缩放。
  67579. * 该值是指在 DEM 栅格数据中,栅格值( Z 坐标,即高程值)相对于 X 和 Y 坐标的单位变换系数。
  67580. * 通常有 X,Y,Z 都参加的计算中,需要将高程值乘以一个高程缩放系数,使得三者单位一致。
  67581. * 例如,X、Y 方向上的单位是米,而 Z 方向的单位是英尺,由于 1 英尺等于 0.3048 米,则需要指定缩放系数为 0.3048。
  67582. */
  67583. this.zFactor = 1.0;
  67584. /**
  67585. * @member {string} TerrainCurvatureCalculationParameters.prototype.averageCurvatureName
  67586. * @description 结果数据集:平均曲率数据集的名称。
  67587. */
  67588. this.averageCurvatureName = null;
  67589. /**
  67590. * @member {string} TerrainCurvatureCalculationParameters.prototype.profileCurvatureName
  67591. * @description 结果数据集:剖面曲率数据集的名称。
  67592. */
  67593. this.profileCurvatureName = "";
  67594. /**
  67595. * @member {string} TerrainCurvatureCalculationParameters.prototype.planCurvatureName
  67596. * @description 结果数据集:平面曲率数据集的名称。
  67597. */
  67598. this.planCurvatureName = "";
  67599. /**
  67600. * @member {boolean} [TerrainCurvatureCalculationParameters.prototype.deleteExistResultDataset=false]
  67601. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  67602. */
  67603. this.deleteExistResultDataset = false;
  67604. Util_Util.extend(this, options);
  67605. this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationParameters";
  67606. }
  67607. /**
  67608. * @function TerrainCurvatureCalculationParameters.prototype.destroy
  67609. * @description 释放资源,将引用资源的属性置空。
  67610. */
  67611. destroy() {
  67612. var me = this;
  67613. me.dataset = null;
  67614. me.zFactor = 1.0;
  67615. me.averageCurvatureName = null;
  67616. me.profileCurvatureName = null;
  67617. me.planCurvatureName = null;
  67618. me.deleteExistResultDataset = true;
  67619. }
  67620. /**
  67621. * @function TerrainCurvatureCalculationParameters.toObject
  67622. * @param {Object} derrainCurvatureCalculationParameters - 地形曲率计算参数。
  67623. * @param {Object} tempObj - 目标对象。
  67624. * @description 生成地形曲率计算对象。
  67625. */
  67626. static toObject(derrainCurvatureCalculationParameters, tempObj) {
  67627. for (var name in derrainCurvatureCalculationParameters) {
  67628. if (name !== "dataset") {
  67629. tempObj[name] = derrainCurvatureCalculationParameters[name];
  67630. }
  67631. }
  67632. }
  67633. }
  67634. ;// CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationService.js
  67635. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67636. * This program are made available under the terms of the Apache License, Version 2.0
  67637. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67638. /**
  67639. * @class TerrainCurvatureCalculationService
  67640. * @deprecatedclass SuperMap.TerrainCurvatureCalculationService
  67641. * @category iServer SpatialAnalyst TerrainCalculation
  67642. * @classdesc 地形曲率计算服务类。
  67643. * @extends {SpatialAnalystBase}
  67644. * @param {Object} options - 参数。
  67645. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  67646. * @param {string} options.url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
  67647. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  67648. * @param {Object} [options.headers] - 请求头。
  67649. * @example 例如:
  67650. * (start code)
  67651. * var myTerrainCurvatureCalculationService = new TerrainCurvatureCalculationService(url);
  67652. * myTerrainCurvatureCalculationService.on({
  67653. * "processCompleted": processCompleted,
  67654. * "processFailed": processFailed
  67655. * }
  67656. * );
  67657. * (end)
  67658. * @usage
  67659. */
  67660. class TerrainCurvatureCalculationService extends SpatialAnalystBase {
  67661. constructor(url, options) {
  67662. super(url, options);
  67663. this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationService";
  67664. }
  67665. /**
  67666. *@override
  67667. */
  67668. destroy() {
  67669. super.destroy();
  67670. }
  67671. /**
  67672. * @function TerrainCurvatureCalculationService.prototype.processAsync
  67673. * @description 负责将客户端的查询参数传递到服务端。
  67674. * @param {TerrainCurvatureCalculationParameters} parameter - 地形曲率计算参数类。
  67675. */
  67676. processAsync(parameter) {
  67677. var me = this;
  67678. var parameterObject = {};
  67679. if (parameter instanceof TerrainCurvatureCalculationParameters) {
  67680. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/terraincalculation/curvature');
  67681. }
  67682. TerrainCurvatureCalculationParameters.toObject(parameter, parameterObject);
  67683. var jsonParameters = Util_Util.toJSON(parameterObject);
  67684. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  67685. me.request({
  67686. method: "POST",
  67687. data: jsonParameters,
  67688. scope: me,
  67689. success: me.serviceProcessCompleted,
  67690. failure: me.serviceProcessFailed
  67691. });
  67692. }
  67693. }
  67694. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetThiessenAnalystParameters.js
  67695. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67696. * This program are made available under the terms of the Apache License, Version 2.0
  67697. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67698. /**
  67699. * @class DatasetThiessenAnalystParameters
  67700. * @deprecatedclass SuperMap.DatasetThiessenAnalystParameters
  67701. * @category iServer SpatialAnalyst ThiessenAnalyst
  67702. * @classdesc 数据集泰森多边形分析参数类。
  67703. * @param {Object} options - 参数。
  67704. * @param {FilterParameter} [options.filterQueryParameter] - 过滤参数类,即对数据集中的所有点进行分析。
  67705. * @extends {ThiessenAnalystParameters}
  67706. * @usage
  67707. */
  67708. class DatasetThiessenAnalystParameters extends ThiessenAnalystParameters {
  67709. constructor(options) {
  67710. super(options);
  67711. /**
  67712. * @member {FilterParameter} [DatasetThiessenAnalystParameters.prototype.filterQueryParameter]
  67713. * @description 过滤条件,对待分析数据集中的点进行过滤,即对数据集中的所有点进行分析。
  67714. * @example
  67715. * var filterQueryParameter = new FilterParameter({
  67716. * name: "Countries@World",
  67717. * attributeFilter: "SmID>100"
  67718. * });
  67719. */
  67720. this.filterQueryParameter = null;
  67721. /**
  67722. * @member {string} DatasetThiessenAnalystParameters.prototype.dataset
  67723. * @description 数据集名称待分析的数据集名称,请使用 "datasetName@datasourceName" 格式来表示。
  67724. */
  67725. this.dataset = null;
  67726. if (options) {
  67727. Util_Util.extend(this, options);
  67728. }
  67729. this.CLASS_NAME = "SuperMap.DatasetThiessenAnalystParameters";
  67730. }
  67731. /**
  67732. * @function DatasetThiessenAnalystParameters.prototype.destroy
  67733. * @override
  67734. */
  67735. destroy() {
  67736. super.destroy();
  67737. var me = this;
  67738. if (me.filterQueryParameter) {
  67739. me.filterQueryParameter.destroy();
  67740. me.filterQueryParameter = null;
  67741. }
  67742. }
  67743. /**
  67744. * @function DatasetThiessenAnalystParameters.toObject
  67745. * @param {DatasetThiessenAnalystParameters} datasetThiessenAnalystParameters - 泰森多边形分析服务参数类。
  67746. * @param {DatasetThiessenAnalystParameters} tempObj - 泰森多边形分析服务参数对象。
  67747. * @description 将泰森多边形分析服务参数对象转换为 JSON 对象。
  67748. * @returns JSON 对象。
  67749. */
  67750. static toObject(datasetThiessenAnalystParameters, tempObj) {
  67751. for (var name in datasetThiessenAnalystParameters) {
  67752. if (name === "clipRegion") {
  67753. tempObj.clipRegion = ServerGeometry.fromGeometry(datasetThiessenAnalystParameters.clipRegion);
  67754. } else {
  67755. tempObj[name] = datasetThiessenAnalystParameters[name];
  67756. }
  67757. }
  67758. }
  67759. }
  67760. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryThiessenAnalystParameters.js
  67761. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67762. * This program are made available under the terms of the Apache License, Version 2.0
  67763. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67764. /**
  67765. * @class GeometryThiessenAnalystParameters
  67766. * @deprecatedclass SuperMap.GeometryThiessenAnalystParameters
  67767. * @constructs GeometryThiessenAnalystParameters
  67768. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  67769. * @classdesc 几何对象泰森多边形分析参数类。对指定的某个几何对象做泰森多边形分析。通过该类可以指定要做泰森多边形分析的几何对象、返回数据集名称等。
  67770. * @param {Object} options - 参数。
  67771. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} options.points - 使用点数组进行分析时使用的几何对象。
  67772. * @extends {ThiessenAnalystParameters}
  67773. * @usage
  67774. */
  67775. class GeometryThiessenAnalystParameters extends ThiessenAnalystParameters {
  67776. constructor(options) {
  67777. super(options);
  67778. /**
  67779. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} GeometryThiessenAnalystParameters.prototype.points
  67780. * @description 使用点数组进行分析时使用的几何对象。
  67781. */
  67782. this.points = null;
  67783. if (options) {
  67784. Util_Util.extend(this, options);
  67785. }
  67786. this.CLASS_NAME = "SuperMap.GeometryThiessenAnalystParameters";
  67787. }
  67788. /**
  67789. * @function GeometryThiessenAnalystParameters.prototype.destroy
  67790. * @override
  67791. */
  67792. destroy() {
  67793. super.destroy();
  67794. var me = this;
  67795. if (me.points) {
  67796. for (var i = me.points.length - 1; i >= 0; i--) {
  67797. me.points[i].destroy();
  67798. }
  67799. me.points = null;
  67800. }
  67801. }
  67802. /**
  67803. * @function GeometryThiessenAnalystParameters.toObject
  67804. * @param {GeometryThiessenAnalystParameters} geometryThiessenAnalystParameters - 几何对象泰森多边形分析参数类。
  67805. * @param {GeometryThiessenAnalystParameters} tempObj - 几何对象泰森多边形分析参数对象。
  67806. * @description 将几何对象泰森多边形分析参数对象转换为 JSON 对象。
  67807. * @returns {Object} JSON 对象。
  67808. */
  67809. static toObject(geometryThiessenAnalystParameters, tempObj) {
  67810. for (var name in geometryThiessenAnalystParameters) {
  67811. if (name === "clipRegion") {
  67812. tempObj.clipRegion = ServerGeometry.fromGeometry(geometryThiessenAnalystParameters.clipRegion);
  67813. } else {
  67814. tempObj[name] = geometryThiessenAnalystParameters[name];
  67815. }
  67816. }
  67817. }
  67818. }
  67819. ;// CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystService.js
  67820. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67821. * This program are made available under the terms of the Apache License, Version 2.0
  67822. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67823. /**
  67824. * @class ThiessenAnalystService
  67825. * @deprecatedclass SuperMap.ThiessenAnalystService
  67826. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  67827. * @classdesc
  67828. * 泰森多边形分析服务类
  67829. * 该类负责将客户设置的泰森多边形分析参数传递给服务端,并接收服务端返回的分析结果数据。
  67830. * 泰森多边形分析结果通过该类支持的事件的监听函数参数获取
  67831. * 泰森多边形分析的参数支持两种,当参数为 {@link DatasetThiessenAnalystParameters} 类型
  67832. * 时,执行数据集泰森多边形分析,当参数为 {@link GeometryThiessenAnalystParameters} 类型时,
  67833. * 执行几何对象泰森多边形分析。
  67834. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  67835. * @param {Object} options - 参数。
  67836. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  67837. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  67838. * @param {Object} [options.headers] - 请求头。
  67839. * @extends {SpatialAnalystBase}
  67840. * @example 例如:
  67841. * (start code)
  67842. * var myThiessenAnalystService = new ThiessenAnalystService(url, {
  67843. * eventListeners: {
  67844. * "processCompleted": bufferCompleted,
  67845. * "processFailed": bufferFailed
  67846. * }
  67847. * });
  67848. * (end)
  67849. * @usage
  67850. */
  67851. class ThiessenAnalystService extends SpatialAnalystBase {
  67852. constructor(url, options) {
  67853. super(url, options);
  67854. /**
  67855. * @member {string} ThiessenAnalystService.prototype.mode
  67856. * @description 缓冲区分析类型
  67857. */
  67858. this.mode = null;
  67859. if (options) {
  67860. Util_Util.extend(this, options);
  67861. }
  67862. this.CLASS_NAME = "SuperMap.ThiessenAnalystService";
  67863. }
  67864. /**
  67865. * @override
  67866. */
  67867. destroy() {
  67868. super.destroy();
  67869. this.mode = null;
  67870. }
  67871. /**
  67872. * @function ThiessenAnalystService.prototype.processAsync
  67873. * @description 负责将客户端的查询参数传递到服务端。
  67874. * @param {DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters} parameter - 泰森多边形分析参数基类。
  67875. */
  67876. processAsync(parameter) {
  67877. var parameterObject = {};
  67878. var me = this;
  67879. if (parameter instanceof DatasetThiessenAnalystParameters) {
  67880. me.mode = "datasets";
  67881. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/thiessenpolygon');
  67882. DatasetThiessenAnalystParameters.toObject(parameter, parameterObject);
  67883. } else if (parameter instanceof GeometryThiessenAnalystParameters) {
  67884. me.mode = "geometry";
  67885. me.url = Util_Util.urlPathAppend(me.url, 'geometry/thiessenpolygon');
  67886. GeometryThiessenAnalystParameters.toObject(parameter, parameterObject);
  67887. }
  67888. var jsonParameters = Util_Util.toJSON(parameterObject);
  67889. this.returnContent = true;
  67890. me.request({
  67891. method: "POST",
  67892. data: jsonParameters,
  67893. scope: me,
  67894. success: me.serviceProcessCompleted,
  67895. failure: me.serviceProcessFailed
  67896. });
  67897. }
  67898. dataFormat() {
  67899. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  67900. }
  67901. }
  67902. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryBatchAnalystService.js
  67903. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67904. * This program are made available under the terms of the Apache License, Version 2.0
  67905. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67906. /**
  67907. * @class GeometryBatchAnalystService
  67908. * @deprecatedclass SuperMap.GeometryBatchAnalystService
  67909. * @category iServer SpatialAnalyst BatchAnalyst
  67910. * @classdesc 批量空间分析服务类
  67911. * @description 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
  67912. * 获取的结果数据包括 originResult 、result 两种,
  67913. * 其中,originResult 为服务端返回的用 JSON 对象表示的量算结果数据,result 为服务端返回的量算结果数据。
  67914. * @extends {SpatialAnalystBase}
  67915. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  67916. * @param {Object} options - 参数。
  67917. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  67918. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  67919. * @param {Object} [options.headers] - 请求头。
  67920. * @example
  67921. * var myOverlayAnalystService = new GeometryBatchAnalystService(url, {
  67922. * eventListeners: {
  67923. * "processCompleted": OverlayCompleted,
  67924. * "processFailed": OverlayFailed
  67925. * }
  67926. * });
  67927. * @usage
  67928. */
  67929. class GeometryBatchAnalystService extends SpatialAnalystBase {
  67930. constructor(url, options) {
  67931. super(url, options);
  67932. if (options) {
  67933. Util_Util.extend(this, options);
  67934. }
  67935. this.CLASS_NAME = "SuperMap.GeometryBatchAnalystService";
  67936. }
  67937. /**
  67938. * @function GeometryBatchAnalystService.prototype.processAsync
  67939. * @description 负责将客户端的查询参数传递到服务端。
  67940. * @param {GeometryOverlayAnalystParameter} parameter - 批量几何对象叠加分析参数类
  67941. *
  67942. */
  67943. processAsync(parameters) {
  67944. var me = this;
  67945. me.url = Util_Util.urlPathAppend(me.url, 'geometry/batchanalyst');
  67946. me.url = Util_Util.urlAppend(me.url, 'returnContent=true&ignoreAnalystParam=true');
  67947. var parameterObjects = me._processParams(parameters);
  67948. var jsonParameters = Util_Util.toJSON(parameterObjects);
  67949. me.request({
  67950. method: "POST",
  67951. data: jsonParameters,
  67952. scope: me,
  67953. success: me.serviceProcessCompleted,
  67954. failure: me.serviceProcessFailed
  67955. });
  67956. }
  67957. _processParams(parameters) {
  67958. var me = this;
  67959. if (!Util_Util.isArray(parameters)) {
  67960. return;
  67961. }
  67962. var processParams = [];
  67963. parameters.map(function (item) {
  67964. processParams.push(me._toJSON(item));
  67965. return item;
  67966. });
  67967. return processParams;
  67968. }
  67969. _toJSON(parameter) {
  67970. var tempObj = {};
  67971. if(parameter.analystName ==="buffer"){
  67972. tempObj.analystName = "buffer";
  67973. tempObj.param = {};
  67974. //几何对象的批量空间分析,
  67975. GeometryBufferAnalystParameters.toObject(parameter.param, tempObj.param);
  67976. }else if(parameter.analystName ==="overlay"){
  67977. tempObj.analystName = "overlay";
  67978. tempObj.param = {};
  67979. GeometryOverlayAnalystParameters.toObject(parameter.param, tempObj.param);
  67980. }else if(parameter.analystName ==="interpolationDensity"){
  67981. tempObj.analystName = "interpolationDensity";
  67982. tempObj.param = {};
  67983. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  67984. }else if(parameter.analystName ==="interpolationidw"){
  67985. tempObj.analystName = "interpolationidw";
  67986. tempObj.param = {};
  67987. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  67988. }else if(parameter.analystName ==="interpolationRBF"){
  67989. tempObj.analystName = "interpolationRBF";
  67990. tempObj.param = {};
  67991. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  67992. }else if(parameter.analystName ==="interpolationKriging"){
  67993. tempObj.analystName = "interpolationKriging";
  67994. tempObj.param = {};
  67995. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  67996. }else if(parameter.analystName ==="thiessenpolygon"){
  67997. tempObj.analystName = "thiessenpolygon";
  67998. tempObj.param = {};
  67999. GeometryThiessenAnalystParameters.toObject(parameter.param, tempObj.param);
  68000. }else {
  68001. //isoline; isoregion; calculatemeasure; routelocator 四种分析不需要再处理参数
  68002. return parameter;
  68003. }
  68004. return tempObj;
  68005. }
  68006. /**
  68007. * @override
  68008. */
  68009. destroy() {
  68010. super.destroy();
  68011. }
  68012. }
  68013. ;// CONCATENATED MODULE: ./src/common/iServer/SpatialAnalystService.js
  68014. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68015. * This program are made available under the terms of the Apache License, Version 2.0
  68016. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68017. /**
  68018. * @class SpatialAnalystService
  68019. * @extends {ServiceBase}
  68020. * @category iServer SpatialAnalyst
  68021. * @classdesc 空间分析服务类。提供:地区太阳辐射、缓冲区分析、点密度分析、动态分段分析、空间关系分析、插值分析、栅格代数运算、叠加分析、路由定位、路由测量计算、表面分析、地形曲率计算、泰森多边形分析。
  68022. * @example
  68023. * new SpatialAnalystService(url).bufferAnalysis(params,function(result){
  68024. * //doSomething
  68025. * })
  68026. * @param {string} url - 服务地址。
  68027. * @param {Object} options - 参数。
  68028. * @param {string} [options.proxy] - 服务代理地址。
  68029. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  68030. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  68031. * @param {Object} [options.headers] - 请求头。
  68032. * @usage
  68033. */
  68034. class SpatialAnalystService_SpatialAnalystService {
  68035. constructor(url, options) {
  68036. this.url = url;
  68037. this.options = options || {};
  68038. }
  68039. /**
  68040. * @function SpatialAnalystService.prototype.getAreaSolarRadiationResult
  68041. * @description 地区太阳辐射。
  68042. * @param {AreaSolarRadiationParameters} params - 地区太阳辐射参数类。
  68043. * @param {RequestCallback} callback 回调函数。
  68044. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  68045. */
  68046. getAreaSolarRadiationResult(params, callback, resultFormat) {
  68047. var me = this;
  68048. var areaSolarRadiationService = new AreaSolarRadiationService(me.url, {
  68049. proxy: me.options.proxy,
  68050. withCredentials: me.options.withCredentials,
  68051. crossOrigin: me.options.crossOrigin,
  68052. headers: me.options.headers,
  68053. eventListeners: {
  68054. scope: me,
  68055. processCompleted: callback,
  68056. processFailed: callback
  68057. },
  68058. format: me._processFormat(resultFormat)
  68059. });
  68060. areaSolarRadiationService.processAsync(params);
  68061. }
  68062. /**
  68063. * @function SpatialAnalystService.prototype.bufferAnalysis
  68064. * @description 缓冲区分析。
  68065. * @param {DatasetBufferAnalystParameters} params - 数据集缓冲区分析参数类。
  68066. * @param {RequestCallback} callback 回调函数。
  68067. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  68068. */
  68069. bufferAnalysis(params, callback, resultFormat) {
  68070. var me = this;
  68071. var bufferAnalystService = new BufferAnalystService(me.url, {
  68072. proxy: me.options.proxy,
  68073. withCredentials: me.options.withCredentials,
  68074. crossOrigin: me.options.crossOrigin,
  68075. headers: me.options.headers,
  68076. eventListeners: {
  68077. scope: me,
  68078. processCompleted: callback,
  68079. processFailed: callback
  68080. },
  68081. format: me._processFormat(resultFormat)
  68082. });
  68083. bufferAnalystService.processAsync(params);
  68084. }
  68085. /**
  68086. * @function SpatialAnalystService.prototype.densityAnalysis
  68087. * @description 点密度分析。
  68088. * @param {DensityKernelAnalystParameters} params - 核密度分析参数类。
  68089. * @param {RequestCallback} callback 回调函数。
  68090. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  68091. */
  68092. densityAnalysis(params, callback, resultFormat) {
  68093. var me = this;
  68094. var densityAnalystService = new DensityAnalystService(me.url, {
  68095. proxy: me.options.proxy,
  68096. withCredentials: me.options.withCredentials,
  68097. crossOrigin: me.options.crossOrigin,
  68098. headers: me.options.headers,
  68099. eventListeners: {
  68100. scope: me,
  68101. processCompleted: callback,
  68102. processFailed: callback
  68103. },
  68104. format: me._processFormat(resultFormat)
  68105. });
  68106. densityAnalystService.processAsync(params);
  68107. }
  68108. /**
  68109. * @function SpatialAnalystService.prototype.generateSpatialData
  68110. * @description 动态分段分析。
  68111. * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
  68112. * @param {RequestCallback} callback 回调函数。
  68113. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  68114. */
  68115. generateSpatialData(params, callback, resultFormat) {
  68116. var me = this;
  68117. var generateSpatialDataService = new GenerateSpatialDataService(me.url, {
  68118. proxy: me.options.proxy,
  68119. withCredentials: me.options.withCredentials,
  68120. crossOrigin: me.options.crossOrigin,
  68121. headers: me.options.headers,
  68122. eventListeners: {
  68123. scope: me,
  68124. processCompleted: callback,
  68125. processFailed: callback
  68126. },
  68127. format: me._processFormat(resultFormat)
  68128. });
  68129. generateSpatialDataService.processAsync(params);
  68130. }
  68131. /**
  68132. * @function SpatialAnalystService.prototype.geoRelationAnalysis
  68133. * @description 空间关系分析。
  68134. * @param {GeoRelationAnalystParameters} params - 空间关系分析服务参数类。
  68135. * @param {RequestCallback} callback 回调函数。
  68136. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  68137. */
  68138. geoRelationAnalysis(params, callback, resultFormat) {
  68139. var me = this;
  68140. var geoRelationAnalystService = new GeoRelationAnalystService(me.url, {
  68141. proxy: me.options.proxy,
  68142. withCredentials: me.options.withCredentials,
  68143. crossOrigin: me.options.crossOrigin,
  68144. headers: me.options.headers,
  68145. eventListeners: {
  68146. scope: me,
  68147. processCompleted: callback,
  68148. processFailed: callback
  68149. },
  68150. format: me._processFormat(resultFormat)
  68151. });
  68152. geoRelationAnalystService.processAsync(params);
  68153. }
  68154. /**
  68155. * @function SpatialAnalystService.prototype.interpolationAnalysis
  68156. * @description 插值分析。
  68157. * @param {InterpolationRBFAnalystParameters|InterpolationDensityAnalystParameters|InterpolationIDWAnalystParameters|InterpolationKrigingAnalystParameters} params - 样条插值分析参数类。
  68158. * @param {RequestCallback} callback 回调函数。
  68159. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  68160. */
  68161. interpolationAnalysis(params, callback, resultFormat) {
  68162. var me = this;
  68163. var interpolationAnalystService = new InterpolationAnalystService(me.url, {
  68164. proxy: me.options.proxy,
  68165. withCredentials: me.options.withCredentials,
  68166. crossOrigin: me.options.crossOrigin,
  68167. headers: me.options.headers,
  68168. eventListeners: {
  68169. scope: me,
  68170. processCompleted: callback,
  68171. processFailed: callback
  68172. },
  68173. format: me._processFormat(resultFormat)
  68174. });
  68175. interpolationAnalystService.processAsync(params);
  68176. }
  68177. /**
  68178. * @function SpatialAnalystService.prototype.mathExpressionAnalysis
  68179. * @description 栅格代数运算。
  68180. * @param {MathExpressionAnalysisParameters} params - 栅格代数运算参数类。
  68181. * @param {RequestCallback} callback 回调函数。
  68182. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  68183. */
  68184. mathExpressionAnalysis(params, callback, resultFormat) {
  68185. var me = this;
  68186. var mathExpressionAnalysisService = new MathExpressionAnalysisService(me.url, {
  68187. proxy: me.options.proxy,
  68188. withCredentials: me.options.withCredentials,
  68189. crossOrigin: me.options.crossOrigin,
  68190. headers: me.options.headers,
  68191. eventListeners: {
  68192. scope: me,
  68193. processCompleted: callback,
  68194. processFailed: callback
  68195. },
  68196. format: me._processFormat(resultFormat)
  68197. });
  68198. mathExpressionAnalysisService.processAsync(params);
  68199. }
  68200. /**
  68201. * @function SpatialAnalystService.prototype.overlayAnalysis
  68202. * @description 叠加分析。
  68203. * @param {DatasetOverlayAnalystParameters|GeometryOverlayAnalystParameters} params - 数据集叠加分析参数类或几何对象叠加分析参数类。
  68204. * @param {RequestCallback} callback 回调函数。
  68205. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  68206. */
  68207. overlayAnalysis(params, callback, resultFormat) {
  68208. var me = this;
  68209. var overlayAnalystService = new OverlayAnalystService(me.url, {
  68210. proxy: me.options.proxy,
  68211. withCredentials: me.options.withCredentials,
  68212. crossOrigin: me.options.crossOrigin,
  68213. headers: me.options.headers,
  68214. eventListeners: {
  68215. scope: me,
  68216. processCompleted: callback,
  68217. processFailed: callback
  68218. },
  68219. format: me._processFormat(resultFormat)
  68220. });
  68221. overlayAnalystService.processAsync(params);
  68222. }
  68223. /**
  68224. * @function SpatialAnalystService.prototype.routeCalculateMeasure
  68225. * @description 路由测量计算。
  68226. * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  68227. * @param {RequestCallback} callback 回调函数。
  68228. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  68229. */
  68230. routeCalculateMeasure(params, callback, resultFormat) {
  68231. var me = this;
  68232. var routeCalculateMeasureService = new RouteCalculateMeasureService(me.url, {
  68233. proxy: me.options.proxy,
  68234. withCredentials: me.options.withCredentials,
  68235. crossOrigin: me.options.crossOrigin,
  68236. headers: me.options.headers,
  68237. eventListeners: {
  68238. scope: me,
  68239. processCompleted: callback,
  68240. processFailed: callback
  68241. },
  68242. format: me._processFormat(resultFormat)
  68243. });
  68244. routeCalculateMeasureService.processAsync(params);
  68245. }
  68246. /**
  68247. * @function SpatialAnalystService.prototype.routeLocate
  68248. * @description 路由定位。
  68249. * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  68250. * @param {RequestCallback} callback 回调函数。
  68251. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  68252. */
  68253. routeLocate(params, callback, resultFormat) {
  68254. var me = this;
  68255. var routeLocatorService = new RouteLocatorService(me.url, {
  68256. proxy: me.options.proxy,
  68257. withCredentials: me.options.withCredentials,
  68258. crossOrigin: me.options.crossOrigin,
  68259. headers: me.options.headers,
  68260. eventListeners: {
  68261. scope: me,
  68262. processCompleted: callback,
  68263. processFailed: callback
  68264. },
  68265. format: me._processFormat(resultFormat)
  68266. });
  68267. routeLocatorService.processAsync(params);
  68268. }
  68269. /**
  68270. * @function SpatialAnalystService.prototype.surfaceAnalysis
  68271. * @description 表面分析。
  68272. * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  68273. * @param {RequestCallback} callback 回调函数。
  68274. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  68275. */
  68276. surfaceAnalysis(params, callback, resultFormat) {
  68277. var me = this;
  68278. var surfaceAnalystService = new SurfaceAnalystService(me.url, {
  68279. proxy: me.options.proxy,
  68280. withCredentials: me.options.withCredentials,
  68281. crossOrigin: me.options.crossOrigin,
  68282. headers: me.options.headers,
  68283. eventListeners: {
  68284. scope: me,
  68285. processCompleted: callback,
  68286. processFailed: callback
  68287. },
  68288. format: me._processFormat(resultFormat)
  68289. });
  68290. surfaceAnalystService.processAsync(params);
  68291. }
  68292. /**
  68293. * @function SpatialAnalystService.prototype.terrainCurvatureCalculate
  68294. * @description 地形曲率计算。
  68295. * @param {TerrainCurvatureCalculationParameters} params - 地形曲率计算参数类。
  68296. * @param {RequestCallback} callback 回调函数。
  68297. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  68298. */
  68299. terrainCurvatureCalculate(params, callback, resultFormat) {
  68300. var me = this;
  68301. var terrainCurvatureCalculationService = new TerrainCurvatureCalculationService(me.url, {
  68302. proxy: me.options.proxy,
  68303. withCredentials: me.options.withCredentials,
  68304. crossOrigin: me.options.crossOrigin,
  68305. headers: me.options.headers,
  68306. eventListeners: {
  68307. scope: me,
  68308. processCompleted: callback,
  68309. processFailed: callback
  68310. },
  68311. format: me._processFormat(resultFormat)
  68312. });
  68313. terrainCurvatureCalculationService.processAsync(params);
  68314. }
  68315. /**
  68316. * @function SpatialAnalystService.prototype.thiessenAnalysis
  68317. * @description 泰森多边形分析。
  68318. * @param {DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters} params - 数据集泰森多边形分析参数类。
  68319. * @param {RequestCallback} callback 回调函数。
  68320. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  68321. */
  68322. thiessenAnalysis(params, callback, resultFormat) {
  68323. var me = this;
  68324. var thiessenAnalystService = new ThiessenAnalystService(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. },
  68334. format: me._processFormat(resultFormat)
  68335. });
  68336. thiessenAnalystService.processAsync(params);
  68337. }
  68338. /**
  68339. * @function SpatialAnalystService.prototype.geometrybatchAnalysis
  68340. * @description 批量空间分析。
  68341. * @param {Array.<Object>} params - 批量分析参数对象数组。
  68342. * @param {Array.<Object>} params.analystName - 空间分析方法的名称。包括:</br>
  68343. * "buffer","overlay","interpolationDensity","interpolationidw","interpolationRBF","interpolationKriging","isoregion","isoline"。
  68344. * @param {Object} params.param - 空间分析类型对应的请求参数,包括:</br>
  68345. * {@link GeometryBufferAnalystParameters} 缓冲区分析参数类。</br>
  68346. * {@link GeometryOverlayAnalystParameters} 叠加分析参数类。</br>
  68347. * {@link InterpolationAnalystParameters} 插值分析参数类。</br>
  68348. * {@link SurfaceAnalystParameters} 表面分析参数类。</br>
  68349. * @param {RequestCallback} callback - 回调函数。
  68350. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  68351. */
  68352. geometrybatchAnalysis(params, callback, resultFormat) {
  68353. var me = this;
  68354. var geometryBatchAnalystService = new GeometryBatchAnalystService(me.url, {
  68355. eventListeners: {
  68356. scope: me,
  68357. processCompleted: callback,
  68358. processFailed: callback
  68359. },
  68360. format: me._processFormat(resultFormat)
  68361. });
  68362. //处理批量分析中各个分类类型的参数:
  68363. var analystParameters = [];
  68364. for (var i = 0; i < params.length; i++) {
  68365. var tempParameter = params[i];
  68366. analystParameters.push({
  68367. analystName: tempParameter.analystName,
  68368. param: tempParameter.param
  68369. })
  68370. }
  68371. geometryBatchAnalystService.processAsync(analystParameters);
  68372. }
  68373. _processFormat(resultFormat) {
  68374. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  68375. }
  68376. }
  68377. ;// CONCATENATED MODULE: ./src/mapboxgl/services/SpatialAnalystService.js
  68378. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68379. * This program are made available under the terms of the Apache License, Version 2.0
  68380. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68381. /**
  68382. * @class SpatialAnalystService
  68383. * @extends {ServiceBase}
  68384. * @category iServer SpatialAnalyst
  68385. * @classdesc 空间分析服务类。提供:地区太阳辐射、缓冲区分析、点密度分析、动态分段分析、空间关系分析、插值分析、栅格代数运算、叠加分析、路由定位、路由测量计算、表面分析、地形曲率计算、泰森多边形分析。
  68386. * @modulecategory Services
  68387. * @example
  68388. * new SpatialAnalystService(url)
  68389. * .bufferAnalysis(params,function(result){
  68390. * //doSomething
  68391. * })
  68392. * @param {string} url - 服务地址。
  68393. * @param {Object} options - 参数。
  68394. * @param {string} [options.proxy] - 服务代理地址。
  68395. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  68396. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  68397. * @param {Object} [options.headers] - 请求头。
  68398. * @usage
  68399. */
  68400. class SpatialAnalystService extends ServiceBase {
  68401. constructor(url, options) {
  68402. super(url, options);
  68403. this._spatialAnalystService = new SpatialAnalystService_SpatialAnalystService(url, options);
  68404. }
  68405. /**
  68406. * @function SpatialAnalystService.prototype.getAreaSolarRadiationResult
  68407. * @description 地区太阳辐射。
  68408. * @param {AreaSolarRadiationParameters} params -查询相关参数类。
  68409. * @param {RequestCallback} callback - 回调函数。
  68410. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  68411. */
  68412. getAreaSolarRadiationResult(params, callback, resultFormat) {
  68413. this._spatialAnalystService.getAreaSolarRadiationResult(params, callback, resultFormat);
  68414. }
  68415. /**
  68416. * @function SpatialAnalystService.prototype.bufferAnalysis
  68417. * @description 缓冲区分析。
  68418. * @param {DatasetBufferAnalystParameters} params - 数据集缓冲区分析参数类。
  68419. * @param {RequestCallback} callback - 回调函数。
  68420. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  68421. */
  68422. bufferAnalysis(params, callback, resultFormat) {
  68423. params = this._processParams(params);
  68424. this._spatialAnalystService.bufferAnalysis(params, callback, resultFormat);
  68425. }
  68426. /**
  68427. * @function SpatialAnalystService.prototype.densityAnalysis
  68428. * @description 点密度分析。
  68429. * @param {DensityKernelAnalystParameters} params - 核密度分析参数类。
  68430. * @param {RequestCallback} callback - 回调函数。
  68431. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  68432. */
  68433. densityAnalysis(params, callback, resultFormat) {
  68434. params = this._processParams(params);
  68435. this._spatialAnalystService.densityAnalysis(params, callback, resultFormat);
  68436. }
  68437. /**
  68438. * @function SpatialAnalystService.prototype.generateSpatialData
  68439. * @description 动态分段分析。
  68440. * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
  68441. * @param {RequestCallback} callback - 回调函数。
  68442. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  68443. */
  68444. generateSpatialData(params, callback, resultFormat) {
  68445. this._spatialAnalystService.generateSpatialData(params, callback, resultFormat);
  68446. }
  68447. /**
  68448. * @function SpatialAnalystService.prototype.geoRelationAnalysis
  68449. * @description 空间关系分析。
  68450. * @param {GeoRelationAnalystParameters} params - 空间关系分析服务参数类。
  68451. * @param {RequestCallback} callback - 回调函数。
  68452. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  68453. */
  68454. geoRelationAnalysis(params, callback, resultFormat) {
  68455. params = this._processParams(params);
  68456. this._spatialAnalystService.geoRelationAnalysis(params, callback, resultFormat);
  68457. }
  68458. /**
  68459. * @function SpatialAnalystService.prototype.interpolationAnalysis
  68460. * @description 插值分析。
  68461. * @param {InterpolationDensityAnalystParameters|InterpolationIDWAnalystParameters|InterpolationRBFAnalystParameters|InterpolationKrigingAnalystParameters} params - 样条插值(径向基函数插值法)分析参数类。
  68462. * @param {RequestCallback} callback - 回调函数。
  68463. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  68464. */
  68465. interpolationAnalysis(params, callback, resultFormat) {
  68466. params = this._processParams(params);
  68467. this._spatialAnalystService.interpolationAnalysis(params, callback, resultFormat);
  68468. }
  68469. /**
  68470. * @function SpatialAnalystService.prototype.mathExpressionAnalysis
  68471. * @description 栅格代数运算。
  68472. * @param {MathExpressionAnalysisParameters} params - 栅格代数运算参数类。
  68473. * @param {RequestCallback} callback - 回调函数。
  68474. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  68475. */
  68476. mathExpressionAnalysis(params, callback, resultFormat) {
  68477. params = this._processParams(params);
  68478. this._spatialAnalystService.mathExpressionAnalysis(params, callback, resultFormat);
  68479. }
  68480. /**
  68481. * @function SpatialAnalystService.prototype.overlayAnalysis
  68482. * @description 叠加分析。
  68483. * @param {DatasetOverlayAnalystParameters|GeometryOverlayAnalystParameters} params - 数据集叠加分析参数类或者几何对象叠加分析参数类。
  68484. * @param {RequestCallback} callback - 回调函数。
  68485. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  68486. */
  68487. overlayAnalysis(params, callback, resultFormat) {
  68488. params = this._processParams(params);
  68489. this._spatialAnalystService.overlayAnalysis(params, callback, resultFormat);
  68490. }
  68491. /**
  68492. * @function SpatialAnalystService.prototype.routeCalculateMeasure
  68493. * @description 路由测量计算。
  68494. * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  68495. * @param {RequestCallback} callback - 回调函数。
  68496. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  68497. */
  68498. routeCalculateMeasure(params, callback, resultFormat) {
  68499. params = this._processParams(params);
  68500. this._spatialAnalystService.routeCalculateMeasure(params, callback, resultFormat);
  68501. }
  68502. /**
  68503. * @function SpatialAnalystService.prototype.routeLocate
  68504. * @description 路由定位。
  68505. * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  68506. * @param {RequestCallback} callback - 回调函数。
  68507. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  68508. */
  68509. routeLocate(params, callback, resultFormat) {
  68510. params = this._processParams(params);
  68511. this._spatialAnalystService.routeLocate(params, callback, resultFormat);
  68512. }
  68513. /**
  68514. * @function SpatialAnalystService.prototype.surfaceAnalysis
  68515. * @description 表面分析。
  68516. * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  68517. * @param {RequestCallback} callback - 回调函数。
  68518. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  68519. */
  68520. surfaceAnalysis(params, callback, resultFormat) {
  68521. params = this._processParams(params);
  68522. this._spatialAnalystService.surfaceAnalysis(params, callback, resultFormat);
  68523. }
  68524. /**
  68525. * @function SpatialAnalystService.prototype.terrainCurvatureCalculate
  68526. * @description 地形曲率计算。
  68527. * @param {TerrainCurvatureCalculationParameters} params - 地形曲率计算参数类。
  68528. * @param {RequestCallback} callback - 回调函数。
  68529. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  68530. */
  68531. terrainCurvatureCalculate(params, callback, resultFormat) {
  68532. this._spatialAnalystService.terrainCurvatureCalculate(params, callback, resultFormat);
  68533. }
  68534. /**
  68535. * @function SpatialAnalystService.prototype.thiessenAnalysis
  68536. * @description 泰森多边形分析。
  68537. * @param {DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters} params - 数据集泰森多边形分析参数类。
  68538. * @param {RequestCallback} callback - 回调函数。
  68539. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  68540. */
  68541. thiessenAnalysis(params, callback, resultFormat) {
  68542. params = this._processParams(params);
  68543. this._spatialAnalystService.thiessenAnalysis(params, callback, resultFormat);
  68544. }
  68545. /**
  68546. * @function SpatialAnalystService.prototype.geometrybatchAnalysis
  68547. * @description 批量空间分析。
  68548. * @param {Array.<Object>} params - 批量分析参数对象数组,包括:
  68549. * @param {string} params.analystName - 空间分析方法的名称。包括:</br>
  68550. * "buffer","overlay","interpolationDensity","interpolationidw","interpolationRBF","interpolationKriging","isoregion","isoline"。
  68551. * @param {Object} params.param - 空间分析类型对应的请求参数,包括:</br>
  68552. * {@link GeometryBufferAnalystParameters} 缓冲区分析参数类。</br>
  68553. * {@link GeometryOverlayAnalystParameters} 叠加分析参数类。</br>
  68554. * {@link InterpolationAnalystParameters} 插值分析参数类。</br>
  68555. * {@link SurfaceAnalystParameters} 表面分析参数类。</br>
  68556. * @param {RequestCallback} callback - 回调函数。
  68557. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  68558. */
  68559. geometrybatchAnalysis(params, callback, resultFormat) {
  68560. for (var i = 0; i < params.length; i++) {
  68561. params[i].param = this._processParams(params[i].param)
  68562. }
  68563. this._spatialAnalystService.geometrybatchAnalysis(params, callback, resultFormat);
  68564. }
  68565. _processParams(params) {
  68566. if (!params) {
  68567. return {};
  68568. }
  68569. if (params.bounds) {
  68570. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  68571. }
  68572. //插值分析点数组转换
  68573. if (params.inputPoints) {
  68574. for (var i = 0; i < params.inputPoints.length; i++) {
  68575. var inputPoint = params.inputPoints[i];
  68576. if (core_Util_Util.isArray(inputPoint)) {
  68577. params.inputPoints[i] = {x: inputPoint[0], y: inputPoint[1], tag: inputPoint[2]};
  68578. }
  68579. }
  68580. }
  68581. //点数组转换
  68582. if (params.points) {
  68583. for (let i = 0; i < params.points.length; i++) {
  68584. var point = params.points[i];
  68585. params.points[i] = core_Util_Util.toSuperMapPoint(point);
  68586. }
  68587. }
  68588. //mapboxgl点对象转SuperMap点对象
  68589. if (params.point) {
  68590. params.point = core_Util_Util.toSuperMapPoint(params.point);
  68591. }
  68592. //初步判断mapbox数据就为geojson格式 ,进行转json格式即可
  68593. //栅格代数运算的范围
  68594. if (params.extractRegion) {
  68595. params.extractRegion = core_Util_Util.toSuperMapGeometry(params.extractRegion);
  68596. }
  68597. //获取或设置表面分析参数
  68598. if (params.extractParameter && params.extractParameter.clipRegion) {
  68599. params.extractParameter.clipRegion = core_Util_Util.toSuperMapGeometry(params.extractParameter.clipRegion);
  68600. }
  68601. if (params.clipParam && params.clipParam.clipRegion) {
  68602. params.clipParam.clipRegion = core_Util_Util.toSuperMapGeometry(params.clipParam.clipRegion);
  68603. }
  68604. //sourceRoute 路由对象。用于里程分析,该对象可以是用户自己生 成或在数据源中查询得到的符合标准的路由对象;geojson格式
  68605. if (params.sourceRoute) {
  68606. if (params.sourceRoute) {
  68607. var target = {};
  68608. target.type = "LINEM";
  68609. target.parts = [params.sourceRoute.geometry.coordinates.length];
  68610. target.points = [];
  68611. for (let i = 0; i < params.sourceRoute.geometry.coordinates.length; i++) {
  68612. var lnglat = params.sourceRoute.geometry.coordinates[i];
  68613. //measure 应该在传值时设置,
  68614. target.points = target.points.concat({x: lnglat[0], y: lnglat[1], measure: lnglat[2]})
  68615. }
  68616. params.sourceRoute = target;
  68617. }
  68618. }
  68619. //operateRegions 操作面对象集合,数据集叠加分析,表示与这些面对象进行叠加分析
  68620. if (params.operateRegions && core_Util_Util.isArray(params.operateRegions)) {
  68621. params.operateRegions.map(function (geometry, key) {
  68622. params.operateRegions[key] = core_Util_Util.toSuperMapGeometry(geometry);
  68623. return params.operateRegions[key];
  68624. });
  68625. }
  68626. //叠加分析,几何数据源 支持格式:GeoJson
  68627. if (params.sourceGeometry) {
  68628. var SRID = null;
  68629. if (params.sourceGeometrySRID) {
  68630. SRID = params.sourceGeometrySRID;
  68631. }
  68632. params.sourceGeometry = core_Util_Util.toSuperMapGeometry(params.sourceGeometry);
  68633. if (SRID) {
  68634. params.sourceGeometry.SRID = SRID;
  68635. }
  68636. delete params.sourceGeometry.sourceGeometrySRID;
  68637. }
  68638. if (params.operateGeometry) {
  68639. params.operateGeometry = core_Util_Util.toSuperMapGeometry(params.operateGeometry);
  68640. }
  68641. //支持传入多个几何要素进行叠加分析:
  68642. if (params.sourceGeometries) {
  68643. var sourceGeometries = [];
  68644. for (var k = 0; k < params.sourceGeometries.length; k++) {
  68645. sourceGeometries.push(core_Util_Util.toSuperMapGeometry(params.sourceGeometries[k]));
  68646. }
  68647. params.sourceGeometries = sourceGeometries;
  68648. }
  68649. //支持传入多个几何要素进行叠加分析:
  68650. if (params.operateGeometries) {
  68651. var operateGeometries = [];
  68652. for (var j = 0; j < params.operateGeometries.length; j++) {
  68653. operateGeometries.push(core_Util_Util.toSuperMapGeometry(params.operateGeometries[j]));
  68654. }
  68655. params.operateGeometries = operateGeometries;
  68656. }
  68657. //components 几何对象数组 Route
  68658. if (params.sourceRoute && params.sourceRoute.components && core_Util_Util.isArray(params.sourceRoute.components)) {
  68659. params.sourceRoute.components.map(function (geometry, key) {
  68660. params.sourceRoute.components[key] = core_Util_Util.toSuperMapGeometry(geometry);
  68661. return params.sourceRoute.components[key];
  68662. });
  68663. }
  68664. return params;
  68665. }
  68666. _processFormat(resultFormat) {
  68667. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  68668. }
  68669. }
  68670. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeParameters.js
  68671. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68672. * This program are made available under the terms of the Apache License, Version 2.0
  68673. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68674. /**
  68675. * @class ThemeParameters
  68676. * @deprecatedclass SuperMap.ThemeParameters
  68677. * @category iServer Map Theme
  68678. * @classdesc 专题图参数类。
  68679. * 该类存储了制作专题所需的参数,包括数据源、数据集名称和专题图对象。
  68680. * @param {Object} options - 参数。
  68681. * @param {Array.<string>} options.datasetNames - 数据集数组。
  68682. * @param {Array.<string>} options.dataSourceNames - 数据源数组。
  68683. * @param {Array.<JoinItem>} [options.joinItems] - 专题图外部表的连接信息 JoinItem 数组。
  68684. * @param {Array.<CommonTheme>} options.themes - 专题图对象列表。
  68685. * @param {Array.<string>} [options.displayFilters] - 专题图属性过滤条件。
  68686. * @param {Array.<string>} [options.displayOrderBys] - 专题图对象生成符号叠加次序排序字段。
  68687. * @param {Object} [options.fieldValuesDisplayFilter] - 图层要素的显示和隐藏的过滤属性,其带有三个属性,分别是:values、fieldName、fieldValuesDisplayMode。
  68688. * @usage
  68689. */
  68690. class ThemeParameters {
  68691. constructor(options) {
  68692. /**
  68693. * @member {Array.<string>} ThemeParameters.prototype.datasetNames
  68694. * @description 要制作专题图的数据集数组。
  68695. */
  68696. this.datasetNames = null;
  68697. /**
  68698. * @member {Array.<string>} ThemeParameters.prototype.dataSourceNames
  68699. * @description 要制作专题图的数据集所在的数据源数组。
  68700. */
  68701. this.dataSourceNames = null;
  68702. /**
  68703. * @member {Array.<JoinItem>} [ThemeParameters.prototype.joinItems]
  68704. * @description 设置与外部表的连接信息 JoinItem 数组。
  68705. * 使用此属性可以制作与外部表连接的专题图。
  68706. */
  68707. this.joinItems = null;
  68708. /**
  68709. * @member {Array.<CommonTheme>} ThemeParameters.prototype.themes
  68710. * @description 专题图对象列表。
  68711. * 该参数为实例化的各类专题图对象的集合。
  68712. */
  68713. this.themes = null;
  68714. /**
  68715. * @member {Array.<string>} [ThemeParameters.prototype.displayFilters]
  68716. * @description 专题图属性过滤条件。
  68717. */
  68718. this.displayFilters = null;
  68719. /**
  68720. * @member {Array.<string>} [ThemeParameters.prototype.displayOrderBys]
  68721. * @description 专题图对象生成符号叠加次序排序字段。
  68722. */
  68723. this.displayOrderBys = null;
  68724. /**
  68725. * @member {Object} [ThemeParameters.prototype.fieldValuesDisplayFilter]
  68726. * @property {Array.<number>} values - 待过滤的值。
  68727. * @property {string} fieldName - 待过滤的字段名称只支持数字类型的字段。
  68728. * @property {string} fieldValuesDisplayMode - 目前为 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
  68729. */
  68730. this.fieldValuesDisplayFilter = null;
  68731. if (options) {
  68732. Util_Util.extend(this, options);
  68733. }
  68734. this.CLASS_NAME = "SuperMap.ThemeParameters";
  68735. }
  68736. /**
  68737. * @function ThemeParameters.prototype.destroy
  68738. * @description 释放资源,将引用资源的属性置空。
  68739. */
  68740. destroy() {
  68741. var me = this;
  68742. me.datasetNames = null;
  68743. me.dataSourceNames = null;
  68744. if (me.joinItems) {
  68745. for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
  68746. joinItems[i].destroy();
  68747. }
  68748. me.joinItems = null;
  68749. }
  68750. if (me.themes) {
  68751. for (let i = 0, themes = me.themes, len = themes.length; i < len; i++) {
  68752. themes[i].destroy();
  68753. }
  68754. me.themes = null;
  68755. }
  68756. }
  68757. }
  68758. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeService.js
  68759. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68760. * This program are made available under the terms of the Apache License, Version 2.0
  68761. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68762. /**
  68763. * @class ThemeService
  68764. * @deprecatedclass SuperMap.ThemeService
  68765. * @category iServer Map Theme
  68766. * @classdesc 专题图服务类。
  68767. * @extends {CommonServiceBase}
  68768. * @example
  68769. * var myThemeService = new ThemeService(url, {
  68770. * eventListeners: {
  68771. * "processCompleted": themeCompleted,
  68772. * "processFailed": themeFailed
  68773. * }
  68774. * });
  68775. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  68776. * @param {Object} options - 参数。
  68777. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  68778. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  68779. * @param {Object} [options.headers] - 请求头。
  68780. * @usage
  68781. */
  68782. class ThemeService_ThemeService extends CommonServiceBase {
  68783. constructor(url, options) {
  68784. super(url, options);
  68785. if (options) {
  68786. Util_Util.extend(this, options);
  68787. }
  68788. this.eventCount = 0;
  68789. this.url = Util_Util.urlPathAppend(this.url, 'tempLayersSet');
  68790. this.CLASS_NAME = 'SuperMap.ThemeService';
  68791. }
  68792. /**
  68793. * @override
  68794. */
  68795. destroy() {
  68796. super.destroy();
  68797. }
  68798. /**
  68799. * @function ThemeService.prototype.processAsync
  68800. * @description 负责将客户端的专题图参数传递到服务端。
  68801. * @param {ThemeParameters} params - 专题图参数类。
  68802. */
  68803. processAsync(params, callback) {
  68804. if (!(params instanceof ThemeParameters)) {
  68805. return;
  68806. }
  68807. var me = this,
  68808. jsonParameters = null;
  68809. jsonParameters = me.getJsonParameters(params);
  68810. let eventId = ++this.eventCount;
  68811. let eventListeners = {
  68812. scope: this,
  68813. processCompleted: function(result) {
  68814. if (eventId === result.result.eventId && callback) {
  68815. delete result.result.eventId;
  68816. callback(result);
  68817. this.events && this.events.un(eventListeners);
  68818. return false;
  68819. }
  68820. },
  68821. processFailed: function(result) {
  68822. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  68823. callback(result);
  68824. this.events && this.events.un(eventListeners);
  68825. return false;
  68826. }
  68827. }
  68828. }
  68829. this.events.on(eventListeners);
  68830. me.request({
  68831. method: "POST",
  68832. data: jsonParameters,
  68833. scope: me,
  68834. success(result, options) {
  68835. result.eventId = eventId;
  68836. this.serviceProcessCompleted(result, options);
  68837. },
  68838. failure(result, options) {
  68839. if (result.error) {
  68840. result.error.eventId = eventId;
  68841. }
  68842. result.eventId = eventId;
  68843. this.serviceProcessFailed(result, options);
  68844. }
  68845. });
  68846. }
  68847. /**
  68848. * @function ThemeService.prototype.getJsonParameters
  68849. * @description 将专题图参数参数转化为 JSON 字符串。
  68850. * @param {ThemeParameters} parameter - 专题图参数类。
  68851. * @returns {Object} 转化后的JSON字符串。
  68852. */
  68853. getJsonParameters(parameter) {
  68854. var jsonParameters = "",
  68855. themeObj = null,
  68856. filters = null,
  68857. orderBys = null,
  68858. fieldValuesDisplayFilter;
  68859. jsonParameters += "[{'type': 'UGC','subLayers': {'layers': [";
  68860. for (var i = 0; i < parameter.themes.length; i++) {
  68861. themeObj = parameter.themes[i];
  68862. var jsonTheme = Util_Util.toJSON(themeObj);
  68863. jsonTheme = jsonTheme.slice(0, -1);
  68864. jsonParameters += "{'theme': " + jsonTheme + "},'type': 'UGC','ugcLayerType': 'THEME',";
  68865. filters = parameter.displayFilters;
  68866. if (filters && filters.length > 0) {
  68867. if (filters.length === 1) {
  68868. jsonParameters += "'displayFilter':\"" + filters[0] + "\",";
  68869. } else {
  68870. jsonParameters += "'displayFilter':\"" + filters[i] + "\",";
  68871. }
  68872. }
  68873. orderBys = parameter.displayOrderBy;
  68874. if (orderBys && orderBys.length > 0) {
  68875. if (orderBys.length === 1) {
  68876. jsonParameters += "'displayOrderBy':'" + orderBys[0] + "',";
  68877. } else {
  68878. jsonParameters += "'displayOrderBy':'" + orderBys[i] + "',";
  68879. }
  68880. }
  68881. fieldValuesDisplayFilter = parameter.fieldValuesDisplayFilter;
  68882. if (fieldValuesDisplayFilter) {
  68883. jsonParameters += "'fieldValuesDisplayFilter':" + Util_Util.toJSON(fieldValuesDisplayFilter) + ",";
  68884. }
  68885. if (parameter.joinItems && parameter.joinItems.length > 0 && parameter.joinItems[i]) {
  68886. jsonParameters += "'joinItems':[" + Util_Util.toJSON(parameter.joinItems[i]) + "],";
  68887. }
  68888. if (parameter.datasetNames && parameter.dataSourceNames) {
  68889. var datasetID = parameter.datasetNames[i] ? i : (parameter.datasetNames.length - 1);
  68890. var dataSourceID = parameter.dataSourceNames[i] ? i : (parameter.dataSourceNames.length - 1);
  68891. jsonParameters += "'datasetInfo': {'name': '" + parameter.datasetNames[datasetID] +
  68892. "','dataSourceName': '" + parameter.dataSourceNames[dataSourceID] + "'}},";
  68893. } else {
  68894. jsonParameters += "},";
  68895. }
  68896. }
  68897. //去除多余的逗号
  68898. if (parameter.themes && parameter.themes.length > 0) {
  68899. jsonParameters = jsonParameters.substring(0, jsonParameters.length - 1);
  68900. }
  68901. jsonParameters += "]},";
  68902. var urlArray = this.url.split("/");
  68903. var jsonMapName = urlArray[urlArray.length - 2];
  68904. jsonParameters += "'name': '" + jsonMapName + "'}]";
  68905. return jsonParameters;
  68906. }
  68907. }
  68908. ;// CONCATENATED MODULE: ./src/mapboxgl/services/ThemeService.js
  68909. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68910. * This program are made available under the terms of the Apache License, Version 2.0
  68911. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68912. /**
  68913. * @class ThemeService
  68914. * @category iServer Map Theme
  68915. * @classdesc 专题图服务类。
  68916. * @extends {ServiceBase}
  68917. * @example
  68918. * new ThemeService(url,{
  68919. * projection:projection
  68920. * }).getThemeInfo(params,function(result){
  68921. * //doSomething
  68922. * });
  68923. * @param {string} url - 服务地址。
  68924. * @param {Object} options - 参数。
  68925. * @param {string} [options.proxy] - 服务代理地址。
  68926. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  68927. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  68928. * @param {Object} [options.headers] - 请求头。
  68929. * @usage
  68930. */
  68931. class ThemeService extends ServiceBase {
  68932. constructor(url, options) {
  68933. super(url, options);
  68934. this._themeService = new ThemeService_ThemeService(this.url, {
  68935. proxy: this.options.proxy,
  68936. withCredentials: this.options.withCredentials,
  68937. crossOrigin:this.options.crossOrigin,
  68938. headers:this.options.headers
  68939. });
  68940. }
  68941. /**
  68942. * @function ThemeService.prototype.getThemeInfo
  68943. * @description 获取专题图信息。
  68944. * @param {ThemeParameters} params - 专题图参数类。
  68945. * @param {RequestCallback} callback - 回调函数。
  68946. */
  68947. getThemeInfo(params, callback) {
  68948. this._themeService.processAsync(params, callback);
  68949. }
  68950. }
  68951. ;// CONCATENATED MODULE: ./src/common/iServer/StopQueryParameters.js
  68952. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68953. * This program are made available under the terms of the Apache License, Version 2.0
  68954. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68955. /**
  68956. * @class StopQueryParameters
  68957. * @deprecatedclass SuperMap.StopQueryParameters
  68958. * @category iServer TrafficTransferAnalyst TransferStops
  68959. * @classdesc 站点查询参数类。
  68960. * @param {Object} options - 参数。
  68961. * @param {string} options.keyWord - 站点名称关键字。
  68962. * @param {boolean} [options.returnPosition=false] - 是否返回站点坐标信息。
  68963. * @usage
  68964. */
  68965. class StopQueryParameters {
  68966. constructor(options) {
  68967. options = options || {};
  68968. /**
  68969. * @member {string} StopQueryParameters.prototype.keyWord
  68970. * @description 站点名称关键字。
  68971. */
  68972. this.keyWord = null;
  68973. /**
  68974. * @member {boolean} [StopQueryParameters.prototype.returnPosition=false]
  68975. * @description 是否返回站点坐标信息。
  68976. */
  68977. this.returnPosition = false;
  68978. Util_Util.extend(this, options);
  68979. this.CLASS_NAME = "SuperMap.StopQueryParameters";
  68980. }
  68981. /**
  68982. * @function StopQueryParameters.prototype.destroy
  68983. * @description 释放资源,将引用资源的属性置空。
  68984. */
  68985. destroy() {
  68986. Util_Util.reset(this);
  68987. }
  68988. }
  68989. ;// CONCATENATED MODULE: ./src/common/iServer/StopQueryService.js
  68990. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68991. * This program are made available under the terms of the Apache License, Version 2.0
  68992. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68993. /**
  68994. * @class StopQueryService
  68995. * @deprecatedclass SuperMap.StopQueryService
  68996. * @category iServer TrafficTransferAnalyst TransferStops
  68997. * @classdesc 站点查询服务类。
  68998. * 返回结果通过该类支持的事件的监听函数参数获取
  68999. * @extends {CommonServiceBase}
  69000. * @param {string} url - 服务地址。
  69001. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  69002. * @param {Object} options - 参数。
  69003. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  69004. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69005. * @param {Object} [options.headers] - 请求头。
  69006. * @example 例如:
  69007. * (start code)
  69008. * var myService = new StopQueryService(url, {eventListeners: {
  69009. * "processCompleted": StopQueryCompleted,
  69010. * "processFailed": StopQueryError
  69011. * }
  69012. * };
  69013. * (end)
  69014. * @usage
  69015. *
  69016. */
  69017. class StopQueryService extends CommonServiceBase {
  69018. constructor(url, options) {
  69019. super(url, options);
  69020. options = options || {};
  69021. Util_Util.extend(this, options);
  69022. this.CLASS_NAME = "SuperMap.StopQueryService";
  69023. }
  69024. /**
  69025. *@override
  69026. */
  69027. destroy() {
  69028. super.destroy();
  69029. Util_Util.reset(this);
  69030. }
  69031. /**
  69032. * @function StopQueryService.prototype.processAsync
  69033. * @description 负责将客户端的更新参数传递到服务端。
  69034. * @param {StopQueryParameters} params - 交通换乘参数。
  69035. */
  69036. processAsync(params) {
  69037. if (!(params instanceof StopQueryParameters)) {
  69038. return;
  69039. }
  69040. var me = this;
  69041. me.url = Util_Util.urlPathAppend(me.url, 'stops/keyword/' + params.keyWord);
  69042. me.request({
  69043. method: "GET",
  69044. params: {returnPosition: params.returnPosition},
  69045. scope: me,
  69046. success: me.serviceProcessCompleted,
  69047. failure: me.serviceProcessFailed
  69048. });
  69049. }
  69050. }
  69051. ;// CONCATENATED MODULE: ./src/common/iServer/TransferPathParameters.js
  69052. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69053. * This program are made available under the terms of the Apache License, Version 2.0
  69054. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69055. /**
  69056. * @class TransferPathParameters
  69057. * @deprecatedclass SuperMap.TransferPathParameters
  69058. * @category iServer TrafficTransferAnalyst TransferPath
  69059. * @classdesc 交通换乘线路查询参数类。
  69060. * @param {Object} options - 参数。
  69061. * @param {Array.<TransferLine>} options.transferLines - 本换乘分段内可乘车的路线集合。
  69062. * @param {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} options.points - 两种查询方式:按照公交站点的起止 ID 进行查询和按照起止点的坐标进行查询。
  69063. * @usage
  69064. */
  69065. class TransferPathParameters {
  69066. constructor(options) {
  69067. options = options || {};
  69068. /**
  69069. * @member {Array.<TransferLine>} TransferPathParameters.prototype.transferLines
  69070. * @description 本换乘分段内可乘车的路线集合,通过交通换乘方案查询得到。
  69071. */
  69072. this.transferLines = null;
  69073. /**
  69074. * @member {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} TransferPathParameters.prototype.points
  69075. * @description 两种查询方式:<br>
  69076. * 1. 按照公交站点的起止ID进行查询,则 points 参数的类型为 int[],形如:[起点ID、终点ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
  69077. * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
  69078. */
  69079. this.points = null;
  69080. Util_Util.extend(this, options);
  69081. this.CLASS_NAME = "SuperMap.TransferPathParameters";
  69082. }
  69083. /**
  69084. * @function TransferPathParameters.prototype.destroy
  69085. * @description 释放资源,将引用资源的属性置空。
  69086. */
  69087. destroy() {
  69088. Util_Util.reset(this);
  69089. }
  69090. /**
  69091. * @function TransferPathParameters.toJson
  69092. * @description 将 {@link TransferPathParameters} 对象参数转换为 JSON 字符串。
  69093. * @param {TransferPathParameters} params - 交通换乘参数。
  69094. * @returns {string} 转化后的 JSON 字符串。
  69095. */
  69096. static toJson(params) {
  69097. if (params) {
  69098. return Util_Util.toJSON(params);
  69099. }
  69100. }
  69101. }
  69102. ;// CONCATENATED MODULE: ./src/common/iServer/TransferPathService.js
  69103. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69104. * This program are made available under the terms of the Apache License, Version 2.0
  69105. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69106. /**
  69107. * @class TransferPathService
  69108. * @deprecatedclass SuperMap.TransferPathService
  69109. * @category iServer TrafficTransferAnalyst TransferPath
  69110. * @classdesc 交通换乘线路查询服务类,根据交通换乘分析结果(TransferSolutionResult),获取某一条乘车路线的详细信息。
  69111. * 返回结果通过该类支持的事件的监听函数参数获取
  69112. * @extends {CommonServiceBase}
  69113. * @example 例如:
  69114. * var myService = new TransferPathService(url, {eventListeners: {
  69115. * "processCompleted": TrafficTransferCompleted,
  69116. * "processFailed": TrafficTransferError
  69117. * }
  69118. * };
  69119. * @param {string} url - 服务地址。
  69120. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  69121. * @param {Object} options - 参数。
  69122. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  69123. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69124. * @param {Object} [options.headers] - 请求头。
  69125. * @usage
  69126. */
  69127. class TransferPathService extends CommonServiceBase {
  69128. constructor(url, options) {
  69129. super(url, options);
  69130. this.CLASS_NAME = "SuperMap.TransferPathService";
  69131. }
  69132. /**
  69133. * @override
  69134. */
  69135. destroy() {
  69136. super.destroy();
  69137. }
  69138. /**
  69139. * @function TransferPathService.prototype.processAsync
  69140. * @description 负责将客户端的更新参数传递到服务端。
  69141. * @param {TransferPathParameters} params - 交通换乘参数。
  69142. */
  69143. processAsync(params) {
  69144. if (!(params instanceof TransferPathParameters)) {
  69145. return;
  69146. }
  69147. var me = this,
  69148. method = "GET",
  69149. jsonParameters;
  69150. me.url = Util_Util.urlPathAppend(me.url, 'path');
  69151. jsonParameters = {
  69152. points: Util_Util.toJSON(params.points),
  69153. transferLines: Util_Util.toJSON(params['transferLines'])
  69154. };
  69155. me.request({
  69156. method: method,
  69157. params: jsonParameters,
  69158. scope: me,
  69159. success: me.serviceProcessCompleted,
  69160. failure: me.serviceProcessFailed
  69161. });
  69162. }
  69163. }
  69164. ;// CONCATENATED MODULE: ./src/common/iServer/TransferSolutionParameters.js
  69165. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69166. * This program are made available under the terms of the Apache License, Version 2.0
  69167. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69168. /**
  69169. * @class TransferSolutionParameters
  69170. * @deprecatedclass SuperMap.TransferSolutionParameters
  69171. * @category iServer TrafficTransferAnalyst TransferSolutions
  69172. * @classdesc 交通换乘方案查询参数类。
  69173. * @param {Object} options - 参数。
  69174. * @param {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} options.points - 两种查询方式:按照公交站点的起止ID进行查询和按照起止点的坐标进行查询。
  69175. * @param {number} [options.solutionCount=6] - 乘车方案的数量。
  69176. * @param {TransferTactic} [options.transferTactic=TransferTactic.LESS_TIME] - 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
  69177. * @param {TransferPreference} [options.transferPreference=TransferPreference.NONE] - 乘车偏好枚举。
  69178. * @param {number} [options.walkingRatio=10] - 步行与公交的消耗权重比。
  69179. * @param {Array.<number>} [options.evadeLines] - 避让路线的 ID。
  69180. * @param {Array.<number>} [options.evadeStops] - 避让站点的 ID。
  69181. * @param {Array.<number>} [options.priorLines] - 优先路线的 ID。
  69182. * @param {Array.<number>} [options.priorStops] - 优先站点的 ID。
  69183. * @param {string} [options.travelTime] - 出行的时间。
  69184. * @usage
  69185. */
  69186. class TransferSolutionParameters {
  69187. constructor(options) {
  69188. options = options || {};
  69189. /**
  69190. * @member {number} [TransferSolutionParameters.prototype.solutionCount=6]
  69191. * @description 乘车方案的数量。
  69192. */
  69193. this.solutionCount = 6;
  69194. /**
  69195. * @member {TransferPreference} [TransferSolutionParameters.prototype.transferPreference=TransferPreference.NONE]
  69196. * @description 乘车偏好枚举。
  69197. */
  69198. this.transferPreference = TransferPreference.NONE;
  69199. /**
  69200. * @member {TransferTactic} [TransferSolutionParameters.prototype.transferTactic=TransferTactic|TransferTactic.LESS_TIME]
  69201. * @description 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
  69202. */
  69203. this.transferTactic = TransferTactic.LESS_TIME;
  69204. /**
  69205. * @member {number} [TransferSolutionParameters.prototype.walkingRatio=10]
  69206. * @description 步行与公交的消耗权重比。此值越大,则步行因素对于方案选择的影响越大。例如:</br>
  69207. * 例如现在有两种换乘方案(在仅考虑消耗因素的情况下):</br>
  69208. * 方案1:坐车 10 公里,走路 1 公里;</br>
  69209. * 方案2:坐车 15 公里,走路 0.5 公里;</br>
  69210. * 1. 假设权重比为 15:</br>
  69211. * •方案 1 的总消耗为:10 + 1*15 = 25</br>
  69212. * •方案 2 的总消耗为:15 + 0.5*15 = 22.5</br>
  69213. * 此时方案 2 消耗更低。</br>
  69214. * 2. 假设权重比为2:</br>
  69215. * •方案 1 的总消耗为:10+1*2 = 12</br>
  69216. * •方案 2 的总消耗为:15+0.5*2 = 17</br>
  69217. * 此时方案 1 消耗更低。</br>
  69218. */
  69219. this.walkingRatio = null;
  69220. /**
  69221. * @member {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} TransferSolutionParameters.prototype.points
  69222. * @description 两种查询方式:</br>
  69223. * 1. 按照公交站点的起止 ID 进行查询,则 points 参数的类型为 int[],形如:[起点 ID、终点 ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
  69224. * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
  69225. */
  69226. this.points = false;
  69227. /**
  69228. * @member {Array.<number>} [TransferSolutionParameters.prototype.evadeLinesnull]
  69229. * @description 避让路线 ID。
  69230. * */
  69231. this.evadeLines = null;
  69232. /**
  69233. * @member {Array.<number>} [TransferSolutionParameters.prototype.evadeStops=TransferLine]
  69234. * @description 避让站点 ID。
  69235. * */
  69236. this.evadeStops = null;
  69237. /**
  69238. * @member {Array.<number>} [TransferSolutionParameters.prototype.priorLines]
  69239. * @description 优先路线 ID。
  69240. * */
  69241. this.priorLines = null;
  69242. /**
  69243. * @member {Array.<number>} [TransferSolutionParameters.prototype.priorStops]
  69244. * @description 优先站点 ID。
  69245. * */
  69246. this.priorStops = null;
  69247. /**
  69248. * @member {string} TransferSolutionParameters.prototype.travelTime
  69249. * @description 出行的时间;格式是:"小时:分钟",如:"08:30"。如果设置了该参数,在分析时,则会考虑线路的首末班车时间的限制,即在返回的结果中会提示公交的首末班发车时间。
  69250. */
  69251. this.travelTime = null;
  69252. Util_Util.extend(this, options);
  69253. this.CLASS_NAME = "SuperMap.TransferSolutionParameters";
  69254. }
  69255. /**
  69256. * @function TransferSolutionParameters.prototype.destroy
  69257. * @description 释放资源,将引用资源的属性置空。
  69258. */
  69259. destroy() {
  69260. Util_Util.reset(this);
  69261. }
  69262. /**
  69263. * @function TransferSolutionParameters.toJsonParameters
  69264. * @description 将 {@link TransferSolutionParameters} 对象参数转换为 JSON 字符串。
  69265. * @param {TransferSolutionParameters} params - 交通换乘参数。
  69266. * @returns {string} 转化后的 JSON 字符串。
  69267. */
  69268. static toJson(params) {
  69269. if (params) {
  69270. return Util_Util.toJSON(params);
  69271. }
  69272. }
  69273. }
  69274. ;// CONCATENATED MODULE: ./src/common/iServer/TransferSolutionService.js
  69275. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69276. * This program are made available under the terms of the Apache License, Version 2.0
  69277. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69278. /**
  69279. * @class TransferSolutionService
  69280. * @deprecatedclass SuperMap.TransferSolutionService
  69281. * @category iServer TrafficTransferAnalyst TransferSolutions
  69282. * @classdesc 交通换乘方案查询服务类。
  69283. * 返回结果通过该类支持的事件的监听函数参数获取。
  69284. * @param {string} url - 服务地址。
  69285. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  69286. * @param {Object} options - 参数。</br>
  69287. * @param {Object} options.eventListeners - 需要被注册的监听器对象。</br>
  69288. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69289. * @param {Object} [options.headers] - 请求头。
  69290. * @extends {CommonServiceBase}
  69291. * @example 例如:
  69292. * (start code)
  69293. * var myService = new TransferSolutionService(url, {eventListeners: {
  69294. * "processCompleted": trafficTransferCompleted,
  69295. * "processFailed": trafficTransferError
  69296. * }
  69297. * };
  69298. * (end)
  69299. * @usage
  69300. */
  69301. class TransferSolutionService extends CommonServiceBase {
  69302. constructor(url, options) {
  69303. super(url, options);
  69304. this.CLASS_NAME = "SuperMap.TransferSolutionService";
  69305. }
  69306. /**
  69307. * @override
  69308. */
  69309. destroy() {
  69310. super.destroy();
  69311. }
  69312. /**
  69313. * @function TransferSolutionService.prototype.processAsync
  69314. * @description 负责将客户端的更新参数传递到服务端。
  69315. * @param {TransferSolutionParameters} params - 交通换乘参数。
  69316. */
  69317. processAsync(params) {
  69318. if (!(params instanceof TransferSolutionParameters)) {
  69319. return;
  69320. }
  69321. var me = this,
  69322. method = "GET",
  69323. jsonParameters;
  69324. me.url = Util_Util.urlPathAppend(me.url, 'solutions');
  69325. jsonParameters = {
  69326. points: Util_Util.toJSON(params.points),
  69327. walkingRatio: params['walkingRatio'],
  69328. transferTactic: params['transferTactic'],
  69329. solutionCount: params['solutionCount'],
  69330. transferPreference: params["transferPreference"]
  69331. };
  69332. if (params.evadeLines) {
  69333. jsonParameters["evadeLines"] = Util_Util.toJSON(params.evadeLines);
  69334. }
  69335. if (params.evadeStops) {
  69336. jsonParameters["evadeStops"] = Util_Util.toJSON(params.evadeStops);
  69337. }
  69338. if (params.priorLines) {
  69339. jsonParameters["priorLines"] = Util_Util.toJSON(params.priorLines);
  69340. }
  69341. if (params.priorStops) {
  69342. jsonParameters["priorStops"] = Util_Util.toJSON(params.priorStops);
  69343. }
  69344. if (params.travelTime) {
  69345. jsonParameters["travelTime"] = params.travelTime;
  69346. }
  69347. me.request({
  69348. method: method,
  69349. params: jsonParameters,
  69350. scope: me,
  69351. success: me.serviceProcessCompleted,
  69352. failure: me.serviceProcessFailed
  69353. });
  69354. }
  69355. }
  69356. ;// CONCATENATED MODULE: ./src/common/iServer/TrafficTransferAnalystService.js
  69357. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69358. * This program are made available under the terms of the Apache License, Version 2.0
  69359. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69360. /**
  69361. * @class TrafficTransferAnalystService
  69362. * @extends {ServiceBase}
  69363. * @category iServer TrafficTransferAnalyst
  69364. * @classdesc 交通换乘分析服务类。
  69365. * @example
  69366. * new TrafficTransferAnalystService(url).queryStop(params,function(result){
  69367. * //doSomething
  69368. * })
  69369. * @param {string} url - 服务地址。
  69370. * @param {Object} options - 参数。
  69371. * @param {string} [options.proxy] - 服务代理地址。
  69372. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  69373. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69374. * @param {Object} [options.headers] - 请求头。
  69375. * @usage
  69376. */
  69377. class TrafficTransferAnalystService_TrafficTransferAnalystService {
  69378. constructor(url, options) {
  69379. this.url = url;
  69380. this.options = options || {};
  69381. }
  69382. /**
  69383. * @function TrafficTransferAnalystService.prototype.queryStop
  69384. * @description 站点查询服务。
  69385. * @param {StopQueryParameters} params - 查询相关参数类。
  69386. * @param {RequestCallback} callback - 回调函数。
  69387. */
  69388. queryStop(params, callback) {
  69389. var me = this;
  69390. var stopQueryService = new StopQueryService(me.url, {
  69391. proxy: me.options.proxy,
  69392. withCredentials: me.options.withCredentials,
  69393. crossOrigin: me.options.crossOrigin,
  69394. headers: me.options.headers,
  69395. eventListeners: {
  69396. scope: me,
  69397. processCompleted: callback,
  69398. processFailed: callback
  69399. }
  69400. });
  69401. stopQueryService.processAsync(params);
  69402. }
  69403. /**
  69404. * @function TrafficTransferAnalystService.prototype.analysisTransferPath
  69405. * @description 交通换乘线路查询服务。
  69406. * @param {TransferPathParameters} params - 查询相关参数类。
  69407. * @param {RequestCallback} callback - 回调函数。
  69408. */
  69409. analysisTransferPath(params, callback) {
  69410. var me = this;
  69411. var transferPathService = new TransferPathService(me.url, {
  69412. proxy: me.options.proxy,
  69413. withCredentials: me.options.withCredentials,
  69414. crossOrigin: me.options.crossOrigin,
  69415. headers: me.options.headers,
  69416. eventListeners: {
  69417. scope: me,
  69418. processCompleted: callback,
  69419. processFailed: callback
  69420. }
  69421. });
  69422. transferPathService.processAsync(params);
  69423. }
  69424. /**
  69425. * @function TrafficTransferAnalystService.prototype.analysisTransferSolution
  69426. * @description 交通换乘方案查询服务。
  69427. * @param {TransferSolutionParameters} params - 查询相关参数类。
  69428. * @param {RequestCallback} callback - 回调函数。
  69429. */
  69430. analysisTransferSolution(params, callback) {
  69431. var me = this;
  69432. var transferSolutionService = new TransferSolutionService(me.url, {
  69433. proxy: me.options.proxy,
  69434. withCredentials: me.options.withCredentials,
  69435. crossOrigin: me.options.crossOrigin,
  69436. headers: me.options.headers,
  69437. eventListeners: {
  69438. scope: me,
  69439. processCompleted: callback,
  69440. processFailed: callback
  69441. }
  69442. });
  69443. transferSolutionService.processAsync(params);
  69444. }
  69445. }
  69446. ;// CONCATENATED MODULE: ./src/mapboxgl/services/TrafficTransferAnalystService.js
  69447. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69448. * This program are made available under the terms of the Apache License, Version 2.0
  69449. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69450. /**
  69451. * @class TrafficTransferAnalystService
  69452. * @extends ServiceBase
  69453. * @category iServer TrafficTransferAnalyst
  69454. * @classdesc 交通换乘分析服务类。
  69455. * @modulecategory Services
  69456. * @example
  69457. * new TrafficTransferAnalystService(url)
  69458. * .queryStop(params,function(result){
  69459. * //doSomething
  69460. * })
  69461. * @param {string} url - 服务地址。
  69462. * @param {Object} options - 参数。
  69463. * @param {string} [options.proxy] - 服务代理地址。
  69464. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  69465. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69466. * @param {Object} [options.headers] - 请求头。
  69467. * @usage
  69468. */
  69469. class TrafficTransferAnalystService extends ServiceBase {
  69470. constructor(url, options) {
  69471. super(url, options);
  69472. this._trafficTransferAnalystService = new TrafficTransferAnalystService_TrafficTransferAnalystService(url, options);
  69473. }
  69474. /**
  69475. * @function TrafficTransferAnalystService.prototype.queryStop
  69476. * @description 站点查询服务。
  69477. * @param {StopQueryParameters} params - 站点查询参数类。
  69478. * @param {RequestCallback} callback - 回调函数。
  69479. */
  69480. queryStop(params, callback) {
  69481. this._trafficTransferAnalystService.queryStop(params, callback);
  69482. }
  69483. /**
  69484. * @function TrafficTransferAnalystService.prototype.analysisTransferPath
  69485. * @description 交通换乘线路查询服务。
  69486. * @param {TransferPathParameters} params - 交通换乘线路查询参数类。
  69487. * @param {RequestCallback} callback - 回调函数。
  69488. */
  69489. analysisTransferPath(params, callback) {
  69490. this._trafficTransferAnalystService.analysisTransferPath(params, callback);
  69491. }
  69492. /**
  69493. * @function TrafficTransferAnalystService.prototype.analysisTransferSolution
  69494. * @description 交通换乘方案查询服务。
  69495. * @param {TransferSolutionParameters} params - 交通换乘方案查询参数类。
  69496. * @param {RequestCallback} callback - 回调函数。
  69497. */
  69498. analysisTransferSolution(params, callback) {
  69499. this._trafficTransferAnalystService.analysisTransferSolution(params, callback);
  69500. }
  69501. _processParams(params) {
  69502. if (!params) {
  69503. return {};
  69504. }
  69505. if (params.transferLines && !core_Util_Util.isArray(params.transferLines)) {
  69506. params.transferLines = [params.transferLines];
  69507. }
  69508. if (params.points && core_Util_Util.isArray(params.points)) {
  69509. params.points.map(function (point, key) {
  69510. params.points[key] = (point instanceof (external_mapboxgl_default()).LngLat) ? {
  69511. x: point.lng,
  69512. y: point.lat
  69513. } : point;
  69514. return params.points[key];
  69515. });
  69516. }
  69517. return params;
  69518. }
  69519. }
  69520. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingService.js
  69521. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69522. * This program are made available under the terms of the Apache License, Version 2.0
  69523. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69524. /**
  69525. * @class WebPrintingService
  69526. * @deprecatedclass SuperMap.WebPrintingService
  69527. * @category iServer WebPrintingJob
  69528. * @version 10.1.0
  69529. * @classdesc 打印地图服务基类。
  69530. * @extends {CommonServiceBase}
  69531. * @param {string} url - 服务地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  69532. * @param {Object} options - 参数。
  69533. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  69534. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69535. * @param {Object} [options.headers] - 请求头。
  69536. * @usage
  69537. */
  69538. class WebPrintingService extends CommonServiceBase {
  69539. constructor(url, options) {
  69540. super(url, options);
  69541. if (options) {
  69542. Util_Util.extend(this, options);
  69543. }
  69544. this.eventCount = 0;
  69545. this.CLASS_NAME = 'SuperMap.WebPrintingService';
  69546. if (!this.url) {
  69547. return;
  69548. }
  69549. }
  69550. /**
  69551. * @function WebPrintingService.prototype.destroy
  69552. * @description 释放资源,将引用资源的属性置空。
  69553. */
  69554. destroy() {
  69555. super.destroy();
  69556. }
  69557. /**
  69558. * @function WebPrintingService.prototype.createWebPrintingJob
  69559. * @description 创建 Web 打印任务。
  69560. * @param {WebPrintingJobParameters} params - Web 打印的请求参数。
  69561. */
  69562. createWebPrintingJob(params, callback) {
  69563. if (!params) {
  69564. return;
  69565. }
  69566. if (params.layoutOptions) {
  69567. if (params.layoutOptions.legendOptions) {
  69568. !params.layoutOptions.legendOptions.title && (params.layoutOptions.legendOptions.title = '');
  69569. params.layoutOptions.legendOptions.picAsBase64 =
  69570. params.layoutOptions.legendOptions.picAsBase64 &&
  69571. params.layoutOptions.legendOptions.picAsBase64.replace(/^data:.+;base64,/, '');
  69572. if (
  69573. params.layoutOptions.legendOptions.customItems &&
  69574. params.layoutOptions.legendOptions.customItems.hasOwnProperty('picAsBase64')
  69575. ) {
  69576. params.layoutOptions.legendOptions.customItems.picAsBase64 = params.layoutOptions.legendOptions.customItems.picAsBase64.replace(
  69577. /^data:.+;base64,/,
  69578. ''
  69579. );
  69580. }
  69581. }
  69582. }
  69583. this.processAsync('jobs', 'POST', callback, params)
  69584. }
  69585. /**
  69586. * @function WebPrintingService.prototype.getPrintingJob
  69587. * @description 获取 Web 打印输出文档任务。
  69588. * @param {string} jobId - Web 打印任务 ID
  69589. */
  69590. getPrintingJob(jobId, callback) {
  69591. var me = this;
  69592. me.processAsync(`jobs/${jobId}`, 'GET', function(result) {
  69593. me.rollingProcess(result, me._processUrl(`jobs/${jobId}`), callback);
  69594. });
  69595. }
  69596. /**
  69597. * @function WebPrintingService.prototype.getPrintingJobResult
  69598. * @description 获取 Web 打印任务的输出文档。
  69599. * @param {string} jobId - Web 打印输入文档任务 ID。
  69600. */
  69601. getPrintingJobResult(jobId, callback) {
  69602. this.processAsync(`jobs/${jobId}/result`, 'GET', callback);
  69603. }
  69604. /**
  69605. * @function WebPrintingService.prototype.getLayoutTemplates
  69606. * @description 查询 Web 打印服务所有可用的模板信息。
  69607. */
  69608. getLayoutTemplates(callback) {
  69609. this.processAsync('layouts', 'GET', callback);
  69610. }
  69611. /**
  69612. * @function WebPrintingService.prototype.rollingProcess
  69613. * @description 轮询查询 Web 打印任务。
  69614. * @param {Object} result - 服务器返回的结果对象。
  69615. */
  69616. rollingProcess(result, url, callback) {
  69617. var me = this;
  69618. if (!result) {
  69619. return;
  69620. }
  69621. var id = setInterval(function () {
  69622. let eventId = ++me.eventCount;
  69623. let eventListeners = {
  69624. scope: this,
  69625. processCompleted: function(result) {
  69626. if (eventId === result.result.eventId && callback) {
  69627. delete result.result.eventId;
  69628. callback(result);
  69629. me.events.un(eventListeners);
  69630. return false;
  69631. }
  69632. },
  69633. processFailed: function(result) {
  69634. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  69635. callback(result);
  69636. me.events.un(eventListeners);
  69637. return false;
  69638. }
  69639. }
  69640. }
  69641. me.events.on(eventListeners);
  69642. me.request({
  69643. url,
  69644. method: 'GET',
  69645. scope: me,
  69646. success: function (result, options) {
  69647. result.eventId = eventId;
  69648. switch (result.status) {
  69649. case 'FINISHED':
  69650. clearInterval(id);
  69651. me.serviceProcessCompleted(result, options);
  69652. break;
  69653. case 'ERROR':
  69654. clearInterval(id);
  69655. me.serviceProcessFailed(result, options);
  69656. break;
  69657. case 'RUNNING':
  69658. me.events.triggerEvent('processRunning', result);
  69659. break;
  69660. }
  69661. },
  69662. failure: me.serviceProcessFailed
  69663. });
  69664. }, 1000);
  69665. }
  69666. processAsync(url, method, callback, params) {
  69667. let eventId = ++this.eventCount;
  69668. let eventListeners = {
  69669. scope: this,
  69670. processCompleted: function(result) {
  69671. if (eventId === result.result.eventId && callback) {
  69672. delete result.result.eventId;
  69673. callback(result);
  69674. this.events && this.events.un(eventListeners);
  69675. return false;
  69676. }
  69677. },
  69678. processFailed: function(result) {
  69679. if (eventId === result.error.eventId || eventId === result.eventId) {
  69680. callback(result);
  69681. this.events && this.events.un(eventListeners);
  69682. return false;
  69683. }
  69684. }
  69685. }
  69686. this.events.on(eventListeners);
  69687. var me = this;
  69688. let requestConfig = {
  69689. url: me._processUrl(url),
  69690. method,
  69691. scope: me,
  69692. success(result, options) {
  69693. result.eventId = eventId;
  69694. this.serviceProcessCompleted(result, options);
  69695. },
  69696. failure(result, options) {
  69697. if (result.error) {
  69698. result.error.eventId = eventId;
  69699. }
  69700. result.eventId = eventId;
  69701. this.serviceProcessFailed(result, options);
  69702. }
  69703. };
  69704. params && (requestConfig.data = Util_Util.toJSON(params));
  69705. me.request(requestConfig);
  69706. }
  69707. _processUrl(appendContent) {
  69708. if (appendContent) {
  69709. return Util_Util.urlPathAppend(this.url, appendContent);
  69710. }
  69711. return this.url;
  69712. }
  69713. }
  69714. ;// CONCATENATED MODULE: ./src/mapboxgl/services/WebPrintingJobService.js
  69715. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69716. * This program are made available under the terms of the Apache License, Version 2.0
  69717. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69718. /**
  69719. * @class WebPrintingJobService
  69720. * @category iServer WebPrintingJob
  69721. * @version 10.1.0
  69722. * @classdesc Web 打印服务类。
  69723. * 提供:创建 Web 打印任务,获取 Web 打印任务内容,获取 Web 打印输出文档流,获取 Web 打印服务的布局模板信息。
  69724. * @modulecategory Services
  69725. * @extends {ServiceBase}
  69726. * @param {string} url - 资源根地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  69727. * @param {Object} options - 参数。
  69728. * @param {string} [options.proxy] - 服务代理地址。
  69729. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  69730. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69731. * @param {Object} [options.headers] - 请求头。
  69732. * @example
  69733. * new WebPrintingJobService(url)
  69734. * .createWebPrintingJob(param,function(result){
  69735. * //doSomething
  69736. * })
  69737. * @usage
  69738. */
  69739. class WebPrintingJobService extends ServiceBase {
  69740. constructor(url, options) {
  69741. super(url, options);
  69742. this._webPrintingService = new WebPrintingService(url, options);
  69743. }
  69744. /**
  69745. * @function WebPrintingJobService.prototype.createWebPrintingJob
  69746. * @description 创建 Web 打印任务。
  69747. * @param {WebPrintingJobParameters} params - Web 打印参数类。
  69748. * @param {RequestCallback} callback - 回调函数。
  69749. */
  69750. createWebPrintingJob(params, callback) {
  69751. if (!params) {
  69752. return;
  69753. }
  69754. this._webPrintingService.createWebPrintingJob(this._processParams(params), callback);
  69755. }
  69756. /**
  69757. * @function WebPrintingJobService.prototype.getPrintingJob
  69758. * @description 获取 Web 打印输出文档任务。
  69759. * @param {string} jobId - Web 打印输入文档任务 ID。
  69760. * @param {RequestCallback} callback - 回调函数。
  69761. */
  69762. getPrintingJob(jobId, callback) {
  69763. this._webPrintingService.getPrintingJob(jobId, callback);
  69764. }
  69765. /**
  69766. * @function WebPrintingJobService.prototype.getPrintingJobResult
  69767. * @description 获取 Web 打印任务的输出文档。
  69768. * @param {string} jobId - Web 打印输入文档任务 ID。
  69769. * @param {RequestCallback} callback - 回调函数。
  69770. */
  69771. getPrintingJobResult(jobId, callback) {
  69772. this._webPrintingService.getPrintingJobResult(jobId, callback);
  69773. }
  69774. /**
  69775. * @function WebPrintingJobService.prototype.getLayoutTemplates
  69776. * @description 查询 Web 打印服务所有可用的模板信息。
  69777. * @param {RequestCallback} callback - 回调函数。
  69778. */
  69779. getLayoutTemplates(callback) {
  69780. this._webPrintingService.getLayoutTemplates(callback);
  69781. }
  69782. _processParams(params) {
  69783. if (params.layoutOptions && params.layoutOptions.littleMapOptions) {
  69784. params.layoutOptions.littleMapOptions.center = this._toPointObject(params.layoutOptions.littleMapOptions.center);
  69785. }
  69786. if (params.exportOptions) {
  69787. params.exportOptions.center = this._toPointObject(params.exportOptions.center);
  69788. }
  69789. return params;
  69790. }
  69791. _toPointObject(point) {
  69792. if (core_Util_Util.isArray(point)) {
  69793. return {
  69794. x: point[0],
  69795. y: point[1]
  69796. };
  69797. } else if (point instanceof Point || point instanceof (external_mapboxgl_default()).Point) {
  69798. return {
  69799. x: point.x,
  69800. y: point.y
  69801. };
  69802. } else if (point instanceof (external_mapboxgl_default()).LngLat) {
  69803. return {
  69804. x: point.lng,
  69805. y: point.lat
  69806. };
  69807. }
  69808. return point;
  69809. }
  69810. }
  69811. ;// CONCATENATED MODULE: ./src/common/iServer/ImageService.js
  69812. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69813. * This program are made available under the terms of the Apache License, Version 2.0
  69814. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69815. /**
  69816. * @class ImageService
  69817. * @deprecatedclass SuperMap.ImageService
  69818. * @classdesc 影像服务类。
  69819. * @version 10.2.0
  69820. * @category iServer Image
  69821. * @param {string} url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
  69822. * @param {Object} options - 可选参数。
  69823. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69824. * @param {Object} [options.headers] - 请求头。
  69825. * @extends {CommonServiceBase}
  69826. * @usage
  69827. */
  69828. class ImageService_ImageService extends CommonServiceBase {
  69829. constructor(url, options) {
  69830. super(url, options);
  69831. this.options = options || {};
  69832. if (options) {
  69833. Util_Util.extend(this, options);
  69834. }
  69835. this.eventCount = 0;
  69836. this.CLASS_NAME = 'SuperMap.ImageService';
  69837. }
  69838. /**
  69839. * @function ImageService.prototype.destroy
  69840. * @override
  69841. */
  69842. destroy() {
  69843. super.destroy();
  69844. }
  69845. /**
  69846. * @function ImageService.prototype.getCollections
  69847. * @description 返回当前影像服务中的影像集合列表(Collections)。
  69848. */
  69849. getCollections(callback) {
  69850. var me = this;
  69851. var path = Util_Util.convertPath('/collections');
  69852. var url = Util_Util.urlPathAppend(me.url, path);
  69853. this._processAsync({ url, mehtod: 'GET', callback });
  69854. }
  69855. /**
  69856. * @function ImageService.prototype.getCollectionByID
  69857. * @description ID值等于`collectionId`参数值的影像集合(Collection)。ID值用于在服务中唯一标识该影像集合。
  69858. * @param {string} collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
  69859. */
  69860. getCollectionByID(collectionId, callback) {
  69861. var pathParams = {
  69862. collectionId: collectionId
  69863. };
  69864. var me = this;
  69865. var path = Util_Util.convertPath('/collections/{collectionId}', pathParams);
  69866. var url = Util_Util.urlPathAppend(me.url, path);
  69867. this._processAsync({ url, mehtod: 'GET', callback });
  69868. }
  69869. /**
  69870. * @function ImageSearchService.prototype.search
  69871. * @description 查询与过滤条件匹配的影像数据。
  69872. * @param {ImageSearchParameter} [imageSearchParameter] 查询参数。
  69873. */
  69874. search(imageSearchParameter, callback) {
  69875. var postBody = { ...(imageSearchParameter || {}) };
  69876. var me = this;
  69877. var path = Util_Util.convertPath('/search');
  69878. var url = Util_Util.urlPathAppend(me.url, path);
  69879. this._processAsync({ url, method: 'POST', data: postBody, callback });
  69880. }
  69881. _processAsync({ url, method, callback, data }) {
  69882. let eventId = ++this.eventCount;
  69883. let me = this;
  69884. let eventListeners = {
  69885. scope: this,
  69886. processCompleted: function (result) {
  69887. if (eventId === result.result.eventId && callback) {
  69888. delete result.result.eventId;
  69889. callback(result);
  69890. this.events && this.events.un(eventListeners);
  69891. return false;
  69892. }
  69893. },
  69894. processFailed: function (result) {
  69895. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  69896. callback(result);
  69897. this.events && this.events.un(eventListeners);
  69898. return false;
  69899. }
  69900. }
  69901. };
  69902. this.events.on(eventListeners);
  69903. this.request({
  69904. method: method || 'GET',
  69905. url,
  69906. data,
  69907. scope: this,
  69908. success(result, options) {
  69909. result.eventId = eventId;
  69910. me.serviceProcessCompleted(result, options);
  69911. },
  69912. failure(result, options) {
  69913. if (result.error) {
  69914. result.error.eventId = eventId;
  69915. }
  69916. result.eventId = eventId;
  69917. me.serviceProcessFailed(result, options);
  69918. }
  69919. });
  69920. }
  69921. }
  69922. ;// CONCATENATED MODULE: ./src/mapboxgl/services/ImageService.js
  69923. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69924. * This program are made available under the terms of the Apache License, Version 2.0
  69925. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69926. /**
  69927. * @class ImageService
  69928. * @version 10.2.0
  69929. * @constructs ImageService
  69930. * @classdesc 影像服务类。
  69931. * @category iServer Image
  69932. * @modulecategory Services
  69933. * @example
  69934. * new ImageService(url,options)
  69935. * .getCollections(function(result){
  69936. * //doSomething
  69937. * })
  69938. * @param {string} url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
  69939. * @param {Object} options - 参数。
  69940. * @param {string} [options.proxy] - 服务代理地址。
  69941. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  69942. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69943. * @param {Object} [options.headers] - 请求头。
  69944. * @extends {ServiceBase}
  69945. * @usage
  69946. */
  69947. class ImageService extends ServiceBase {
  69948. constructor(url, options) {
  69949. super(url, options);
  69950. this._imageService = new ImageService_ImageService(this.url, {
  69951. proxy: this.options.proxy,
  69952. withCredentials: this.options.withCredentials,
  69953. crossOrigin: this.options.crossOrigin,
  69954. headers: this.options.headers
  69955. });
  69956. }
  69957. /**
  69958. * @function ImageService.prototype.getCollections
  69959. * @description 返回当前影像服务中的影像集合列表(Collections)。
  69960. * @param {RequestCallback} callback - 回调函数。
  69961. */
  69962. getCollections(callback) {
  69963. this._imageService.getCollections(callback);
  69964. }
  69965. /**
  69966. * @function ImageService.prototype.getCollectionByID
  69967. * @description ID值等于`collectionId`参数值的影像集合(Collection)。ID值用于在服务中唯一标识该影像集合。
  69968. * @param {string} collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
  69969. * @param {RequestCallback} callback - 回调函数。
  69970. */
  69971. getCollectionByID(collectionId, callback) {
  69972. this._imageService.getCollectionByID(collectionId, callback);
  69973. }
  69974. /**
  69975. * @function ImageService.prototype.search
  69976. * @description 查询与过滤条件匹配的影像数据。
  69977. * @param {ImageSearchParameter} [itemSearch] 影像服务查询参数类。
  69978. * @param {RequestCallback} callback - 回调函数。
  69979. */
  69980. search(itemSearch, callback) {
  69981. this._imageService.search(itemSearch, callback);
  69982. }
  69983. }
  69984. ;// CONCATENATED MODULE: ./src/common/iServer/ImageCollectionService.js
  69985. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69986. * This program are made available under the terms of the Apache License, Version 2.0
  69987. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69988. /**
  69989. * @class ImageCollectionService
  69990. * @deprecatedclass SuperMap.ImageCollectionService
  69991. * @classdesc 影像集合服务类。
  69992. * @version 10.2.0
  69993. * @category iServer Image
  69994. * @param {string} url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
  69995. * @param {Object} options - 参数。
  69996. * @param {string} options.collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
  69997. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69998. * @param {Object} [options.headers] - 请求头。
  69999. * @extends {CommonServiceBase}
  70000. * @usage
  70001. */
  70002. class ImageCollectionService_ImageCollectionService extends CommonServiceBase {
  70003. constructor(url, options) {
  70004. super(url, options);
  70005. this.options = options || {};
  70006. if (options) {
  70007. Util_Util.extend(this, options);
  70008. }
  70009. this.eventCount = 0;
  70010. this.CLASS_NAME = 'SuperMap.ImageCollectionService';
  70011. }
  70012. /**
  70013. * @function ImageCollectionService.prototype.destroy
  70014. * @override
  70015. */
  70016. destroy() {
  70017. super.destroy();
  70018. }
  70019. /**
  70020. * @function ImageCollectionService.prototype.getLegend
  70021. * @description 返回当前影像集合的图例信息。默认为服务发布所配置的风格,支持根据风格参数生成新的图例。
  70022. * @param {Object} queryParams query参数。
  70023. * @param {ImageRenderingRule} [queryParams.renderingRule] renderingRule 对象,用来指定影像的渲染风格,从而确定图例内容。影像的渲染风格包含拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。该参数未设置时,将使用发布服务时所配置的风格。
  70024. */
  70025. getLegend(queryParams, callback) {
  70026. var me = this;
  70027. var pathParams = {
  70028. collectionId: me.options.collectionId
  70029. };
  70030. var path = Util_Util.convertPath('/collections/{collectionId}/legend', pathParams);
  70031. var url = Util_Util.urlPathAppend(me.url, path);
  70032. this._processAsync({ url, method: 'GET', params: queryParams, callback });
  70033. }
  70034. /**
  70035. * @function ImageCollectionService.prototype.getStatistics
  70036. * @description 返回当前影像集合的统计信息。包括文件数量,文件大小等信息。
  70037. */
  70038. getStatistics(callback) {
  70039. var me = this;
  70040. var pathParams = {
  70041. collectionId: me.options.collectionId
  70042. };
  70043. var path = Util_Util.convertPath('/collections/{collectionId}/statistics', pathParams);
  70044. var url = Util_Util.urlPathAppend(me.url, path);
  70045. this._processAsync({ url, method: 'GET', callback });
  70046. }
  70047. /**
  70048. * @function ImageCollectionService.prototype.getTileInfo
  70049. * @description 返回影像集合所提供的服务瓦片的信息,包括:每层瓦片的分辨率,比例尺等信息,方便前端进行图层叠加。
  70050. */
  70051. getTileInfo(callback) {
  70052. var me = this;
  70053. var pathParams = {
  70054. collectionId: me.options.collectionId
  70055. };
  70056. var path = Util_Util.convertPath('/collections/{collectionId}/tileInfo', pathParams);
  70057. var url = Util_Util.urlPathAppend(me.url, path);
  70058. this._processAsync({ url, method: 'GET', callback });
  70059. }
  70060. /**
  70061. * @function ImageCollectionService.prototype.deleteItemByID
  70062. * @description 删除影像集合中指定 ID 的 Item,即从影像集合中删除指定的影像。
  70063. * @param {string} featureId Feature 的本地标识符。
  70064. */
  70065. deleteItemByID(featureId, callback) {
  70066. var me = this;
  70067. var pathParams = {
  70068. collectionId: me.options.collectionId,
  70069. featureId: featureId
  70070. };
  70071. var path = Util_Util.convertPath('/collections/{collectionId}/items/{featureId}', pathParams);
  70072. var url = Util_Util.urlPathAppend(me.url, path);
  70073. this._processAsync({ url, method: 'DELETE', callback });
  70074. }
  70075. /**
  70076. * @function ImageCollectionService.prototype.getItemByID
  70077. * @description 返回指定ID(`collectionId`)的影像集合中的指定ID(`featureId`)的Item对象,即返回影像集合中指定的影像。
  70078. * @param {string} featureId Feature 的本地标识符。
  70079. */
  70080. getItemByID(featureId, callback) {
  70081. var me = this;
  70082. var pathParams = {
  70083. collectionId: me.options.collectionId,
  70084. featureId: featureId
  70085. };
  70086. var path = Util_Util.convertPath('/collections/{collectionId}/items/{featureId}', pathParams);
  70087. var url = Util_Util.urlPathAppend(me.url, path);
  70088. this._processAsync({ url, method: 'GET', callback });
  70089. }
  70090. _processAsync({ url, method, callback, params}) {
  70091. let eventId = ++this.eventCount;
  70092. let eventListeners = {
  70093. scope: this,
  70094. processCompleted: function(result) {
  70095. if (eventId === result.result.eventId && callback) {
  70096. delete result.result.eventId;
  70097. callback(result);
  70098. this.events && this.events.un(eventListeners);
  70099. return false;
  70100. }
  70101. },
  70102. processFailed: function(result) {
  70103. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  70104. callback(result);
  70105. this.events && this.events.un(eventListeners);
  70106. return false;
  70107. }
  70108. }
  70109. }
  70110. this.events.on(eventListeners);
  70111. this.request({
  70112. method: method || 'GET',
  70113. url,
  70114. params,
  70115. scope: this,
  70116. success(result, options) {
  70117. result.eventId = eventId;
  70118. this.serviceProcessCompleted(result, options);
  70119. },
  70120. failure(result, options) {
  70121. if (result.error) {
  70122. result.error.eventId = eventId;
  70123. }
  70124. result.eventId = eventId;
  70125. this.serviceProcessFailed(result, options);
  70126. }
  70127. });
  70128. }
  70129. }
  70130. ;// CONCATENATED MODULE: ./src/mapboxgl/services/ImageCollectionService.js
  70131. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  70132. * This program are made available under the terms of the Apache License, Version 2.0
  70133. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  70134. /**
  70135. * @class ImageCollectionService
  70136. * @version 10.2.0
  70137. * @constructs ImageCollectionService
  70138. * @classdesc 影像集合服务类。
  70139. * @category iServer Image
  70140. * @modulecategory Services
  70141. * @extends {ServiceBase}
  70142. * @example
  70143. * new ImageCollectionService(url,options)
  70144. * .getLegend(collectionId, queryParams, function(result){
  70145. * //doSomething
  70146. * })
  70147. * @param {string} url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
  70148. * @param {Object} options - 参数。
  70149. * @param {string} options.collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
  70150. * @param {string} [options.proxy] - 服务代理地址。
  70151. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  70152. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  70153. * @param {Object} [options.headers] - 请求头。
  70154. * @usage
  70155. */
  70156. class ImageCollectionService extends ServiceBase {
  70157. constructor(url, options) {
  70158. super(url, options);
  70159. this._imageCollectionService = new ImageCollectionService_ImageCollectionService(this.url, {
  70160. collectionId: this.options.collectionId,
  70161. proxy: this.options.proxy,
  70162. withCredentials: this.options.withCredentials,
  70163. crossOrigin: this.options.crossOrigin,
  70164. headers: this.options.headers
  70165. });
  70166. }
  70167. /**
  70168. * @function ImageCollectionService.prototype.getLegend
  70169. * @param {Object} queryParams query参数。
  70170. * @param {ImageRenderingRule} [queryParams.renderingRule] 指定影像显示的风格,包含拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。不指定时,使用发布服务时所配置的风格。
  70171. * @param {RequestCallback} callback - 回调函数。
  70172. */
  70173. getLegend(queryParams, callback) {
  70174. this._imageCollectionService.getLegend(queryParams, callback);
  70175. }
  70176. /**
  70177. * @function ImageCollectionService.prototype.getStatistics
  70178. * @description 返回当前影像集合的统计信息。包括文件数量,文件大小等信息。
  70179. * @param {RequestCallback} callback - 回调函数。
  70180. */
  70181. getStatistics(callback) {
  70182. this._imageCollectionService.getStatistics(callback);
  70183. }
  70184. /**
  70185. * @function ImageCollectionService.prototype.getTileInfo
  70186. * @description 返回影像集合所提供的服务瓦片的信息,包括:每层瓦片的分辨率,比例尺等信息,方便前端进行图层叠加。
  70187. * @param {RequestCallback} callback - 回调函数。
  70188. */
  70189. getTileInfo(callback) {
  70190. this._imageCollectionService.getTileInfo(callback);
  70191. }
  70192. /**
  70193. * @function ImageCollectionService.prototype.deleteItemByID
  70194. * @description 删除影像集合中指定ID (`featureId`) 的Item对象,即从影像集合中删除指定的影像。
  70195. * @param {string} featureId Feature 的本地标识符。
  70196. * @param {RequestCallback} callback - 回调函数。
  70197. */
  70198. deleteItemByID(featureId, callback) {
  70199. this._imageCollectionService.deleteItemByID(featureId, callback);
  70200. }
  70201. /**
  70202. * @function ImageCollectionService.prototype.getItemByID
  70203. * @description 返回影像集合中的指定ID(`featureId`)的Item对象,即返回影像集合中指定的影像。
  70204. * @param {string} featureId Feature 的本地标识符。
  70205. * @param {RequestCallback} callback - 回调函数。
  70206. */
  70207. getItemByID(featureId, callback) {
  70208. this._imageCollectionService.getItemByID(featureId, callback);
  70209. }
  70210. }
  70211. ;// CONCATENATED MODULE: ./src/mapboxgl/services/index.js
  70212. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  70213. * This program are made available under the terms of the Apache License, Version 2.0
  70214. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  70215. ;// CONCATENATED MODULE: ./src/common/SuperMap.js
  70216. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  70217. * This program are made available under the terms of the Apache License, Version 2.0
  70218. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  70219. var SuperMap = window.SuperMap = window.SuperMap || {};
  70220. SuperMap.Components = window.SuperMap.Components || {};
  70221. ;// CONCATENATED MODULE: ./src/common/format/WKT.js
  70222. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  70223. * This program are made available under the terms of the Apache License, Version 2.0
  70224. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  70225. /**
  70226. * @class WKTFormat
  70227. * @aliasclass Format.WKT
  70228. * @deprecatedclass SuperMap.Format.WKT
  70229. * @classdesc 用于读写常见文本的类。通过 {@link WKTFormat} 构造器来创建一个新的实例。
  70230. * @category BaseTypes Format
  70231. * @extends {Format}
  70232. * @param {Object} options - 可选的选项对象,其属性将被设置到实例。option 具体配置项继承自 {@link Format}。
  70233. * @usage
  70234. */
  70235. class WKT extends Format {
  70236. constructor(options) {
  70237. super(options);
  70238. this.regExes = {
  70239. 'typeStr': /^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,
  70240. 'spaces': /\s+/,
  70241. 'parenComma': /\)\s*,\s*\(/,
  70242. 'doubleParenComma': /\)\s*\)\s*,\s*\(\s*\(/, // can't use {2} here
  70243. 'trimParens': /^\s*\(?(.*?)\)?\s*$/
  70244. };
  70245. this.CLASS_NAME = "SuperMap.Format.WKT"; /**
  70246. * @private
  70247. * @description Object with properties corresponding to the geometry types.
  70248. * Property values are functions that do the actual data extraction.
  70249. */
  70250. this.extract = {
  70251. /**
  70252. * @description Return a space delimited string of point coordinates.
  70253. * @param {GeometryPoint} point
  70254. * @returns {string} A string of coordinates representing the point
  70255. */
  70256. 'point': function (point) {
  70257. return point.x + ' ' + point.y;
  70258. },
  70259. /**
  70260. * @description Return a comma delimited string of point coordinates from a multipoint.
  70261. * @param {GeometryMultiPoint} multipoint
  70262. * @returns {string} A string of point coordinate strings representing
  70263. * the multipoint
  70264. */
  70265. 'multipoint'(multipoint) {
  70266. var array = [];
  70267. for (var i = 0, len = multipoint.components.length; i < len; ++i) {
  70268. array.push('(' +
  70269. this.extract.point.apply(this, [multipoint.components[i]]) +
  70270. ')');
  70271. }
  70272. return array.join(',');
  70273. },
  70274. /**
  70275. * @description Return a comma delimited string of point coordinates from a line.
  70276. * @param {GeometryLineString} linestring
  70277. * @returns {string} A string of point coordinate strings representing
  70278. * the linestring
  70279. */
  70280. 'linestring'(linestring) {
  70281. var array = [];
  70282. for (var i = 0, len = linestring.components.length; i < len; ++i) {
  70283. array.push(this.extract.point.apply(this, [linestring.components[i]]));
  70284. }
  70285. return array.join(',');
  70286. },
  70287. /**
  70288. * @description Return a comma delimited string of linestring strings from a multilinestring.
  70289. * @param {GeometryMultiLineString} multilinestring
  70290. * @returns {string} A string of of linestring strings representing
  70291. * the multilinestring
  70292. */
  70293. 'multilinestring'(multilinestring) {
  70294. var array = [];
  70295. for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
  70296. array.push('(' +
  70297. this.extract.linestring.apply(this, [multilinestring.components[i]]) +
  70298. ')');
  70299. }
  70300. return array.join(',');
  70301. },
  70302. /**
  70303. * @description Return a comma delimited string of linear ring arrays from a polygon.
  70304. * @param {GeometryPolygon} polygon
  70305. * @returns {string} An array of linear ring arrays representing the polygon
  70306. */
  70307. 'polygon'(polygon) {
  70308. var array = [];
  70309. for (var i = 0, len = polygon.components.length; i < len; ++i) {
  70310. array.push('(' +
  70311. this.extract.linestring.apply(this, [polygon.components[i]]) +
  70312. ')');
  70313. }
  70314. return array.join(',');
  70315. },
  70316. /**
  70317. * @description Return an array of polygon arrays from a multipolygon.
  70318. * @param {GeometryMultiPolygon} multipolygon
  70319. * @returns {string} An array of polygon arrays representing
  70320. * the multipolygon
  70321. */
  70322. 'multipolygon'(multipolygon) {
  70323. var array = [];
  70324. for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
  70325. array.push('(' +
  70326. this.extract.polygon.apply(this, [multipolygon.components[i]]) +
  70327. ')');
  70328. }
  70329. return array.join(',');
  70330. },
  70331. /**
  70332. * @description Return the WKT portion between 'GEOMETRYCOLLECTION(' and ')' for an <GeometryCollection>
  70333. * @param {GeometryCollection} collection
  70334. * @returns {string} internal WKT representation of the collection
  70335. */
  70336. 'collection'(collection) {
  70337. var array = [];
  70338. for (var i = 0, len = collection.components.length; i < len; ++i) {
  70339. array.push(this.extractGeometry.apply(this, [collection.components[i]]));
  70340. }
  70341. return array.join(',');
  70342. }
  70343. };
  70344. /**
  70345. * @private
  70346. * @description Object with properties corresponding to the geometry types.
  70347. * Property values are functions that do the actual parsing.
  70348. */
  70349. this.parse = {
  70350. /**
  70351. * @private
  70352. * @description Return point feature given a point WKT fragment.
  70353. * @param {string} str A WKT fragment representing the point
  70354. * @returns {FeatureVector} A point feature
  70355. *
  70356. */
  70357. 'point': function (str) {
  70358. var coords = StringExt.trim(str).split(this.regExes.spaces);
  70359. return new Vector(new Point(coords[0], coords[1])
  70360. );
  70361. },
  70362. /**
  70363. * @description Return a multipoint feature given a multipoint WKT fragment.
  70364. * @param {string} A WKT fragment representing the multipoint
  70365. * @returns {FeatureVector} A multipoint feature
  70366. * @private
  70367. */
  70368. 'multipoint': function (str) {
  70369. var point;
  70370. var points = StringExt.trim(str).split(',');
  70371. var components = [];
  70372. for (var i = 0, len = points.length; i < len; ++i) {
  70373. point = points[i].replace(this.regExes.trimParens, '$1');
  70374. components.push(this.parse.point.apply(this, [point]).geometry);
  70375. }
  70376. return new Vector(
  70377. new MultiPoint(components)
  70378. );
  70379. },
  70380. /**
  70381. * @description Return a linestring feature given a linestring WKT fragment.
  70382. * @param {string} A WKT fragment representing the linestring
  70383. * @returns {FeatureVector} A linestring feature
  70384. * @private
  70385. */
  70386. 'linestring': function (str) {
  70387. var points = StringExt.trim(str).split(',');
  70388. var components = [];
  70389. for (var i = 0, len = points.length; i < len; ++i) {
  70390. components.push(this.parse.point.apply(this, [points[i]]).geometry);
  70391. }
  70392. return new Vector(
  70393. new LineString(components)
  70394. );
  70395. },
  70396. /**
  70397. * @description Return a multilinestring feature given a multilinestring WKT fragment.
  70398. * @param {string} A WKT fragment representing the multilinestring
  70399. * @returns {FeatureVector} A multilinestring feature
  70400. * @private
  70401. */
  70402. 'multilinestring': function (str) {
  70403. var line;
  70404. var lines = StringExt.trim(str).split(this.regExes.parenComma);
  70405. var components = [];
  70406. for (var i = 0, len = lines.length; i < len; ++i) {
  70407. line = lines[i].replace(this.regExes.trimParens, '$1');
  70408. components.push(this.parse.linestring.apply(this, [line]).geometry);
  70409. }
  70410. return new Vector(
  70411. new MultiLineString(components)
  70412. );
  70413. },
  70414. /**
  70415. * @description Return a polygon feature given a polygon WKT fragment.
  70416. * @param {string} A WKT fragment representing the polygon
  70417. * @returns {FeatureVector} A polygon feature
  70418. * @private
  70419. */
  70420. 'polygon': function (str) {
  70421. var ring, linestring, linearring;
  70422. var rings = StringExt.trim(str).split(this.regExes.parenComma);
  70423. var components = [];
  70424. for (var i = 0, len = rings.length; i < len; ++i) {
  70425. ring = rings[i].replace(this.regExes.trimParens, '$1');
  70426. linestring = this.parse.linestring.apply(this, [ring]).geometry;
  70427. linearring = new LinearRing_LinearRing(linestring.components);
  70428. components.push(linearring);
  70429. }
  70430. return new Vector(
  70431. new Polygon_Polygon(components)
  70432. );
  70433. },
  70434. /**
  70435. * @private
  70436. * @description Return a multipolygon feature given a multipolygon WKT fragment.
  70437. * @param {string} A WKT fragment representing the multipolygon
  70438. * @returns {FeatureVector} A multipolygon feature
  70439. *
  70440. */
  70441. 'multipolygon': function (str) {
  70442. var polygon;
  70443. var polygons = StringExt.trim(str).split(this.regExes.doubleParenComma);
  70444. var components = [];
  70445. for (var i = 0, len = polygons.length; i < len; ++i) {
  70446. polygon = polygons[i].replace(this.regExes.trimParens, '$1');
  70447. components.push(this.parse.polygon.apply(this, [polygon]).geometry);
  70448. }
  70449. return new Vector(
  70450. new MultiPolygon(components)
  70451. );
  70452. },
  70453. /**
  70454. * @description Return an array of features given a geometrycollection WKT fragment.
  70455. * @param {string} A WKT fragment representing the geometrycollection
  70456. * @returns {Array} An array of FeatureVector
  70457. * @private
  70458. */
  70459. 'geometrycollection': function (str) {
  70460. // separate components of the collection with |
  70461. str = str.replace(/,\s*([A-Za-z])/g, '|$1');
  70462. var wktArray = StringExt.trim(str).split('|');
  70463. var components = [];
  70464. for (var i = 0, len = wktArray.length; i < len; ++i) {
  70465. components.push(this.read(wktArray[i]));
  70466. }
  70467. return components;
  70468. }
  70469. };
  70470. }
  70471. /**
  70472. * @function WKTFormat.prototype.read
  70473. * @description 反序列化 WKT 字符串并返回向量特征或向量特征数组。支持 POINT、MULTIPOINT、LINESTRING、MULTILINESTRING、POLYGON、MULTIPOLYGON 和 GEOMETRYCOLLECTION 的 WKT。
  70474. * @param {string} wkt - WKT 字符串。
  70475. * @returns {FeatureVector|Array} GEOMETRYCOLLECTION WKT 的矢量要素或者矢量要素数组。
  70476. */
  70477. read(wkt) {
  70478. var features, type, str;
  70479. wkt = wkt.replace(/[\n\r]/g, " ");
  70480. var matches = this.regExes.typeStr.exec(wkt);
  70481. if (matches) {
  70482. type = matches[1].toLowerCase();
  70483. str = matches[2];
  70484. if (this.parse[type]) {
  70485. features = this.parse[type].apply(this, [str]);
  70486. }
  70487. }
  70488. return features;
  70489. }
  70490. /**
  70491. * @function WKTFormat.prototype.write
  70492. * @description 将矢量要素或矢量要素数组序列化为 WKT 字符串。
  70493. * @param {(FeatureVector|Array)} features - 矢量要素或矢量要素数组。
  70494. * @returns {string} 表示几何的 WKT 字符串。
  70495. */
  70496. write(features) {
  70497. var collection, geometry, isCollection;
  70498. if (features.constructor === Array) {
  70499. collection = features;
  70500. isCollection = true;
  70501. } else {
  70502. collection = [features];
  70503. isCollection = false;
  70504. }
  70505. var pieces = [];
  70506. if (isCollection) {
  70507. pieces.push('GEOMETRYCOLLECTION(');
  70508. }
  70509. for (var i = 0, len = collection.length; i < len; ++i) {
  70510. if (isCollection && i > 0) {
  70511. pieces.push(',');
  70512. }
  70513. geometry = collection[i].geometry;
  70514. pieces.push(this.extractGeometry(geometry));
  70515. }
  70516. if (isCollection) {
  70517. pieces.push(')');
  70518. }
  70519. return pieces.join('');
  70520. }
  70521. /**
  70522. * @function WKTFormat.prototype.extractGeometry
  70523. * @description 为单个 Geometry 对象构造 WKT 的入口点。
  70524. * @param {Geometry} geometry - Geometry 对象。
  70525. * @returns {string} 表示几何的 WKT 字符串。
  70526. */
  70527. extractGeometry(geometry) {
  70528. var type = geometry.CLASS_NAME.split('.')[2].toLowerCase();
  70529. if (!this.extract[type]) {
  70530. return null;
  70531. }
  70532. var wktType = type === 'collection' ? 'GEOMETRYCOLLECTION' : type.toUpperCase();
  70533. var data = wktType + '(' + this.extract[type].apply(this, [geometry]) + ')';
  70534. return data;
  70535. }
  70536. }
  70537. ;// CONCATENATED MODULE: ./src/common/format/index.js
  70538. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  70539. * This program are made available under the terms of the Apache License, Version 2.0
  70540. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  70541. ;// CONCATENATED MODULE: ./src/common/control/TimeControlBase.js
  70542. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  70543. * This program are made available under the terms of the Apache License, Version 2.0
  70544. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  70545. /**
  70546. * @class TimeControlBase
  70547. * @deprecatedclass SuperMap.TimeControlBase
  70548. * @classdesc 时间控制基类。
  70549. * @modulecategory Control
  70550. * @category Control
  70551. * @param {Object} options - 可选参数。
  70552. * @param {number} [options.speed=1] - 速度。不能小于 0,(每帧渲染的数据之间的间隔为1),设置越大速度越快。
  70553. * @param {number} [options.frequency=1000] - 刷新频率(单位 ms),服务器刷新的时间间隔。
  70554. * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
  70555. * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时以当前时间进行设置,建议设置。
  70556. * @param {boolean} [options.repeat=true] - 是否重复循环。
  70557. * @param {boolean} [options.reverse=false] - 是否反向。
  70558. * @usage
  70559. */
  70560. class TimeControlBase {
  70561. constructor(options) {
  70562. //设置步长,刷新频率、开始结束时间、是否循环、是否反向
  70563. var me = this;
  70564. options = options || {};
  70565. /**
  70566. * @member {number} [TimeControlBase.prototype.speed=1]
  70567. * @description 步长,必须为非负数,默认为1(表示前后两次渲染的数据之间的间隔为1)。
  70568. */
  70569. this.speed = (options.speed && options.speed >= 0) ? options.speed : 1;
  70570. /**
  70571. * @member {number} [TimeControlBase.prototype.frequency=1000]
  70572. * @description 刷新频率(单位ms),服务器刷新的时间间隔。
  70573. */
  70574. this.frequency = (options.speed && options.frequency >= 0) ? options.frequency : 1000;
  70575. /**
  70576. * @member {number} [TimeControlBase.prototype.startTime=0]
  70577. * @description 记录的起始时间,必须为数字,
  70578. * 如果不设置,初始化时为0,建议设置。
  70579. */
  70580. this.startTime = (options.startTime && options.startTime != null) ? options.startTime : 0;
  70581. /**
  70582. * @member {number} TimeControlBase.prototype.endTime
  70583. * @description 记录的结束时间,必须为数字,
  70584. * 如果不设置,初始化时以当前时间进行设置,建议设置。
  70585. */
  70586. this.endTime = (options.endTime && options.endTime != null && options.endTime >= me.startTime) ? options.endTime : +new Date();
  70587. /**
  70588. * @member {boolean} [TimeControlBase.prototype.repeat=true]
  70589. * @description 是否重复循环。
  70590. */
  70591. this.repeat = (options.repeat !== undefined) ? options.repeat : true;
  70592. /**
  70593. * @member {boolean} [TimeControlBase.prototype.reverse=false]
  70594. * @description 是否反向。
  70595. */
  70596. this.reverse = (options.reverse !== undefined) ? options.reverse : false;
  70597. /**
  70598. * @member {number} TimeControlBase.prototype.currentTime
  70599. * @description 记录近期的时间,也就是当前帧运行到的时间。
  70600. */
  70601. this.currentTime = null;
  70602. /**
  70603. * @member {number} TimeControlBase.prototype.oldTime
  70604. * @description 记录上一帧的时间,也就是之前运行到的时间。
  70605. */
  70606. this.oldTime = null;
  70607. /**
  70608. * @member {boolean} [TimeControlBase.prototype.running=false]
  70609. * @description 记录当前是否处于运行中。
  70610. */
  70611. this.running = false;
  70612. /**
  70613. * @private
  70614. * @member {Array.<string>} TimeControlBase.prototype.EVENT_TYPES
  70615. * @description 此类支持的事件类型。
  70616. *
  70617. */
  70618. this.EVENT_TYPES = ["start", "pause", "stop"];
  70619. /**
  70620. * @private
  70621. * @member {Events} TimeControlBase.prototype.events
  70622. * @description 事件
  70623. */
  70624. me.events = new Events(this, null, this.EVENT_TYPES);
  70625. me.speed = Number(me.speed);
  70626. me.frequency = Number(me.frequency);
  70627. me.startTime = Number(me.startTime);
  70628. me.endTime = Number(me.endTime);
  70629. me.startTime = Date.parse(new Date(me.startTime));
  70630. me.endTime = Date.parse(new Date(me.endTime));
  70631. //初始化当前时间
  70632. me.currentTime = me.startTime;
  70633. this.CLASS_NAME = "SuperMap.TimeControlBase";
  70634. }
  70635. /**
  70636. * @function TimeControlBase.prototype.updateOptions
  70637. * @description 更新参数。
  70638. * @param {Object} options - 设置参数的可选参数。设置步长,刷新频率、开始结束时间、是否循环、是否反向。
  70639. */
  70640. updateOptions(options) {
  70641. //设置步长,刷新频率、开始结束时间、是否循环、是否反向
  70642. var me = this;
  70643. options = options || {};
  70644. if (options.speed && options.speed >= 0) {
  70645. me.speed = options.speed;
  70646. me.speed = Number(me.speed);
  70647. }
  70648. if (options.speed && options.frequency >= 0) {
  70649. me.frequency = options.frequency;
  70650. me.frequency = Number(me.frequency);
  70651. }
  70652. if (options.startTime && options.startTime != null) {
  70653. me.startTime = options.startTime;
  70654. me.startTime = Date.parse(new Date(me.startTime));
  70655. }
  70656. if (options.endTime && options.endTime != null && options.endTime >= me.startTime) {
  70657. me.endTime = options.endTime;
  70658. me.endTime = Date.parse(new Date(me.endTime));
  70659. }
  70660. if (options.repeat != null) {
  70661. me.repeat = options.repeat;
  70662. }
  70663. if (options.reverse != null) {
  70664. me.reverse = options.reverse;
  70665. }
  70666. }
  70667. /**
  70668. * @function TimeControlBase.prototype.start
  70669. * @description 开始。
  70670. */
  70671. start() {
  70672. var me = this;
  70673. if (!me.running) {
  70674. me.running = true;
  70675. me.tick();
  70676. me.events.triggerEvent('start', me.currentTime);
  70677. }
  70678. }
  70679. /**
  70680. * @function TimeControlBase.prototype.pause
  70681. * @description 暂停。
  70682. */
  70683. pause() {
  70684. var me = this;
  70685. me.running = false;
  70686. me.events.triggerEvent('pause', me.currentTime);
  70687. }
  70688. /**
  70689. * @function TimeControlBase.prototype.stop
  70690. * @description 停止,停止后返回起始状态。
  70691. */
  70692. stop() {
  70693. var me = this;
  70694. //停止时 时间设置为开始时间
  70695. me.currentTime = me.startTime;
  70696. //如果正在运行,修改为初始时间即可绘制一帧
  70697. if (me.running) {
  70698. me.running = false;
  70699. }
  70700. me.events.triggerEvent('stop', me.currentTime);
  70701. }
  70702. /**
  70703. * @function TimeControlBase.prototype.toggle
  70704. * @description 开关切换,切换的是开始和暂停。
  70705. */
  70706. toggle() {
  70707. var me = this;
  70708. if (me.running) {
  70709. me.pause();
  70710. } else {
  70711. me.start();
  70712. }
  70713. }
  70714. /**
  70715. * @function TimeControlBase.prototype.setSpeed
  70716. * @description 设置步长。
  70717. * @param {number} [speed=1] - 步长,必须为非负数。
  70718. * @returns {boolean} true 代表设置成功,false 设置失败(speed 小于 0 时失败)。
  70719. */
  70720. setSpeed(speed) {
  70721. var me = this;
  70722. if (speed >= 0) {
  70723. me.speed = speed;
  70724. return true;
  70725. }
  70726. return false;
  70727. }
  70728. /**
  70729. * @function TimeControlBase.prototype.getSpeed
  70730. * @description 获取步长。
  70731. * @returns {number} 返回当前的步长。
  70732. */
  70733. getSpeed() {
  70734. return this.speed;
  70735. }
  70736. /**
  70737. * @function TimeControlBase.prototype.setFrequency
  70738. * @description 设置刷新频率。
  70739. * @param {number} [frequency=1000] - 刷新频率,单位为 ms。
  70740. * @returns {boolean} true 代表设置成功,false 设置失败(frequency 小于 0 时失败)。
  70741. */
  70742. setFrequency(frequency) {
  70743. var me = this;
  70744. if (frequency >= 0) {
  70745. me.frequency = frequency;
  70746. return true;
  70747. }
  70748. return false;
  70749. }
  70750. /**
  70751. * @function TimeControlBase.prototype.getFrequency
  70752. * @description 获取刷新频率。
  70753. * @returns {number} 返回当前的刷新频率。
  70754. */
  70755. getFrequency() {
  70756. return this.frequency;
  70757. }
  70758. /**
  70759. * @function TimeControlBase.prototype.setStartTime
  70760. * @description 设置起始时间,设置完成后如果当前时间小于起始时间,则从起始时间开始。
  70761. * @param {number} startTime - 需要设置的起始时间。
  70762. * @returns {boolean} true 代表设置成功,false 设置失败(startTime 大于结束时间时失败)。
  70763. */
  70764. setStartTime(startTime) {
  70765. var me = this;
  70766. startTime = Date.parse(new Date(startTime));
  70767. //起始时间不得大于结束时间
  70768. if (startTime > me.endTime) {
  70769. return false;
  70770. }
  70771. me.startTime = startTime;
  70772. //如果当前时间小于了起始时间,则从当前起始时间开始
  70773. if (me.currentTime < me.startTime) {
  70774. me.currentTime = me.startTime;
  70775. me.tick();
  70776. }
  70777. return true;
  70778. }
  70779. /**
  70780. * @function TimeControlBase.prototype.getStartTime
  70781. * @description 获取起始时间。
  70782. * @returns {number} 返回当前的起始时间。
  70783. */
  70784. getStartTime() {
  70785. return this.startTime;
  70786. }
  70787. /**
  70788. * @function TimeControlBase.prototype.setEndTime
  70789. * @description 设置结束时间,设置完成后如果当前时间大于结束,则从起始时间开始。
  70790. * @param {number} endTime - 需要设置的结束时间。
  70791. * @returns {boolean} true 代表设置成功,false 设置失败(endTime 小于开始时间时失败)。
  70792. */
  70793. setEndTime(endTime) {
  70794. var me = this;
  70795. me.endTime = Date.parse(new Date(me.endTime));
  70796. //结束时间不得小于开始时间
  70797. if (endTime < me.startTime) {
  70798. return false;
  70799. }
  70800. me.endTime = endTime;
  70801. //如果当前时间大于了结束时间,则从起始时间开始
  70802. if (me.currentTime >= me.endTime) {
  70803. me.currentTime = me.startTime;
  70804. me.tick();
  70805. }
  70806. return true;
  70807. }
  70808. /**
  70809. * @function TimeControlBase.prototype.getEndTime
  70810. * @description 获取结束时间。
  70811. * @returns {number} 返回当前的结束时间。
  70812. */
  70813. getEndTime() {
  70814. return this.endTime;
  70815. }
  70816. /**
  70817. * @function TimeControlBase.prototype.setCurrentTime
  70818. * @description 设置当前时间。
  70819. * @param {number} currentTime - 需要设置的当前时间。
  70820. * @returns {boolean} true 代表设置成功,false 设置失败。
  70821. */
  70822. setCurrentTime(currentTime) {
  70823. var me = this;
  70824. me.currentTime = Date.parse(new Date(me.currentTime));
  70825. //结束时间不得小于开始时间
  70826. if (currentTime >= me.startTime && currentTime <= me.endTime) {
  70827. me.currentTime = currentTime;
  70828. me.startTime = me.currentTime;
  70829. me.tick();
  70830. return true;
  70831. }
  70832. return false;
  70833. }
  70834. /**
  70835. * @function TimeControlBase.prototype.getCurrentTime
  70836. * @description 获取当前时间。
  70837. * @returns {number} 返回当前时间。
  70838. */
  70839. getCurrentTime() {
  70840. return this.currentTime;
  70841. }
  70842. /**
  70843. * @function TimeControlBase.prototype.setRepeat
  70844. * @description 设置是否重复循环。
  70845. * @param {boolean} [repeat=true] - 是否重复循环。
  70846. */
  70847. setRepeat(repeat) {
  70848. this.repeat = repeat;
  70849. }
  70850. /**
  70851. * @function TimeControlBase.prototype.getRepeat
  70852. * @description 获取是否重复循环,默认是 true。
  70853. * @returns {boolean} 返回是否重复循环。
  70854. */
  70855. getRepeat() {
  70856. return this.repeat;
  70857. }
  70858. /**
  70859. * @function TimeControlBase.prototype.setReverse
  70860. * @description 设置是否反向。
  70861. * @param {boolean} [reverse=false] - 是否反向。
  70862. */
  70863. setReverse(reverse) {
  70864. this.reverse = reverse;
  70865. }
  70866. /**
  70867. * @function TimeControlBase.prototype.getReverse
  70868. * @description 获取是否反向,默认是false。
  70869. * @returns {boolean} 返回是否反向。
  70870. */
  70871. getReverse() {
  70872. return this.reverse;
  70873. }
  70874. /**
  70875. * @function TimeControlBase.prototype.getRunning
  70876. * @description 获取运行状态。
  70877. * @returns {boolean} true 代表正在运行,false 发表没有运行。
  70878. */
  70879. getRunning() {
  70880. return this.running;
  70881. }
  70882. /**
  70883. * @function TimeControlBase.prototype.destroy
  70884. * @description 销毁 Animator 对象,释放资源。
  70885. */
  70886. destroy() {
  70887. var me = this;
  70888. me.speed = null;
  70889. me.frequency = null;
  70890. me.startTime = null;
  70891. me.endTime = null;
  70892. me.currentTime = null;
  70893. me.repeat = null;
  70894. me.running = false;
  70895. me.reverse = null;
  70896. }
  70897. tick() {
  70898. //TODO 每次刷新执行的操作。子类实现
  70899. }
  70900. }
  70901. ;// CONCATENATED MODULE: ./src/common/control/TimeFlowControl.js
  70902. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  70903. * This program are made available under the terms of the Apache License, Version 2.0
  70904. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  70905. /**
  70906. * @class TimeFlowControl
  70907. * @deprecatedclass SuperMap.TimeFlowControl
  70908. * @category Control
  70909. * @classdesc 时间管理类。此类只负责时间上的控制,具体执行的操作需要用户在初始化时的回调函数内部进行实现。
  70910. * 如设置起始时间为 1000,结束时间是 2000,步长设置为 1,
  70911. * 那么表示按照每次1年(可以通过 setSpeed 进行修改)的变化从公元 1000 年开始到公元 2000 年为止,默认每 1 秒会变化 1 次(通过 setFrequency 修改)
  70912. * @modulecategory Control
  70913. * @extends {TimeControlBase}
  70914. * @param {function} callback - 每次刷新回调函数。具体的效果需要用户在此回调函数里面实现。
  70915. * @param {Object} options - 可选参数。
  70916. * @param {number} [options.speed=1] - 步长(单位 ms)。不能小于 0,(每次刷新的数据之间的间隔为 1ms)。
  70917. * @param {number} [options.frequency=1000] - 刷新频率(单位 ms)。
  70918. * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
  70919. * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时使用 new Date() 以当前时间进行设置,建议设置。
  70920. * @param {boolean} [options.repeat=true] - 是否重复循环。
  70921. * @param {boolean} [options.reverse=false] - 是否反向。
  70922. * @usage
  70923. */
  70924. class TimeFlowControl extends TimeControlBase {
  70925. constructor(callback, options) {
  70926. super(options);
  70927. var me = this;
  70928. /**
  70929. * @member TimeFlowControl.prototype.callback -{function}
  70930. * @description 每次刷新执行的回调函数。
  70931. */
  70932. me.callback = callback;
  70933. //先让IE下支持bind方法
  70934. if (!Function.prototype.bind) {
  70935. Function.prototype.bind = function (oThis) {
  70936. if (typeof this !== "function") {
  70937. throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
  70938. }
  70939. var aArgs = Array.prototype.slice.call(arguments, 1),
  70940. fToBind = this,
  70941. fNOP = function () {
  70942. //empty Function
  70943. },
  70944. fBound = function () {
  70945. return fToBind.apply(this instanceof fNOP && oThis
  70946. ? this
  70947. : oThis,
  70948. aArgs.concat(Array.prototype.slice.call(arguments)));
  70949. };
  70950. fNOP.prototype = this.prototype;
  70951. fBound.prototype = new fNOP();
  70952. return fBound;
  70953. };
  70954. }
  70955. //保证 this.tick 的上下文还是 TimeControl 这个对象
  70956. me.update = me.update.bind(me);
  70957. me.oldTime = me.currentTime;
  70958. me.CLASS_NAME = "SuperMap.TimeFlowControl";
  70959. }
  70960. /**
  70961. * @function TimeFlowControl.prototype.updateOptions
  70962. * @override
  70963. */
  70964. updateOptions(options) {
  70965. options = options || {};
  70966. super.updateOptions(options);
  70967. }
  70968. /**
  70969. * @function TimeFlowControl.prototype.start
  70970. * @override
  70971. */
  70972. start() {
  70973. var me = this;
  70974. if (me.running) {
  70975. return;
  70976. }
  70977. me.running = true;
  70978. if (me.reverse) {
  70979. if (me.currentTime === me.startTime) {
  70980. me.oldTime = me.endTime;
  70981. me.currentTime = me.oldTime;
  70982. }
  70983. } else {
  70984. if (me.oldTime === me.endTime) {
  70985. me.currentTime = me.startTime;
  70986. me.oldTime = me.currentTime;
  70987. }
  70988. }
  70989. me.tick();
  70990. }
  70991. /**
  70992. * @function TimeFlowControl.prototype.stop
  70993. * @override
  70994. */
  70995. stop() {
  70996. super.stop();
  70997. var me = this;
  70998. me.oldTime = me.currentTime;
  70999. if (me.running) {
  71000. me.running = false;
  71001. }
  71002. //清除定时tick
  71003. me.intervalId && window.clearTimeout(me.intervalId);
  71004. }
  71005. /**
  71006. * @function TimeFlowControl.prototype.destroy
  71007. * @override
  71008. */
  71009. destroy() {
  71010. super.destroy();
  71011. var me = this;
  71012. me.oldTime = null;
  71013. me.callback = null;
  71014. }
  71015. /**
  71016. * @function TimeFlowControl.prototype.tick
  71017. * @description 定时刷新。
  71018. */
  71019. tick() {
  71020. var me = this;
  71021. me.intervalId && window.clearInterval(me.intervalId);
  71022. me.intervalId = null;
  71023. me.update();
  71024. me.intervalId = window.setInterval(me.update, me.frequency);
  71025. }
  71026. /**
  71027. * @function TimeFlowControl.prototype.update
  71028. * @description 更新控件。
  71029. */
  71030. update() {
  71031. var me = this;
  71032. //判定是否还需要继续
  71033. if (!me.running) {
  71034. return;
  71035. }
  71036. //调用回调函数
  71037. me.callback && me.callback(me.currentTime); //destroy之后callback就为空,所以需要判定一下
  71038. if (!me.reverse) {
  71039. //如果相等,则代表上一帧已经运行到了最后,下一帧运行初始化的状态
  71040. if (me.currentTime === me.endTime) {
  71041. //不循环时
  71042. if (!me.repeat) {
  71043. me.running = false;
  71044. me.stop();
  71045. return null;
  71046. }
  71047. me.stop();
  71048. me.currentTime = me.startTime;
  71049. me.oldTime = me.currentTime;
  71050. me.start();
  71051. } else {//否则时间递增
  71052. me.oldTime = me.currentTime;
  71053. me.currentTime += me.speed;
  71054. }
  71055. if (me.currentTime >= me.endTime) {
  71056. me.currentTime = me.endTime;
  71057. }
  71058. } else {
  71059. //如果相等,则代表上一帧已经运行到了最前,下一帧运行结束的状态
  71060. if (me.currentTime === me.startTime) {
  71061. //不循环时
  71062. if (!me.repeat) {
  71063. me.running = false;
  71064. return null;
  71065. }
  71066. me.oldTime = me.endTime;
  71067. me.currentTime = me.oldTime;
  71068. } else {//否则时间递减
  71069. me.currentTime = me.oldTime;
  71070. me.oldTime -= me.speed;
  71071. }
  71072. if (me.oldTime <= me.startTime) {
  71073. me.oldTime = me.startTime;
  71074. }
  71075. }
  71076. }
  71077. }
  71078. ;// CONCATENATED MODULE: ./src/common/control/index.js
  71079. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71080. * This program are made available under the terms of the Apache License, Version 2.0
  71081. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71082. ;// CONCATENATED MODULE: ./src/common/iManager/iManagerServiceBase.js
  71083. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71084. * This program are made available under the terms of the Apache License, Version 2.0
  71085. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71086. /**
  71087. * @class IManagerServiceBase
  71088. * @aliasclass iManagerServiceBase
  71089. * @deprecatedclass SuperMap.iManagerServiceBase
  71090. * @classdesc iManager 服务基类(有权限限制的类需要实现此类)。
  71091. * @category iManager
  71092. * @param {string} url - iManager 首页地址,如:http://localhost:8390/imanager。
  71093. * @param {Object} options - 可选参数。
  71094. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  71095. * @param {Object} [options.headers] - 请求头。
  71096. * @usage
  71097. */
  71098. class IManagerServiceBase {
  71099. constructor(url,options) {
  71100. if (url) {
  71101. var end = url.substr(url.length - 1, 1);
  71102. this.serviceUrl = end === "/" ? url.substr(0, url.length - 2) : url;
  71103. }
  71104. this.options = options || {};
  71105. this.CLASS_NAME = "SuperMap.iManagerServiceBase";
  71106. }
  71107. /**
  71108. * @function IManagerServiceBase.prototype.request
  71109. * @description 子类统一通过该方法发送请求。
  71110. * @param {string} url - 请求 URL。
  71111. * @param {string} [method='GET'] - 请求类型。
  71112. * @param {Object} [requestOptions] - 请求选项。
  71113. * @param {Object} param - 请求参数。
  71114. * @description 发送请求。
  71115. * @returns {Promise} Promise 对象。
  71116. */
  71117. request(method, url, param, requestOptions) {
  71118. requestOptions = requestOptions || {
  71119. headers: {
  71120. 'Accept': '*/*',
  71121. 'Content-Type': 'application/json'
  71122. }
  71123. };
  71124. if (!requestOptions.hasOwnProperty("withCredentials")) {
  71125. requestOptions['withCredentials'] = true;
  71126. }
  71127. requestOptions['crossOrigin'] = this.options.crossOrigin;
  71128. requestOptions['headers'] = this.options.headers;
  71129. var token = SecurityManager.imanagerToken;
  71130. if (token) {
  71131. if (!requestOptions.headers) {
  71132. requestOptions.headers = [];
  71133. }
  71134. requestOptions.headers['X-Auth-Token'] = token;
  71135. }
  71136. if (param) {
  71137. param = JSON.stringify(param);
  71138. }
  71139. return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
  71140. return response.json();
  71141. });
  71142. }
  71143. }
  71144. ;// CONCATENATED MODULE: ./src/common/iManager/iManagerCreateNodeParam.js
  71145. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71146. * This program are made available under the terms of the Apache License, Version 2.0
  71147. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71148. /**
  71149. * @class IManagerCreateNodeParam
  71150. * @aliasclass iManagerCreateNodeParam
  71151. * @deprecatedclass SuperMap.iManagerCreateNodeParam
  71152. * @classdesc iManager 创建节点参数。
  71153. * @category iManager
  71154. * @param {Object} [params] - 节点参数。
  71155. * @usage
  71156. */
  71157. class IManagerCreateNodeParam {
  71158. constructor(params) {
  71159. params = params || {};
  71160. this.nodeSpec = 'SMALL'; //取值范围: ['SMALL','MEDIUM','LARGE'] 以及自定义的环境规格名称
  71161. this.nodeCount = 1; //要创建vm的个数
  71162. this.nodeName = ''; //vm名称
  71163. this.password = ''; //vm的密码,空表示随机分配
  71164. this.description = ''; //描述信息
  71165. this.physicalMachineName = ''; //vm所属的物理机名称.
  71166. this.ips = []; //vm的ip,空数组表示随机分配
  71167. this.userName = ''; //vm所属用户
  71168. Util_Util.extend(this, params);
  71169. }
  71170. }
  71171. ;// CONCATENATED MODULE: ./src/common/iManager/iManager.js
  71172. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71173. * This program are made available under the terms of the Apache License, Version 2.0
  71174. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71175. /**
  71176. * @class IManager
  71177. * @aliasclass iManager
  71178. * @deprecatedclass SuperMap.iManager
  71179. * @classdesc iManager 服务类。
  71180. * @category iManager
  71181. * @modulecategory Services
  71182. * @param {string} serviceUrl - iManager 首页地址。
  71183. * @usage
  71184. */
  71185. class IManager extends IManagerServiceBase {
  71186. constructor(iManagerUrl) {
  71187. super(iManagerUrl);
  71188. }
  71189. /**
  71190. * @function IManager.prototype.load
  71191. * @description 获取所有服务接口,验证是否已登录授权。
  71192. * @returns {Promise} Promise 对象。
  71193. */
  71194. load() {
  71195. return this.request("GET", this.serviceUrl + '/web/api/service.json');
  71196. }
  71197. /**
  71198. * @function IManager.prototype.createIServer
  71199. * @param {IManagerCreateNodeParam} createParam - 创建参数。
  71200. * @description 创建 iServer。
  71201. * @returns {Promise} Promise 对象。
  71202. */
  71203. createIServer(createParam) {
  71204. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/server.json', new IManagerCreateNodeParam(createParam));
  71205. }
  71206. /**
  71207. * @function IManager.prototype.createIPortal
  71208. * @param {IManagerCreateNodeParam} createParam - 创建参数。
  71209. * @description 创建 iPortal。
  71210. * @returns {Promise} Promise 对象。
  71211. */
  71212. createIPortal(createParam) {
  71213. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/portal.json', new IManagerCreateNodeParam(createParam));
  71214. }
  71215. /**
  71216. * @function IManager.prototype.iServerList
  71217. * @description 获取所有创建的 iServer。
  71218. * @returns {Promise} Promise 对象。
  71219. */
  71220. iServerList() {
  71221. return this.request("GET", this.serviceUrl + '/icloud/web/nodes/server.json');
  71222. }
  71223. /**
  71224. * @function IManager.prototype.iPortalList
  71225. * @description 获取所有创建的 iPortal。
  71226. * @returns {Promise} Promise 对象。
  71227. */
  71228. iPortalList() {
  71229. return this.request("GET", this.serviceUrl + '/icloud/web/nodes/portal.json');
  71230. }
  71231. /**
  71232. * @function IManager.prototype.startNodes
  71233. * @param {Array.<string>} ids - 需要启动节点的 ID 数组。e.g:['1']。
  71234. * @description 启动节点。
  71235. * @returns {Promise} Promise 对象。
  71236. */
  71237. startNodes(ids) {
  71238. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/started.json', ids);
  71239. }
  71240. /**
  71241. * @function IManager.prototype.stopNodes
  71242. * @param {Array.<string>} ids - 需要停止节点的 ID 数组。e.g:['1']。
  71243. * @description 停止节点。
  71244. * @returns {Promise} Promise 对象。
  71245. */
  71246. stopNodes(ids) {
  71247. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/stopped.json', ids);
  71248. }
  71249. }
  71250. ;// CONCATENATED MODULE: ./src/common/iManager/index.js
  71251. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71252. * This program are made available under the terms of the Apache License, Version 2.0
  71253. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71254. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalServiceBase.js
  71255. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71256. * This program are made available under the terms of the Apache License, Version 2.0
  71257. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71258. /**
  71259. * @class IPortalServiceBase
  71260. * @aliasclass iPortalServiceBase
  71261. * @deprecatedclass SuperMap.iPortalServiceBase
  71262. * @classdesc iPortal 服务基类(有权限限制的类需要实现此类)。
  71263. * @category iPortal/Online Core
  71264. * @param {string} url - 服务地址。
  71265. * @param {Object} options - 可选参数。
  71266. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  71267. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  71268. * @param {Object} [options.headers] - 请求头。
  71269. * @usage
  71270. */
  71271. class IPortalServiceBase {
  71272. constructor(url, options) {
  71273. options = options || {};
  71274. this.serviceUrl = url;
  71275. this.CLASS_NAME = "SuperMap.iPortalServiceBase";
  71276. this.withCredentials = options.withCredentials || false;
  71277. this.crossOrigin = options.crossOrigin
  71278. this.headers = options.headers
  71279. }
  71280. /**
  71281. * @function IPortalServiceBase.prototype.request
  71282. * @description 子类统一通过该方法发送请求。
  71283. * @param {string} [method='GET'] - 请求类型。
  71284. * @param {string} url - 服务地址。
  71285. * @param {Object} param - 请求参数。
  71286. * @param {Object} [requestOptions] - fetch 请求配置项。
  71287. * @returns {Promise} 返回包含请求结果的 Promise 对象。
  71288. */
  71289. request(method, url, param, requestOptions = {headers: this.headers, crossOrigin: this.crossOrigin, withCredentials: this.withCredentials }) {
  71290. url = SecurityManager.appendCredential(url);
  71291. return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
  71292. return response.json();
  71293. });
  71294. }
  71295. }
  71296. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryParam.js
  71297. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71298. * This program are made available under the terms of the Apache License, Version 2.0
  71299. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71300. /**
  71301. * @class IPortalQueryParam
  71302. * @aliasclass iPortalQueryParam
  71303. * @deprecatedclass SuperMap.iPortalQueryParam
  71304. * @classdesc iPortal 资源查询参数。
  71305. * @version 10.0.1
  71306. * @category iPortal/Online Resources ResourcesQuery
  71307. * @param {Object} params - 可选参数。
  71308. * @param {ResourceType} [params.resourceType] - 资源类型。
  71309. * @param {number} [params.pageSize] - 分页中每页大小。
  71310. * @param {number} [params.currentPage] - 分页页码。
  71311. * @param {OrderBy} [params.orderBy] - 排序字段。
  71312. * @param {OrderType} [params.orderType] - 根据升序还是降序过滤。
  71313. * @param {SearchType} [params.searchType] - 根据查询的范围进行过滤。
  71314. * @param {Array} [params.tags] - 标签。
  71315. * @param {Array} [params.dirIds] - 目录 ID。
  71316. * @param {Array} [params.resourceSubTypes] - 根据资源的子类型进行过滤。
  71317. * @param {AggregationTypes} [params.aggregationTypes] - 聚合查询的类型。
  71318. * @param {string} [params.text] - 搜索的关键词。
  71319. * @param {Array} [params.groupIds] - 根据群组进行过滤。
  71320. * @param {Array} [params.departmentIds] - 根据部门进行过滤。
  71321. * @usage
  71322. */
  71323. class IPortalQueryParam {
  71324. constructor(params) {
  71325. params = params || {};
  71326. this.resourceType = ""; // 空为全部 MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
  71327. this.pageSize = 12; // 每页多少条
  71328. this.currentPage = 1; // 第几页
  71329. this.orderBy = "UPDATETIME"; // UPDATETIME HEATLEVEL
  71330. this.orderType = "DESC"; // DESC ASC
  71331. this.searchType = "PUBLIC"; // PUBLIC SHARETOME_RES MYDEPARTMENT_RES MYGROUP_RES MY_RES
  71332. this.tags = []; // 标签
  71333. this.dirIds = []; // 类别
  71334. this.resourceSubTypes = []; // 类型
  71335. this.aggregationTypes = []; // TAG TYPE SUBTYPE
  71336. this.text = ""; // 搜索字段
  71337. this.groupIds = []; // 群组Id过滤
  71338. this.departmentIds = []; // 部门Id过滤
  71339. Util_Util.extend(this, params);
  71340. }
  71341. }
  71342. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryResult.js
  71343. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71344. * This program are made available under the terms of the Apache License, Version 2.0
  71345. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71346. /**
  71347. * @class IPortalQueryResult
  71348. * @aliasclass iPortalQueryResult
  71349. * @deprecatedclass SuperMap.iPortalQueryResult
  71350. * @classdesc iPortal 资源结果集封装类。
  71351. * @version 10.0.1
  71352. * @category iPortal/Online Resources ResourcesQuery
  71353. * @param {Object} queryResult - 可选参数。
  71354. * @param {Array} [queryResult.content] - 页面内容。
  71355. * @param {number} [queryResult.total] - 总记录数。
  71356. * @param {number} [queryResult.currentPage] - 当前第几页。
  71357. * @param {number} [queryResult.pageSize] - 每页大小。
  71358. * @param {Object} [queryResult.aggregations] - 聚合查询的结果。
  71359. * @usage
  71360. */
  71361. class IPortalQueryResult {
  71362. constructor(queryResult) {
  71363. queryResult = queryResult || {};
  71364. this.content = [];
  71365. this.total = 0;
  71366. this.currentPage = 1;
  71367. this.pageSize = 12;
  71368. this.aggregations = null;
  71369. Util_Util.extend(this, queryResult);
  71370. }
  71371. }
  71372. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalResource.js
  71373. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71374. * This program are made available under the terms of the Apache License, Version 2.0
  71375. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71376. /**
  71377. * @class IPortalResource
  71378. * @aliasclass iPortalResource
  71379. * @deprecatedclass SuperMap.iPortalResource
  71380. * @classdesc iPortal 资源详情类。
  71381. * @version 10.0.1
  71382. * @category iPortal/Online Resources
  71383. * @param {string} portalUrl - 服务地址。
  71384. * @param {Object} resourceInfo - 可选参数。
  71385. * @param {Array} [resourceInfo.authorizeSetting] - 资源的授权信息。
  71386. * @param {string} [resourceInfo.bounds] - 资源的坐标范围。
  71387. * @param {string} [resourceInfo.bounds4326] - 资源的坐标范围,转换为EPSG 4326坐标系统后的地理范围。
  71388. * @param {string} [resourceInfo.checkStatus] - 资源的审核状态,可以是:空,SUCCESSFUL,UNCHECKED,FAILED。
  71389. * @param {Date} [resourceInfo.createTime] - 资源的创建时间。
  71390. * @param {string} [resourceInfo.description] - 资源描述。
  71391. * @param {number} [resourceInfo.dirId] - 资源所在的门户目录的ID。
  71392. * @param {number} [resourceInfo.epsgCode] - 门户资源基于的坐标系的EPSG值。
  71393. * @param {number} [resourceInfo.heatLevel] - 记录资源的访问量或下载量。
  71394. * @param {string} [resourceInfo.id] - 资源存储到ElasticSearch中的文档ID。
  71395. * @param {string} [resourceInfo.name] - 资源名称。
  71396. * @param {number} [resourceInfo.personalDirId] - 资源所在的个人目录的ID。
  71397. * @param {number} [resourceInfo.resourceId] - 资源表(maps,services等)里的ID。
  71398. * @param {string} [resourceInfo.resourceSubType] - 某类资源的具体子类型。
  71399. * @param {ResourceType} [resourceInfo.resourceType] - 资源类型。
  71400. * @param {number} [resourceInfo.serviceRootUrlId] - 批量注册服务时,服务根地址的ID。
  71401. * @param {Array} [resourceInfo.tags] - 资源的标签。
  71402. * @param {string} [resourceInfo.thumbnail] - 资源的缩略图。
  71403. * @param {Date} [resourceInfo.updateTime] - 资源的更新时间。
  71404. * @param {string} [resourceInfo.userName] - 搜索的关键词。
  71405. * @param {Object} [resourceInfo.sourceJSON] - 提供了门户项目返回的所有信息。
  71406. * @extends {IPortalServiceBase}
  71407. * @usage
  71408. */
  71409. class IPortalResource extends IPortalServiceBase {
  71410. constructor(portalUrl, resourceInfo) {
  71411. super(portalUrl);
  71412. resourceInfo = resourceInfo || {};
  71413. this.authorizeSetting = [];
  71414. this.bounds = "";
  71415. this.bounds4326 = "";
  71416. this.checkStatus = "";
  71417. this.createTime = 0;
  71418. this.description = null;
  71419. this.dirId = null;
  71420. this.epsgCode = 0;
  71421. this.heatLevel = 0;
  71422. this.id = 0;
  71423. this.name = "";
  71424. this.personalDirId = null;
  71425. this.resourceId = 0;
  71426. this.resourceSubType = null;
  71427. this.resourceType = null;
  71428. this.serviceRootUrlId = null;
  71429. this.tags = null;
  71430. this.thumbnail = null;
  71431. this.updateTime = 0;
  71432. this.userName = "";
  71433. this.sourceJSON = {};//返回门户资源详细信息
  71434. Util_Util.extend(this, resourceInfo); // INSIGHTS_WORKSPACE MAP_DASHBOARD
  71435. this.resourceUrl = portalUrl + "/web/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
  71436. if (this.withCredentials) {
  71437. this.resourceUrl = portalUrl + "/web/mycontent/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
  71438. }
  71439. // if (this.id) {
  71440. // this.mapUrl = mapUrl + "/" + this.id;
  71441. // }
  71442. }
  71443. /**
  71444. * @function IPortalResource.prototype.load
  71445. * @description 加载资源信息。
  71446. * @returns {Promise} 返回 Promise 对象。如果成功,Promise 没有返回值,请求返回结果自动填充到该类的属性中;如果失败,Promise 返回值包含错误信息。
  71447. */
  71448. load() {
  71449. var me = this;
  71450. return me.request("GET", me.resourceUrl + ".json")
  71451. .then(function (resourceInfo) {
  71452. if (resourceInfo.error) {
  71453. return resourceInfo;
  71454. }
  71455. me.sourceJSON = resourceInfo;
  71456. });
  71457. }
  71458. /**
  71459. * @function IPortalResource.prototype.update
  71460. * @description 更新资源属性信息。
  71461. * @returns {Promise} 返回包含更新操作状态的 Promise 对象。
  71462. */
  71463. update() {
  71464. var resourceName = this.resourceType.replace("_","").toLowerCase();
  71465. var options = {
  71466. headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  71467. };
  71468. if( resourceName === 'data') {
  71469. this.resourceUrl = this.resourceUrl + "/attributes.json";
  71470. }
  71471. var entity = JSON.stringify(this.sourceJSON);
  71472. //对服务资源进行编辑时,请求体内容只留关键字字段(目前如果是全部字段 更新返回成功 但其实没有真正的更新)
  71473. if( resourceName === 'service') {
  71474. var serviceInfo = {
  71475. authorizeSetting:this.sourceJSON.authorizeSetting,
  71476. metadata:this.sourceJSON.metadata,
  71477. tags:this.sourceJSON.tags,
  71478. thumbnail:this.sourceJSON.thumbnail,
  71479. tokenRefreshUrl:this.sourceJSON.tokenRefreshUrl
  71480. };
  71481. entity = JSON.stringify(serviceInfo);
  71482. }
  71483. return this.request("PUT", this.resourceUrl, entity, options);
  71484. }
  71485. }
  71486. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalShareParam.js
  71487. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71488. * This program are made available under the terms of the Apache License, Version 2.0
  71489. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71490. /**
  71491. * @class IPortalShareParam
  71492. * @aliasclass iPortalShareParam
  71493. * @deprecatedclass SuperMap.iPortalShareParam
  71494. * @classdesc iPortal 资源共享参数。
  71495. * @version 10.0.1
  71496. * @category iPortal/Online Resources ResourcesShare
  71497. * @param {Object} params - 可选参数。
  71498. * @param {ResourceType} [params.resourceType] - 资源类型。
  71499. * @param {Array} [params.ids] - 资源的ID数组。
  71500. * @param {IPortalShareEntity} [params.entities] - 资源的实体共享参数。
  71501. * @usage
  71502. */
  71503. class IPortalShareParam {
  71504. constructor(params) {
  71505. params = params || {};
  71506. this.ids = [];
  71507. this.entities = [];
  71508. this.resourceType = ""; // MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
  71509. Util_Util.extend(this, params);
  71510. }
  71511. }
  71512. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortal.js
  71513. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71514. * This program are made available under the terms of the Apache License, Version 2.0
  71515. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71516. /**
  71517. * @class IPortal
  71518. * @aliasclass iPortal
  71519. * @deprecatedclass SuperMap.iPortal
  71520. * @classdesc 对接 SuperMap iPortal 基础服务。
  71521. * @category iPortal/Online Resources
  71522. * @modulecategory Services
  71523. * @extends {IPortalServiceBase}
  71524. * @param {string} iportalUrl - 服务地址。
  71525. * @param {Object} options - 可选参数。
  71526. * @param {boolean} [options.withCredentials] - 请求是否携带 cookie。
  71527. * @usage
  71528. */
  71529. class IPortal extends IPortalServiceBase {
  71530. constructor(iportalUrl, options) {
  71531. super(iportalUrl, options);
  71532. this.iportalUrl = iportalUrl;
  71533. options = options || {};
  71534. this.withCredentials = options.withCredentials || false;
  71535. }
  71536. /**
  71537. * @function IPortal.prototype.load
  71538. * @description 加载页面。
  71539. * @returns {Promise} 包含 iportal web 资源信息的 Promise 对象。
  71540. */
  71541. load() {
  71542. return FetchRequest.get(this.iportalUrl + "/web");
  71543. }
  71544. /**
  71545. * @function IPortal.prototype.queryResources
  71546. * @description 查询资源。
  71547. * @version 10.0.1
  71548. * @param {IPortalQueryParam} queryParams - 查询参数。
  71549. * @returns {Promise} 包含所有资源结果的 Promise 对象。
  71550. */
  71551. queryResources(queryParams) {
  71552. if (!(queryParams instanceof IPortalQueryParam)) {
  71553. return new Promise( function(resolve){
  71554. resolve(
  71555. "queryParams is not instanceof iPortalQueryParam !"
  71556. );
  71557. });
  71558. }
  71559. var me = this;
  71560. var resourceUrl = this.iportalUrl + "/gateway/catalog/resource/search.json";
  71561. queryParams.t = new Date().getTime();
  71562. return this.request("GET", resourceUrl, queryParams).then(function(result) {
  71563. var content = [];
  71564. (result.content || []).forEach(function(item) {
  71565. content.push(new IPortalResource(me.iportalUrl, item));
  71566. });
  71567. let queryResult = new IPortalQueryResult();
  71568. queryResult.content = content;
  71569. queryResult.total = result.total;
  71570. queryResult.currentPage = result.currentPage;
  71571. queryResult.pageSize = result.pageSize;
  71572. queryResult.aggregations = result.aggregations;
  71573. return queryResult;
  71574. });
  71575. }
  71576. /**
  71577. * @function IPortal.prototype.updateResourcesShareSetting
  71578. * @description 更新共享设置。
  71579. * @version 10.0.1
  71580. * @param {IPortalShareParam} shareParams - 共享的参数。
  71581. * @returns {Promise} 包含共享资源结果的 Promise 对象。
  71582. */
  71583. updateResourcesShareSetting(shareParams) {
  71584. if (!(shareParams instanceof IPortalShareParam)) {
  71585. return new Promise( function(resolve){
  71586. resolve(
  71587. "shareParams is not instanceof iPortalShareParam !"
  71588. );
  71589. });
  71590. }
  71591. var resourceUrlName = shareParams.resourceType.replace("_","").toLowerCase()+"s";
  71592. if(resourceUrlName === "datas"){
  71593. resourceUrlName = "mycontent/"+resourceUrlName;
  71594. }
  71595. var cloneShareParams = {
  71596. ids: shareParams.ids,
  71597. entities: shareParams.entities
  71598. }
  71599. var shareUrl = this.iportalUrl + "/web/"+resourceUrlName+"/sharesetting.json";
  71600. return this.request("PUT", shareUrl, JSON.stringify(cloneShareParams)).then(function(result) {
  71601. return result;
  71602. });
  71603. }
  71604. }
  71605. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalShareEntity.js
  71606. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71607. * This program are made available under the terms of the Apache License, Version 2.0
  71608. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71609. /**
  71610. * @class IPortalShareEntity
  71611. * @aliasclass iPortalShareEntity
  71612. * @deprecatedclass SuperMap.iPortalShareEntity
  71613. * @classdesc iPortal 资源共享实体参数。
  71614. * @version 10.0.1
  71615. * @category iPortal/Online Resources ResourcesShare
  71616. * @param {Object} shareEntity - 可选参数。
  71617. * @param {PermissionType} [shareEntity.permissionType] - 权限类型。
  71618. * @param {EntityType} [shareEntity.entityType] - 实体类型。
  71619. * @param {string} [shareEntity.entityName] - 实体 Name。对应的 USER(用户)、ROLE(角色)、GROUP(用户组)、IPORTALGROUP(群组)的名称。
  71620. * @param {number} [shareEntity.entityId] - 实体的 ID。用于群组的授权。
  71621. * @usage
  71622. */
  71623. class IPortalShareEntity {
  71624. constructor(shareEntity) {
  71625. shareEntity = shareEntity || {};
  71626. this.permissionType = ""; // SEARCH READ READWRITE DOWNLOAD
  71627. this.entityType = ""; // USER DEPARTMENT IPORTALGROUP
  71628. this.entityName = "GUEST"; // GUEST or 具体用户 name
  71629. this.entityId = null;
  71630. Util_Util.extend(this, shareEntity);
  71631. }
  71632. }
  71633. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalAddResourceParam.js
  71634. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71635. * This program are made available under the terms of the Apache License, Version 2.0
  71636. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71637. /**
  71638. * @class IPortalAddResourceParam
  71639. * @aliasclass iPortalAddResourceParam
  71640. * @deprecatedclass SuperMap.iPortalAddResourceParam
  71641. * @classdesc iPortal 添加资源参数。
  71642. * @version 10.0.1
  71643. * @category iPortal/Online Resources ResourcesShare
  71644. * @param {Object} params - 可选参数。
  71645. * @param {string} [params.rootUrl] - 服务地址。
  71646. * @param {Array} [params.tags] - 标签。
  71647. * @param {IPortalShareEntity} [params.entities] - 资源的实体共享参数。
  71648. * @usage
  71649. */
  71650. class IPortalAddResourceParam {
  71651. constructor(params) {
  71652. params = params || {};
  71653. this.rootUrl = "";
  71654. this.tags = [];
  71655. this.entities = [];
  71656. Util_Util.extend(this, params);
  71657. }
  71658. }
  71659. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalRegisterServiceParam.js
  71660. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71661. * This program are made available under the terms of the Apache License, Version 2.0
  71662. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71663. /**
  71664. * @class IPortalRegisterServiceParam
  71665. * @aliasclass iPortalRegisterServiceParam
  71666. * @deprecatedclass SuperMap.iPortalRegisterServiceParam
  71667. * @classdesc iPortal 注册服务参数。
  71668. * @version 10.0.1
  71669. * @category iPortal/Online Resources Data
  71670. * @param {Object} params - 可选参数。
  71671. * @param {string} [params.type] - 服务类型。
  71672. * @param {Array} [params.tags] - 服务标签。
  71673. * @param {IPortalShareEntity} [params.entities] - 资源的实体共享参数。
  71674. * @param {Object} [params.metadata] - 服务元信息。
  71675. * @param {Array} [params.addedMapNames] - 地图服务列表。
  71676. * @param {Array} [params.addedSceneNames] - 场景服务列表。
  71677. * @usage
  71678. */
  71679. class IPortalRegisterServiceParam {
  71680. constructor(params) {
  71681. params = params || {};
  71682. this.type = ""; // SUPERMAP_REST ARCGIS_REST WMS WFS WCS WPS WMTS OTHERS
  71683. this.tags = [];
  71684. this.entities = [];
  71685. this.metadata = {};
  71686. this.addedMapNames = [];
  71687. this.addedSceneNames = [];
  71688. Util_Util.extend(this, params);
  71689. }
  71690. }
  71691. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalAddDataParam.js
  71692. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71693. * This program are made available under the terms of the Apache License, Version 2.0
  71694. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71695. /**
  71696. * @class IPortalAddDataParam
  71697. * @aliasclass iPortalAddDataParam
  71698. * @deprecatedclass SuperMap.iPortalAddDataParam
  71699. * @classdesc iPortal 上传/注册数据所需的参数。
  71700. * @version 10.0.1
  71701. * @category iPortal/Online Resources Data
  71702. * @param {Object} params - 参数。
  71703. * @param {string} params.fileName - 文件名称。
  71704. * @param {DataItemType} params.type - 数据类型。
  71705. * @param {Array} [params.tags] - 数据的标签。
  71706. * @param {IPortalDataMetaInfoParam} [params.dataMetaInfo] - 数据元信息。
  71707. * @usage
  71708. */
  71709. class IPortalAddDataParam {
  71710. constructor(params) {
  71711. params = params || {};
  71712. this.fileName = "";
  71713. this.type = "";
  71714. this.tags = [];
  71715. this.dataMetaInfo = {};
  71716. Util_Util.extend(this, params);
  71717. }
  71718. }
  71719. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataMetaInfoParam.js
  71720. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71721. * This program are made available under the terms of the Apache License, Version 2.0
  71722. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71723. /**
  71724. * @class IPortalDataMetaInfoParam
  71725. * @aliasclass iPortalDataMetaInfoParam
  71726. * @deprecatedclass SuperMap.iPortalDataMetaInfoParam
  71727. * @classdesc iPortal 上传数据/注册数据元信息所需的参数。
  71728. * @version 10.0.1
  71729. * @category iPortal/Online Resources Data
  71730. * @param {Object} params - 参数。
  71731. * @param {string} params.xField - X 坐标字段。
  71732. * @param {string} params.yField - Y 坐标字段。
  71733. * @param {number} params.xIndex - x所在列(关系型存储下CSV或EXCEL数据时必填)。
  71734. * @param {number} params.yIndex - y所在列(关系型存储下CSV或EXCEL数据时必填)。
  71735. * @param {Array.<string>} [params.fieldTypes] - 设置字段类型(关系型存储下CSV或EXCEL数据时可选填)。默认类型为:WTEXT。该参数按照CSV文件字段顺序从左到右依次设置,其中默认字段类型可省略不设置。例如,CSV文件中有10个字段,如果只需设定第1,2,4个字段,可设置为['a','b',,'c']。
  71736. * @param {string} params.separator - 分隔符(关系型存储下CSV数据时必填)。
  71737. * @param {boolean} params.firstRowIsHead - 是否带表头(关系型存储下CSV数据时必填)。
  71738. * @param {boolean} params.url - HDFS注册目录地址。
  71739. * @param {IPortalDataStoreInfoParam} params.dataStoreInfo - 注册数据时的数据存储信息。
  71740. * @usage
  71741. */
  71742. class IPortalDataMetaInfoParam {
  71743. constructor(params) {
  71744. params = params || {};
  71745. this.xField = "";
  71746. this.yField = "";
  71747. this.fileEncoding = "UTF-8";
  71748. this.xIndex = 1;
  71749. this.yIndex = 1;
  71750. this.fieldTypes = [];
  71751. this.separator = "";
  71752. this.firstRowIsHead = true;
  71753. this.url = "";
  71754. this.dataStoreInfo = {};
  71755. Util_Util.extend(this, params);
  71756. }
  71757. }
  71758. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataStoreInfoParam.js
  71759. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71760. * This program are made available under the terms of the Apache License, Version 2.0
  71761. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71762. /**
  71763. * @class IPortalDataStoreInfoParam
  71764. * @aliasclass iPortalDataStoreInfoParam
  71765. * @deprecatedclass SuperMap.iPortalDataStoreInfoParam
  71766. * @classdesc iPortal 注册一个HBASE HDFS数据存储类。
  71767. * @version 10.0.1
  71768. * @category iPortal/Online Resources Data
  71769. * @param {Object} params - 参数。
  71770. * @param {string} params.type - 大数据文件共享类型和空间数据库类型,包括大数据文件共享HDFS 目录(HDFS)和空间数据库HBASE。
  71771. * @param {string} params.url - HDFS数据存储目录地址。
  71772. * @param {IPortalDataConnectionInfoParam} [params.connectionInfo] - HBASE空间数据库服务的连接信息。
  71773. * @usage
  71774. */
  71775. class IPortalDataStoreInfoParam {
  71776. constructor(params) {
  71777. params = params || {};
  71778. this.type = "";
  71779. this.url = "";
  71780. this.connectionInfo = {};
  71781. Util_Util.extend(this, params);
  71782. }
  71783. }
  71784. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataConnectionInfoParam.js
  71785. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71786. * This program are made available under the terms of the Apache License, Version 2.0
  71787. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71788. /**
  71789. * @class IPortalDataConnectionInfoParam
  71790. * @aliasclass iPortalDataConnectionInfoParam
  71791. * @deprecatedclass SuperMap.iPortalDataConnectionInfoParam
  71792. * @classdesc iPortal HBASE数据源连接信息类。
  71793. * @version 10.0.1
  71794. * @category iPortal/Online Resources Data
  71795. * @param {Object} params - 参数。
  71796. * @param {string} params.dataBase - 数据源连接的数据库名。
  71797. * @param {string} params.server - 服务地址。
  71798. * @usage
  71799. */
  71800. class IPortalDataConnectionInfoParam {
  71801. constructor(params) {
  71802. params = params || {};
  71803. this.dataBase = "";
  71804. this.server = "";
  71805. Util_Util.extend(this, params);
  71806. }
  71807. }
  71808. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalUser.js
  71809. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71810. * This program are made available under the terms of the Apache License, Version 2.0
  71811. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71812. /**
  71813. * @class IPortalUser
  71814. * @aliasclass iPortalUser
  71815. * @deprecatedclass SuperMap.iPortalUser
  71816. * @classdesc iPortal 门户中用户信息的封装类。用于管理用户资源,包括可删除,添加资源。
  71817. * @version 10.0.1
  71818. * @category iPortal/Online Resources
  71819. * @param {string} iportalUrl - 服务地址。
  71820. * @extends {IPortalServiceBase}
  71821. * @usage
  71822. */
  71823. class IPortalUser extends IPortalServiceBase {
  71824. constructor(iportalUrl) {
  71825. super(iportalUrl);
  71826. this.iportalUrl = iportalUrl;
  71827. }
  71828. /**
  71829. * @function IPortalUser.prototype.deleteResources
  71830. * @description 删除资源。
  71831. * @param {Object} params - 删除资源所需的参数对象:{ids,resourceType}。
  71832. * @returns {Promise} 返回包含删除操作状态的 Promise 对象。
  71833. */
  71834. deleteResources(params) {
  71835. var resourceName = params.resourceType.replace("_","").toLowerCase();
  71836. var deleteResourceUrl = this.iportalUrl+"/web/" + resourceName +"s.json?ids=" + encodeURI(JSON.stringify(params.ids));
  71837. if( resourceName === 'data') {
  71838. deleteResourceUrl = this.iportalUrl + "/web/mycontent/datas/delete.json";
  71839. return this.request("POST", deleteResourceUrl, JSON.stringify(params.ids));
  71840. }
  71841. return this.request("DELETE", deleteResourceUrl);
  71842. }
  71843. /**
  71844. * @function IPortalUser.prototype.addMap
  71845. * @description 添加地图。
  71846. * @version 10.1.0
  71847. * @param {IPortalAddResourceParam} addMapParams - 添加地图的参数。
  71848. * @returns {Promise} 返回包含添加地图结果的 Promise 对象。
  71849. */
  71850. addMap(addMapParams) {
  71851. if (!(addMapParams instanceof IPortalAddResourceParam)) {
  71852. return this.getErrMsgPromise("addMapParams is not instanceof IPortalAddResourceParam !");
  71853. }
  71854. let cloneAddMapParams = {
  71855. rootUrl: addMapParams.rootUrl,
  71856. tags: addMapParams.tags,
  71857. authorizeSetting: addMapParams.entities
  71858. }
  71859. let addMapUrl = this.iportalUrl + "/web/maps/batchaddmaps.json";
  71860. return this.request("POST", addMapUrl, JSON.stringify(cloneAddMapParams)).then(function(result) {
  71861. return result;
  71862. });
  71863. }
  71864. /**
  71865. * @function IPortalUser.prototype.addScene
  71866. * @description 添加场景。
  71867. * @version 10.1.0
  71868. * @param {IPortalAddResourceParam} addSceneParams - 添加场景的参数。
  71869. * @returns {Promise} 返回包含添加场景结果的 Promise 对象。
  71870. */
  71871. addScene(addSceneParams) {
  71872. if (!(addSceneParams instanceof IPortalAddResourceParam)) {
  71873. return this.getErrMsgPromise("addSceneParams is not instanceof IPortalAddResourceParam !");
  71874. }
  71875. let cloneAddSceneParams = {
  71876. rootUrl: addSceneParams.rootUrl,
  71877. tags: addSceneParams.tags,
  71878. authorizeSetting: addSceneParams.entities
  71879. }
  71880. let addSceneUrl = this.iportalUrl + "/web/scenes/batchaddscenes.json";
  71881. return this.request("POST", addSceneUrl, JSON.stringify(cloneAddSceneParams)).then(function(result) {
  71882. return result;
  71883. });
  71884. }
  71885. /**
  71886. * @function IPortalUser.prototype.registerService
  71887. * @description 注册服务。
  71888. * @version 10.1.0
  71889. * @param {IPortalRegisterServiceParam} registerParams - 注册服务的参数。
  71890. * @returns {Promise} 返回包含注册服务结果的 Promise 对象。
  71891. */
  71892. registerService(registerParams) {
  71893. if(!(registerParams instanceof IPortalRegisterServiceParam)) {
  71894. return this.getErrMsgPromise("registerParams is not instanceof IPortalRegisterServiceParam !");
  71895. }
  71896. let cloneRegisterParams = {
  71897. type: registerParams.type,
  71898. tags: registerParams.tags,
  71899. authorizeSetting: registerParams.entities,
  71900. metadata: registerParams.metadata,
  71901. addedMapNames: registerParams.addedMapNames,
  71902. addedSceneNames: registerParams.addedSceneNames
  71903. }
  71904. let registerUrl = this.iportalUrl + "/web/services.json";
  71905. return this.request("POST", registerUrl, JSON.stringify(cloneRegisterParams)).then(result => {
  71906. return result;
  71907. });
  71908. }
  71909. /**
  71910. * @function IPortalUser.prototype.getErrMsgPromise
  71911. * @description 获取包含错误信息的Promise对象。
  71912. * @version 10.1.0
  71913. * @param {string} errMsg - 传入的错误信息。
  71914. * @returns {Promise} 返回包含错误信息的 Promise 对象。
  71915. */
  71916. getErrMsgPromise(errMsg) {
  71917. return new Promise(resolve => {
  71918. resolve(errMsg);
  71919. })
  71920. }
  71921. /**
  71922. * @function IPortalUser.prototype.uploadDataRequest
  71923. * @description 上传数据。
  71924. * @version 10.1.0
  71925. * @param {number} id - 上传数据的资源ID。
  71926. * @param {Object} formData - 请求体为文本数据流。
  71927. * @returns {Promise} 返回包含上传数据操作的 Promise 对象。
  71928. */
  71929. uploadDataRequest(id,formData) {
  71930. var uploadDataUrl = this.iportalUrl + "/web/mycontent/datas/"+id+"/upload.json";
  71931. return this.request("POST",uploadDataUrl,formData);
  71932. }
  71933. /**
  71934. * @function IPortalUser.prototype.addData
  71935. * @description 上传/注册数据。
  71936. * @version 10.1.0
  71937. * @param {IPortalAddDataParam} params - 上传/注册数据所需的参数。
  71938. * @param {Object} [formData] - 请求体为文本数据流(上传数据时传入)。
  71939. * @returns {Promise} 返回上传/注册数据的 Promise 对象。
  71940. */
  71941. addData(params,formData) {
  71942. if(!(params instanceof IPortalAddDataParam)){
  71943. return this.getErrMsgPromise("params is not instanceof iPortalAddDataParam !");
  71944. }
  71945. var datasUrl = this.iportalUrl + "/web/mycontent/datas.json";
  71946. var entity = {
  71947. fileName:params.fileName,
  71948. tags:params.tags,
  71949. type:params.type
  71950. };
  71951. var type = params.type.toLowerCase();
  71952. var dataMetaInfo;
  71953. if(type === "excel" || type === "csv"){
  71954. if(!(params.dataMetaInfo instanceof IPortalDataMetaInfoParam)){
  71955. return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
  71956. }
  71957. dataMetaInfo = {
  71958. xField:params.dataMetaInfo.xField,
  71959. yField:params.dataMetaInfo.yField
  71960. }
  71961. if(type === 'csv') {
  71962. dataMetaInfo.fileEncoding = params.dataMetaInfo.fileEncoding
  71963. }
  71964. entity.coordType = "WGS84";
  71965. entity.dataMetaInfo = dataMetaInfo;
  71966. }else if(type === "hdfs" || type === "hbase") {
  71967. if(!(params.dataMetaInfo instanceof IPortalDataMetaInfoParam)){
  71968. return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
  71969. }
  71970. if(!(params.dataMetaInfo.dataStoreInfo instanceof IPortalDataStoreInfoParam)){
  71971. return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo is not instanceof iPortalDataStoreInfoParam !");
  71972. }
  71973. var dataStoreInfo = {
  71974. type:params.dataMetaInfo.dataStoreInfo.type
  71975. }
  71976. switch (type) {
  71977. case "hdfs":
  71978. dataStoreInfo.url = params.dataMetaInfo.dataStoreInfo.url;
  71979. dataMetaInfo = {
  71980. url: params.dataMetaInfo.url,
  71981. dataStoreInfo:dataStoreInfo
  71982. }
  71983. break;
  71984. case "hbase":
  71985. if(!(params.dataMetaInfo.dataStoreInfo.connectionInfo instanceof IPortalDataConnectionInfoParam)){
  71986. return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo.connectionInfo is not instanceof iPortalDataConnectionInfoParam !");
  71987. }
  71988. dataStoreInfo.connectionInfo = {
  71989. dataBase:params.dataMetaInfo.dataStoreInfo.connectionInfo.dataBase,
  71990. server:params.dataMetaInfo.dataStoreInfo.connectionInfo.server,
  71991. engineType:'HBASE'
  71992. }
  71993. dataStoreInfo.datastoreType = "SPATIAL";//该字段SPATIAL表示HBASE注册
  71994. dataMetaInfo = {
  71995. dataStoreInfo:dataStoreInfo
  71996. }
  71997. break;
  71998. }
  71999. entity.dataMetaInfo = dataMetaInfo;
  72000. }
  72001. return this.request("POST",datasUrl,JSON.stringify(entity)).then(res=>{
  72002. if(type === "hdfs" || type === "hbase"){
  72003. return res;
  72004. }else {
  72005. if(res.childID) {
  72006. return this.uploadDataRequest(res.childID,formData);
  72007. }else {
  72008. return res.customResult;
  72009. }
  72010. }
  72011. })
  72012. }
  72013. /**
  72014. * @function IPortalUser.prototype.publishOrUnpublish
  72015. * @description 发布/取消发布。
  72016. * @version 10.1.0
  72017. * @param {Object} options - 发布/取消发布数据服务所需的参数。
  72018. * @param {Object} options.dataId - 数据项ID。
  72019. * @param {Object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  72020. * @param {Object} [options.dataServiceId] - 发布的服务 ID。
  72021. * @param {boolean} forPublish - 是否取消发布。
  72022. * @returns {Promise} 返回发布/取消发布数据服务的 Promise 对象。
  72023. */
  72024. publishOrUnpublish(option,forPublish){
  72025. if(!option.dataId || !option.serviceType) {
  72026. return this.getErrMsgPromise("option.dataID and option.serviceType are Required!");
  72027. }
  72028. var dataId = option.dataId;
  72029. var dataServiceId = option.dataServiceId;
  72030. var serviceType = option.serviceType;
  72031. var publishUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?serviceType=" + serviceType;
  72032. if (dataServiceId) {
  72033. publishUrl += "&dataServiceId=" + dataServiceId;
  72034. }
  72035. return this.request("PUT",publishUrl,JSON.stringify(forPublish)).then(res=>{
  72036. // 发起服务状态查询
  72037. if(forPublish) {
  72038. // 发布服务的结果异步处理
  72039. // var publishStateUrl = this.iportalUrl + "web/mycontent/datas/" + dataId + "/publishstatus.rjson";
  72040. if (!dataServiceId) { // 发布服务时会回传serviceIDs,发布服务之前serviceIDs为空
  72041. dataServiceId = res.customResult;
  72042. }
  72043. return dataServiceId;
  72044. }else {
  72045. // 取消发布的结果同步处理
  72046. return res;
  72047. }
  72048. });
  72049. }
  72050. /**
  72051. * @function IPortalUser.prototype.getDataPublishedStatus
  72052. * @description 查询服务状态,发起服务状态查询。
  72053. * @version 10.1.0
  72054. * @param {number} dataId - 查询服务状态的数据项ID。
  72055. * @param {string} dataServiceId - 发布的服务ID。
  72056. * @returns {Promise} 返回查询服务状态的 Promise 对象。
  72057. */
  72058. getDataPublishedStatus(dataId,dataServiceId){
  72059. var publishStateUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?dataServiceId="+dataServiceId+"&forPublish=true";
  72060. return this.request("GET",publishStateUrl);
  72061. }
  72062. /**
  72063. * @function IPortalUser.prototype.unPublishedDataService
  72064. * @description 取消发布。
  72065. * @version 10.1.0
  72066. * @param {Object} options - 取消发布服务具体参数。
  72067. * @param {Object} options.dataId - 数据项ID。
  72068. * @param {Object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  72069. * @param {Object} [options.dataServiceId] - 发布的服务 ID。
  72070. * @returns {Promise} 返回取消发布数据服务的 Promise 对象。
  72071. */
  72072. unPublishDataService(option){
  72073. return this.publishOrUnpublish(option,false);
  72074. }
  72075. /**
  72076. * @function IPortalUser.prototype.publishedDataService
  72077. * @description 发布数据服务。
  72078. * @version 10.1.0
  72079. * @param {Object} options - 发布数据服务具体参数。
  72080. * @param {Object} options.dataId - 数据项ID。
  72081. * @param {Object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  72082. * @param {Object} [options.dataServiceId] - 发布的服务 ID。
  72083. * @returns {Promise} 返回发布数据服务的 Promise 对象。
  72084. */
  72085. publishDataService(option){
  72086. return this.publishOrUnpublish(option,true);
  72087. }
  72088. }
  72089. ;// CONCATENATED MODULE: ./src/common/iPortal/index.js
  72090. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72091. * This program are made available under the terms of the Apache License, Version 2.0
  72092. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72093. ;// CONCATENATED MODULE: ./src/common/iServer/AggregationParameter.js
  72094. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72095. * This program are made available under the terms of the Apache License, Version 2.0
  72096. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72097. /**
  72098. * @class AggregationParameter
  72099. * @deprecatedclass SuperMap.AggregationParameter
  72100. * @classdesc 聚合查询参数设置,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  72101. * @category iServer Data FeatureResults
  72102. * @param {Object} options - 参数。
  72103. * @param {string} options.aggName - 聚合名称。
  72104. * @param {string} options.aggFieldName - 聚合字段。
  72105. * @usage
  72106. */
  72107. class AggregationParameter {
  72108. constructor(options) {
  72109. /**
  72110. * @member {string} AggregationParameter.prototype.aggName
  72111. * @description 聚合名称。
  72112. */
  72113. this.aggName = null;
  72114. /**
  72115. * @member {string} AggregationParameter.prototype.aggFieldName
  72116. * @description 聚合字段。
  72117. */
  72118. this.aggFieldName = null;
  72119. this.CLASS_NAME = 'SuperMap.AggregationParameter';
  72120. Util_Util.extend(this, options);
  72121. }
  72122. destroy() {
  72123. var me = this;
  72124. me.aggName = null;
  72125. me.aggFieldName = null;
  72126. me.aggType = null;
  72127. }
  72128. }
  72129. ;// CONCATENATED MODULE: ./src/common/iServer/BucketAggParameter.js
  72130. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72131. * This program are made available under the terms of the Apache License, Version 2.0
  72132. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72133. /**
  72134. * @class BucketAggParameter
  72135. * @deprecatedclass SuperMap.BucketAggParameter
  72136. * @classdesc 子聚合类查询参数设置,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  72137. * @category iServer Data FeatureResults
  72138. * @param {Object} options - 参数。
  72139. * @param {Array.<MetricsAggParameter>} options.subAggs - 子聚合类集合。
  72140. * @extends {AggregationParameter}
  72141. * @usage
  72142. */
  72143. class BucketAggParameter extends AggregationParameter {
  72144. constructor(options) {
  72145. super();
  72146. /**
  72147. * @member {Array.<MetricsAggParameter>} BucketAggParameter.prototype.subAggs
  72148. * @description 子聚合类集合。
  72149. */
  72150. this.subAggs = null;
  72151. this.aggType = null;
  72152. this.CLASS_NAME = 'SuperMap.BucketAggParameter';
  72153. Util_Util.extend(this, options);
  72154. }
  72155. destroy() {
  72156. var me = this;
  72157. if (me.subAggs) {
  72158. me.subAggs = null;
  72159. }
  72160. }
  72161. }
  72162. ;// CONCATENATED MODULE: ./src/common/iServer/MetricsAggParameter.js
  72163. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72164. * This program are made available under the terms of the Apache License, Version 2.0
  72165. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72166. /**
  72167. * @class MetricsAggParameter
  72168. * @deprecatedclass SuperMap.MetricsAggParameter
  72169. * @classdesc 指标聚合查询参数类,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  72170. * @category iServer Data FeatureResults
  72171. * @param {Object} options - 可选参数。
  72172. * @param {MetricsAggType} [options.aggType = 'avg'] - 聚合类型。
  72173. * @extends {AggregationParameter}
  72174. * @usage
  72175. */
  72176. class MetricsAggParameter extends AggregationParameter {
  72177. constructor(option) {
  72178. super();
  72179. /**
  72180. * @member {MetricsAggType} [MetricsAggParameter.prototype.aggType=MetricsAggType.AVG]
  72181. * @description 指标聚合类型。
  72182. */
  72183. this.aggType = MetricsAggType.AVG;
  72184. Util_Util.extend(this, option);
  72185. this.CLASS_NAME = 'SuperMap.MetricsAggParameter';
  72186. }
  72187. destroy() {
  72188. super.destroy();
  72189. var me = this;
  72190. me.aggType = null;
  72191. }
  72192. }
  72193. ;// CONCATENATED MODULE: ./src/common/iServer/ClipParameter.js
  72194. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72195. * This program are made available under the terms of the Apache License, Version 2.0
  72196. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72197. /**
  72198. * @class ClipParameter
  72199. * @deprecatedclass SuperMap.ClipParameter
  72200. * @category iServer SpatialAnalyst InterpolationAnalyst
  72201. * @classdesc 用于裁剪的参数。优先使用用户指定的裁剪区域多边形进行裁剪,也可以通过指定数据源和数据集名,从而使用指定数据集的边界多边形进行裁剪。
  72202. * @param {Object} options - 可选参数。
  72203. * @param {string} [options.clipDatasetName] - 裁剪的数据集名。
  72204. * @param {string} [options.clipDatasourceName] - 裁剪的数据集所在数据源的名字。
  72205. * @param {GeometryPolygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON|GeoJSONObject} [options.clipRegion] - 用户指定的裁剪区域。
  72206. * @param {boolean} [options.isClipInRegion=true] - 是否对裁剪区内的数据集进行裁剪。
  72207. * @param {boolean} [options.isExactClip=true] - 是否使用精确裁剪。
  72208. * @usage
  72209. */
  72210. class ClipParameter {
  72211. constructor(options) {
  72212. /**
  72213. * @member {string} ClipParameter.prototype.clipDatasetName
  72214. * @description 用于裁剪的数据集名,clipDatasetName 与 clipRegion 必须设置一个。
  72215. */
  72216. this.clipDatasetName = null;
  72217. /**
  72218. * @member {string} ClipParameter.prototype.clipDatasourceName
  72219. * @description 用于裁剪的数据集所在数据源的名字。当 clipRegion 不设置时起作用。
  72220. */
  72221. this.clipDatasourceName = null;
  72222. /**
  72223. * @member {GeometryPolygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON|GeoJSONObject} ClipParameter.prototype.clipRegion
  72224. * @description 用户指定的裁剪区域,优先使用,clipDatasetName 与 clipRegion 必须设置一个。
  72225. */
  72226. this.clipRegion = null;
  72227. /**
  72228. * @member {boolean} [ClipParameter.prototype.isClipInRegion=true]
  72229. * @description 是否对裁剪区内的数据集进行裁剪。若为 true,则对裁剪区域内的结果进行裁剪,若为 false,则对裁剪区域外的结果进行裁剪。
  72230. */
  72231. this.isClipInRegion = true;
  72232. /**
  72233. * @member {boolean} [ClipParameter.prototype.isExactClip=true]
  72234. * @description 是否使用精确裁剪。
  72235. */
  72236. this.isExactClip = null;
  72237. if (options) {
  72238. Util_Util.extend(this, options);
  72239. }
  72240. this.CLASS_NAME = "SuperMap.ClipParameter";
  72241. }
  72242. /**
  72243. * @function ClipParameter.prototype.destroy
  72244. * @description 释放资源,将引用资源的属性置空。
  72245. */
  72246. destroy() {
  72247. var me = this;
  72248. me.clipDatasetName = null;
  72249. me.clipDatasourceName = null;
  72250. me.clipRegion = null;
  72251. me.isClipInRegion = null;
  72252. me.isExactClip = null;
  72253. }
  72254. /**
  72255. * @function ClipParameter.prototype.toJSON
  72256. * @description 将 ClipParameter 对象转化为 JSON 字符串。
  72257. * @returns {string} 返回转换后的 JSON 字符串。
  72258. */
  72259. toJSON() {
  72260. return Util_Util.toJSON({
  72261. isClipInRegion: this.isClipInRegion,
  72262. clipDatasetName: this.clipDatasetName,
  72263. clipDatasourceName: this.clipDatasourceName,
  72264. isExactClip: this.isExactClip,
  72265. clipRegion: ServerGeometry.fromGeometry(this.clipRegion)
  72266. });
  72267. }
  72268. }
  72269. ;// CONCATENATED MODULE: ./src/common/iServer/GeoHashGridAggParameter.js
  72270. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72271. * This program are made available under the terms of the Apache License, Version 2.0
  72272. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72273. /**
  72274. * @class GeoHashGridAggParameter
  72275. * @deprecatedclass SuperMap.GeoHashGridAggParameter
  72276. * @classdesc 格网聚合查询参数类,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  72277. * @category iServer Data FeatureResults
  72278. * @param {Object} options - 可选参数。
  72279. * @param {number} [options.precision=5] - 精度。
  72280. * @extends {BucketAggParameter}
  72281. * @usage
  72282. */
  72283. class GeoHashGridAggParameter extends BucketAggParameter {
  72284. constructor(options) {
  72285. super();
  72286. /**
  72287. * @member {number} [GeoHashGridAggParameter.prototype.precision=5]
  72288. * @description 网格中数字的精度。
  72289. */
  72290. this.precision = 5;
  72291. Util_Util.extend(this, options);
  72292. /**
  72293. * @member {BucketAggType} [GeoHashGridAggParameter.prototype.aggType=BucketAggType.GEOHASH_GRID]
  72294. * @description 格网聚合类型。
  72295. */
  72296. this.aggType = BucketAggType.GEOHASH_GRID;
  72297. this.CLASS_NAME = 'SuperMap.GeoHashGridAggParameter';
  72298. }
  72299. destroy() {
  72300. super.destroy();
  72301. this.aggType = null;
  72302. this.precision = null;
  72303. }
  72304. /**
  72305. * @function GeoHashGridAggParameter.toJsonParameters
  72306. * @description 将对象转为 JSON 格式。
  72307. * @param param 转换对象。
  72308. * @returns {Object}
  72309. */
  72310. static toJsonParameters(param) {
  72311. var parameters = {
  72312. aggName: param.aggName,
  72313. aggFieldName: param.aggFieldName,
  72314. aggType: param.aggType,
  72315. precision: param.precision
  72316. };
  72317. return Util_Util.toJson(parameters);
  72318. }
  72319. }
  72320. ;// CONCATENATED MODULE: ./src/common/iServer/LabelMatrixCell.js
  72321. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72322. * This program are made available under the terms of the Apache License, Version 2.0
  72323. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72324. /**
  72325. * @class LabelMatrixCell
  72326. * @deprecatedclass SuperMap.LabelMatrixCell
  72327. * @category iServer Map Theme
  72328. * @classdesc 矩阵标签元素抽象类。该类可以包含 n*n 个矩阵标签元素,矩阵标签元素的类型可以是图片,符号,标签专题图等。
  72329. * 符号类型的矩阵标签元素类、图片类型的矩阵标签元素类和专题图类型的矩阵标签元素类均继承自该类。
  72330. * @usage
  72331. */
  72332. class LabelMatrixCell {
  72333. constructor() {
  72334. this.CLASS_NAME = "LabelMatrixCell";
  72335. }
  72336. }
  72337. ;// CONCATENATED MODULE: ./src/common/iServer/LabelImageCell.js
  72338. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72339. * This program are made available under the terms of the Apache License, Version 2.0
  72340. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72341. /**
  72342. * @class LabelImageCell
  72343. * @deprecatedclass SuperMap.LabelImageCell
  72344. * @category iServer Map Theme
  72345. * @classdesc 图片类型的矩阵标签元素类。该类继承自 {@link LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  72346. * 矩阵标签专题图是标签专题图(ThemeLabel)的一种,其中矩阵标签中的填充元素又可分为图片类型({@link LabelImageCell})、
  72347. * 符号类型({@link LabelSymbolCell})、专题图类型({@link LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  72348. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应)、大小等。
  72349. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link ThemeLabel#matrixCells} 属性即可。matrixCells 是一个二维数组,
  72350. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  72351. * @extends {LabelMatrixCell}
  72352. * @param {Object} options - 可选参数。
  72353. * @param {number} [options.height=0] - 设置图片的高度,单位为毫米。
  72354. * @param {string} [options.pathField] - 设置矩阵标签元素所使用图片的路径。
  72355. * @param {number} [options.rotation=0.0] - 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
  72356. * @param {number} [options.width=0] - 设置图片的宽度,单位为毫米。
  72357. * @param {boolean} [options.sizeFixed=false] - 是否固定图片的大小。
  72358. * @usage
  72359. */
  72360. class LabelImageCell extends LabelMatrixCell {
  72361. constructor(options) {
  72362. super(options);
  72363. /**
  72364. * @member {number} LabelImageCell.prototype.height
  72365. * @description 设置图片的高度,单位为毫米。
  72366. */
  72367. this.height = 0;
  72368. /**
  72369. * @member {string} LabelImageCell.prototype.pathField
  72370. * @description 设置矩阵标签元素所使用的图片路径对应的字段名。
  72371. */
  72372. this.pathField = null;
  72373. /**
  72374. * @member {number} [LabelImageCell.prototype.rotation=0.0]
  72375. * @description 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
  72376. */
  72377. this.rotation = 0.0;
  72378. /**
  72379. * @member {number} LabelImageCell.prototype.width
  72380. * @description 设置图片的宽度,单位为毫米。
  72381. */
  72382. this.width = 0;
  72383. /**
  72384. * @member {boolean} [LabelImageCell.prototype.sizeFixed=false]
  72385. * @description 是否固定图片的大小。
  72386. */
  72387. this.sizeFixed = false;
  72388. /**
  72389. * @member {string} LabelImageCell.prototype.type
  72390. * @description 制作矩阵专题图时是必须的。
  72391. */
  72392. this.type = "IMAGE";
  72393. if (options) {
  72394. Util_Util.extend(this, options);
  72395. }
  72396. this.CLASS_NAME = "SuperMap.LabelImageCell";
  72397. }
  72398. /**
  72399. * @function LabelImageCell.prototype.destroy
  72400. * @description 释放资源,将引用资源的属性置空。
  72401. */
  72402. destroy() {
  72403. var me = this;
  72404. me.height = null;
  72405. me.pathField = null;
  72406. me.rotation = null;
  72407. me.width = null;
  72408. me.sizeFixed = null;
  72409. }
  72410. }
  72411. ;// CONCATENATED MODULE: ./src/common/iServer/LabelSymbolCell.js
  72412. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72413. * This program are made available under the terms of the Apache License, Version 2.0
  72414. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72415. /**
  72416. * @class LabelSymbolCell
  72417. * @deprecatedclass SuperMap.LabelSymbolCell
  72418. * @category iServer Map Theme
  72419. * @classdesc 符号类型的矩阵标签元素类。
  72420. * 该类继承自 {@link LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  72421. * 矩阵标签专题图是标签专题图({@link ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link LabelImageCell})、
  72422. * 符号类型({@link LabelSymbolCell})、专题图类型({@link LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  72423. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应)、大小等。
  72424. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link ThemeLabel#matrixCells} 属性即可。matrixCells 属性是一个二维数组,
  72425. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  72426. * @extends {LabelMatrixCell}
  72427. * @param {Object} options - 参数。
  72428. * @param {ServerStyle} options.style - 获取或设置符号样式。
  72429. * @param {string} options.symbolIDField - 符号 ID 或符号 ID 所对应的字段名称。
  72430. * @usage
  72431. */
  72432. class LabelSymbolCell extends LabelMatrixCell {
  72433. constructor(options) {
  72434. super(options);
  72435. /**
  72436. * @member {ServerStyle} LabelSymbolCell.prototype.style
  72437. * @description 获取或设置符号样式—— {@link ServerStyle} 对象,包括符号大小({@link ServerStyle#markerSize})
  72438. * 和符号旋转({@link ServerStyle#markerAngle})角度,其中用于设置符号 ID 的属性({@link ServerStyle#markerSymbolID})在此处不起作用。
  72439. */
  72440. this.style = new ServerStyle();
  72441. /**
  72442. * @member {string} LabelSymbolCell.prototype.symbolIDField
  72443. * @description 获取或设置符号 ID 或符号 ID 所对应的字段名称。
  72444. */
  72445. this.symbolIDField = null;
  72446. /**
  72447. * @member {string} LabelSymbolCell.prototype.type
  72448. * @description 制作矩阵专题图时是必须的。
  72449. */
  72450. this.type = "SYMBOL";
  72451. if (options) {
  72452. Util_Util.extend(this, options);
  72453. }
  72454. this.CLASS_NAME = "SuperMap.LabelSymbolCell";
  72455. }
  72456. /**
  72457. * @function LabelSymbolCell.prototype.destroy
  72458. * @description 释放资源,将引用资源的属性置空。
  72459. */
  72460. destroy() {
  72461. var me = this;
  72462. if (me.style) {
  72463. me.style.destroy();
  72464. me.style = null;
  72465. }
  72466. me.symbolIDField = null;
  72467. }
  72468. }
  72469. ;// CONCATENATED MODULE: ./src/common/iServer/LabelThemeCell.js
  72470. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72471. * This program are made available under the terms of the Apache License, Version 2.0
  72472. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72473. /**
  72474. * @class LabelThemeCell
  72475. * @deprecatedclass SuperMap.LabelThemeCell
  72476. * @category iServer Map Theme
  72477. * @classdesc 专题图类型的矩阵标签元素类。
  72478. * 该类继承自 {@link LabelMatrixCell} 类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  72479. * 矩阵标签专题图是标签专题图({@link ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link LabelImageCell})、
  72480. * 符号类型({@link LabelSymbolCell})、专题图类型({@link LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  72481. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应)、大小等。
  72482. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link ThemeLabel#matrixCells} 属性即可。matrixCells 属性是一个二维数组,
  72483. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  72484. * @extends {LabelMatrixCell}
  72485. * @param {Object} options -参数。
  72486. * @param {ThemeLabel} options.themeLabel - 作为矩阵标签元素的标签专题图类。
  72487. * @usage
  72488. */
  72489. class LabelThemeCell extends LabelMatrixCell {
  72490. constructor(options) {
  72491. super(options);
  72492. /**
  72493. * @member {ThemeLabel} LabelThemeCell.prototype.themeLabel
  72494. * @description 使用专题图对象作为矩阵标签的一个元素。
  72495. */
  72496. this.themeLabel = new ThemeLabel();
  72497. /**
  72498. * @member {string} LabelThemeCell.prototype.type
  72499. * @description 制作矩阵专题图时是必须的。
  72500. */
  72501. this.type = "THEME";
  72502. if (options) {
  72503. Util_Util.extend(this, options);
  72504. }
  72505. this.CLASS_NAME = " SuperMap.LabelThemeCell";
  72506. }
  72507. /**
  72508. * @function LabelThemeCell.prototype.destroy
  72509. * @description 释放资源,将引用资源的属性置空。
  72510. */
  72511. destroy() {
  72512. var me = this;
  72513. if (me.themeLabel) {
  72514. me.themeLabel.destroy();
  72515. me.themeLabel = null;
  72516. }
  72517. }
  72518. }
  72519. ;// CONCATENATED MODULE: ./src/common/iServer/LayerStatus.js
  72520. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72521. * This program are made available under the terms of the Apache License, Version 2.0
  72522. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72523. /**
  72524. * @class LayerStatus
  72525. * @deprecatedclass SuperMap.LayerStatus
  72526. * @category iServer Map TempLayersSet
  72527. * @classdesc 子图层显示参数类。该类存储了各个子图层的名字和是否可见的状态。
  72528. * @param {Object} options - 参数。
  72529. * @param {string} options.layerName - 图层名称。
  72530. * @param {boolean} [options.isVisible=true] - 图层是否可见,true 表示可见。
  72531. * @param {string} [options.displayFilter] - 图层显示 SQL 过滤条件。
  72532. * @usage
  72533. */
  72534. class LayerStatus {
  72535. constructor(options) {
  72536. /**
  72537. * @member {string} LayerStatus.prototype.layerName
  72538. * @description 获取或设置图层名称。
  72539. */
  72540. this.layerName = null;
  72541. /**
  72542. * @member {boolean} LayerStatus.prototype.isVisible
  72543. * @description 获取或设置图层是否可见,true 表示可见。
  72544. */
  72545. this.isVisible = null;
  72546. /**
  72547. * @member {string} [LayerStatus.prototype.displayFilter]
  72548. * @description 图层显示 SQL 过滤条件,如 layerStatus.displayFilter = "smid < 10",表示仅显示 smid 值小于 10 的对象。
  72549. */
  72550. this.displayFilter = null;
  72551. /**
  72552. * @member {Object} [LayerStatus.prototype.fieldValuesDisplayFilter]
  72553. * @property {Array.<number>} values - 要过滤的值。
  72554. * @property {string} fieldName - 要过滤的字段名称只支持数字类型的字段。
  72555. * @property {string} fieldValuesDisplayMode - 目前有两个 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
  72556. */
  72557. this.fieldValuesDisplayFilter = null;
  72558. if (options) {
  72559. Util_Util.extend(this, options);
  72560. }
  72561. this.CLASS_NAME = "SuperMap.LayerStatus";
  72562. }
  72563. /**
  72564. * @function LayerStatus.prototype.destroy
  72565. * @description 释放资源,将引用资源的属性置空。
  72566. */
  72567. destroy() {
  72568. var me = this;
  72569. me.layerName = null;
  72570. me.isVisible = null;
  72571. me.displayFilter = null;
  72572. }
  72573. /**
  72574. * @function LayerStatus.prototype.toJSON
  72575. * @description 生成对应的 JSON。
  72576. * @returns {Object} 对应的 JSON。
  72577. */
  72578. toJSON() {
  72579. var json = '{';
  72580. json += '"type":"UGC",';
  72581. var v = [];
  72582. if (this.layerName) {
  72583. v.push('"name":"' + this.layerName + '"');
  72584. v.push('"visible":' + this.isVisible);
  72585. }
  72586. if (this.displayFilter) {
  72587. v.push('"displayFilter":"' + this.displayFilter + '"');
  72588. }
  72589. if (this.minScale || this.minScale == 0) {
  72590. v.push('"minScale":' + this.minScale);
  72591. }
  72592. if (this.maxScale || this.maxScale == 0) {
  72593. v.push('"maxScale":' + this.maxScale);
  72594. }
  72595. if (this.fieldValuesDisplayFilter) {
  72596. v.push('"fieldValuesDisplayFilter":' + Util_Util.toJSON(this.fieldValuesDisplayFilter));
  72597. }
  72598. json += v;
  72599. json += '}';
  72600. return json;
  72601. }
  72602. }
  72603. ;// CONCATENATED MODULE: ./src/common/iServer/LinkItem.js
  72604. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72605. * This program are made available under the terms of the Apache License, Version 2.0
  72606. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72607. /**
  72608. * @class LinkItem
  72609. * @deprecatedclass SuperMap.LinkItem
  72610. * @constructs LinkItem
  72611. * @category iServer Data FeatureResults
  72612. * @classdesc 关联信息类。该类用于矢量数据集与外部表的关联。外部表是另一个数据集(其中纯属性数据集中没有空间几何信息)中的 DBMS 表,
  72613. * 矢量数据集与外部表可以属于不同的数据源,但数据源类型目前只支持 SQL Server 和 Oracle 类型。使用 LinkItem 时,
  72614. * 空间数据和属性数据必须满足关联条件,即主空间数据集与外部属性表之间存在关联字段。{@link LinkItem}
  72615. * 只支持左连接,UDB、PostgreSQL 和 DB2 数据源不支持 {@link LinkItem};另外,用于建立关联关系的两个表可以不在同一个数据源下。注意:<br>
  72616. * 1.使用 {@link LinkItem} 的约束条件为:空间数据和属性数据必须有关联条件,即主空间数据集与外部属性表之间存在关联字段;<br>
  72617. * 2.使用外关联表制作专题图时,所关联的字段必须设置表名,例如,如果所关联的字段为 BaseMap_R 数据集的 SmID,就要写成 BaseMap_R.SMID。
  72618. * @param {Object} options - 参数。
  72619. * @param {DatasourceConnectionInfo} options.datasourceConnectionInfo - 关联的外部数据源信息。
  72620. * @param {Array.<string>} options.foreignKeys - 主空间数据集的外键。
  72621. * @param {string} options.foreignTable - 关联的外部属性表的名称。
  72622. * @param {Array.<string>} options.linkFields - 欲保留的外部属性表的字段。
  72623. * @param {string} options.linkFilter - 与外部属性表的连接条件。
  72624. * @param {string} options.name - 此关联信息对象的名称。
  72625. * @param {Array.<string>} options.primaryKeys - 关联的外部属性表的主键。
  72626. * @example 下面以 SQL 查询说明 linkitem 的使用方法:
  72627. * function queryBySQL() {
  72628. * // 设置关联的外部数据库信息,alias表示数据库别名
  72629. * var dc = new DatasourceConnectionInfo({
  72630. * dataBase: "RelQuery",
  72631. * server: "{ip}:{port}",
  72632. * user: "sa",
  72633. * password: "map",
  72634. * driver: "SQL Server",
  72635. * connect: true,
  72636. * OpenLinkTable: false,
  72637. * alias: "RelQuery",
  72638. * engineType: EngineType.SQLPLUS,
  72639. * readOnly: false,
  72640. * exclusive: false
  72641. * });
  72642. * // 设置关联信息
  72643. * var linkItem = new LinkItem({
  72644. * datasourceConnectionInfo: dc,
  72645. * foreignKeys: ["name"],
  72646. * foreignTable: "Pop_2011",
  72647. * linkFields: ["SmID as Pid","pop"],
  72648. * name: "link",
  72649. * primatryKeys: ["name"],
  72650. * });
  72651. * // 设置查询参数,在查询参数中添加linkItem关联条件信息
  72652. * var queryParam, queryBySQLParams, queryBySQLService;
  72653. * queryParam = new FilterParameter({
  72654. * name: "Province@RelQuery",
  72655. * fields: ["SmID","name"],
  72656. * attributeFilter: "SmID<7",
  72657. * linkItems: [linkItem]
  72658. * }),
  72659. * queryBySQLParams = new QueryBySQLParameters({
  72660. * queryParams: [queryParam]
  72661. * }),
  72662. * queryBySQLService = new QueryBySQLService(url, {
  72663. * eventListeners: {
  72664. * "processCompleted": processCompleted,
  72665. * "processFailed": processFailed
  72666. * }
  72667. * });
  72668. * queryBySQLService.processAsync(queryBySQLParams);
  72669. * }
  72670. * function processCompleted(queryEventArgs) {//todo}
  72671. * function processFailed(e) {//todo}
  72672. * @usage
  72673. */
  72674. class LinkItem {
  72675. constructor(options) {
  72676. /**
  72677. * @member {DatasourceConnectionInfo} LinkItem.prototype.datasourceConnectionInfo
  72678. * @description 关联的外部数据源信息。
  72679. */
  72680. this.datasourceConnectionInfo = null;
  72681. /**
  72682. * @member {Array.<string>} LinkItem.prototype.foreignKeys
  72683. * @description 主空间数据集的外键。
  72684. */
  72685. this.foreignKeys = null;
  72686. /**
  72687. * @member {string} LinkItem.prototype.foreignTable
  72688. * @description 关联的外部属性表的名称,目前仅支持 Supermap 管理的表,即另一个矢量数据集所对应的 DBMS 表。
  72689. */
  72690. this.foreignTable = null;
  72691. /**
  72692. * @member {Array.<string>} LinkItem.prototype.linkFields
  72693. * @description 欲保留的外部属性表的字段。如果不设置字段或者设置的字段在外部属性表中不存在的话则不返回任何外部属性表的属性信息。如果欲保留的外部表字段与主表字段存在同名,则还需要指定一个不存在字段名作为外部表的字段别名。
  72694. */
  72695. this.linkFields = null;
  72696. /**
  72697. * @member {string} LinkItem.prototype.linkFilter
  72698. * @description 与外部属性表的连接条件。
  72699. */
  72700. this.linkFilter = null;
  72701. /**
  72702. * @member {string} LinkItem.prototype.name
  72703. * @description 此关联信息对象的名称。
  72704. */
  72705. this.name = null;
  72706. /**
  72707. * @member {Array.<string>} LinkItem.prototype.primaryKeys
  72708. * @description 需要关联的外部属性表的主键。
  72709. */
  72710. this.primaryKeys = null;
  72711. if (options) {
  72712. Util_Util.extend(this, options);
  72713. }
  72714. this.CLASS_NAME = "SuperMap.LinkItem";
  72715. }
  72716. /**
  72717. * @function LinkItem.prototype.destroy
  72718. * @description 释放资源,将引用资源的属性置空。
  72719. */
  72720. destroy() {
  72721. var me = this;
  72722. if (me.datasourceConnectionInfo instanceof DatasourceConnectionInfo) {
  72723. me.datasourceConnectionInfo.destroy();
  72724. me.datasourceConnectionInfo = null;
  72725. }
  72726. me.foreignKeys = null;
  72727. me.foreignTable = null;
  72728. me.linkFields = null;
  72729. me.linkFilter = null;
  72730. me.name = null;
  72731. me.primaryKeys = null;
  72732. }
  72733. }
  72734. ;// CONCATENATED MODULE: ./src/common/iServer/OverlapDisplayedOptions.js
  72735. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72736. * This program are made available under the terms of the Apache License, Version 2.0
  72737. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72738. /**
  72739. * @class OverlapDisplayedOptions
  72740. * @deprecatedclass SuperMap.OverlapDisplayedOptions
  72741. * @category iServer Map Layer
  72742. * @classdesc 地图压盖过滤显示选项。在文本或专题图元素显示较密集的区域,文本之间或专题元素之间会发生相互压盖的现象,
  72743. * 该类可以分别控制各种类型的对象的压盖显示情况,进而很好地处理地图中各种类型对象的压盖显示问题。
  72744. * @param {Object} options - 可选参数。
  72745. * @param {boolean} [options.allowPointOverlap=true] - 点和点压盖时是否显示压盖的点对象。
  72746. * @param {boolean} [options.allowPointWithTextDisplay=true] - 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
  72747. * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
  72748. * @param {boolean} [options.allowTextOverlap=false] - 文本压盖时是否显示压盖的文本对象。
  72749. * @param {boolean} [options.allowTextAndPointOverlap=true] - 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
  72750. * @param {boolean} [options.allowThemeGraduatedSymbolOverlap=false] - 等级符号元素压盖时是否显示压盖的等级符号元素。
  72751. * @param {boolean} [options.allowThemeGraphOverlap=false] - 统计专题图元素压盖时是否显示压盖的统计专题图元素。
  72752. * @param {number} [options.horizontalOverlappedSpaceSize=0] - 两个对象之间的横向压盖间距,单位为 0.1 毫米,跟 verticalOverlappedSpaceSize 结合使用,
  72753. * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
  72754. * @param {number} [options.verticalOverlappedSpaceSize=0] - 两个对象之间的纵向压盖间距,单位为 0.1 毫米,跟 horizontalOverlappedSpaceSize 结合使用,
  72755. * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
  72756. * @usage
  72757. */
  72758. class OverlapDisplayedOptions {
  72759. constructor(options) {
  72760. options = options || {};
  72761. /**
  72762. * @member {boolean} [OverlapDisplayedOptions.prototype.allowPointOverlap=true]
  72763. * @description 点和点压盖时是否显示压盖的点对象。
  72764. */
  72765. this.allowPointOverlap = true;
  72766. /**
  72767. * @member {boolean} [OverlapDisplayedOptions.prototype.allowPointWithTextDisplay=true]
  72768. * @description 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
  72769. * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
  72770. */
  72771. this.allowPointWithTextDisplay = true;
  72772. /**
  72773. * @member {boolean} [OverlapDisplayedOptions.prototype.allowTextOverlap=false]
  72774. * @description 文本压盖时是否显示压盖的文本对象。
  72775. */
  72776. this.allowTextOverlap = false;
  72777. /**
  72778. * @member {boolean} [OverlapDisplayedOptions.prototype.allowTextAndPointOverlap=true]
  72779. * @description 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
  72780. */
  72781. this.allowTextAndPointOverlap = true;
  72782. /**
  72783. * @member {boolean} [OverlapDisplayedOptions.prototype.allowThemeGraduatedSymbolOverlap=false]
  72784. * @description 等级符号元素压盖时是否显示压盖的等级符号元素。
  72785. */
  72786. this.allowThemeGraduatedSymbolOverlap = false;
  72787. /**
  72788. * @member {boolean} [OverlapDisplayedOptions.prototype.allowThemeGraphOverlap=false]
  72789. * @description 统计专题图元素压盖时是否显示压盖的统计专题图元素。
  72790. */
  72791. this.allowThemeGraphOverlap = false;
  72792. /**
  72793. * @member {number} [OverlapDisplayedOptions.prototype.horizontalOverlappedSpaceSize=0]
  72794. * @description 两个对象之间的横向压盖间距,单位为0.1毫米,跟 verticalOverlappedSpaceSize 结合使用,
  72795. * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
  72796. */
  72797. this.horizontalOverlappedSpaceSize = 0;
  72798. /**
  72799. * @member {number} [OverlapDisplayedOptions.prototype.verticalOverlappedSpaceSize=0]
  72800. * @description 两个对象之间的纵向压盖间距,单位为0.1毫米,跟 horizontalOverlappedSpaceSize 结合使用,
  72801. * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
  72802. */
  72803. this.verticalOverlappedSpaceSize = 0;
  72804. Util_Util.extend(this, options);
  72805. this.ugcLayer = new UGCLayer(options);
  72806. this.CLASS_NAME = "SuperMap.OverlapDisplayedOptions";
  72807. }
  72808. /**
  72809. * @function OverlapDisplayedOptions.prototype.destroy
  72810. * @description 释放资源,将资源的属性置空。
  72811. */
  72812. destroy() {
  72813. Util_Util.reset(this);
  72814. }
  72815. /**
  72816. * @function OverlapDisplayedOptions.prototype.fromJson
  72817. * @description 将服务端 JSON 对象转换成当前客户端对象。
  72818. * @param {Object} jsonObject - 要转换的 JSON 对象。
  72819. */
  72820. fromJson(jsonObject) {
  72821. this.ugcLayer.fromJson.apply(this, [jsonObject]);
  72822. }
  72823. /**
  72824. * @function OverlapDisplayedOptions.prototype.toServerJSONObject
  72825. * @description 转换成对应的 JSON 格式对象。
  72826. * @returns {Object} 对应的 JSON 格式对象。
  72827. */
  72828. toServerJSONObject() {
  72829. var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
  72830. return jsonObject;
  72831. }
  72832. /**
  72833. * @function OverlapDisplayedOptions.prototype.toString
  72834. * @description 转换成对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
  72835. * @returns {string} 对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
  72836. */
  72837. toString() {
  72838. var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
  72839. var str = "{";
  72840. for (var attr in jsonObject) {
  72841. if (jsonObject.hasOwnProperty(attr)) {
  72842. str += "'" + attr + "':" + jsonObject[attr] + ",";
  72843. }
  72844. }
  72845. str = str.substr(0, str.length - 1);
  72846. str += "}";
  72847. return str;
  72848. }
  72849. }
  72850. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoParameters.js
  72851. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72852. * This program are made available under the terms of the Apache License, Version 2.0
  72853. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72854. /**
  72855. * @class SetLayerInfoParameters
  72856. * @deprecatedclass SuperMap.SetLayerInfoParameters
  72857. * @category iServer Map TempLayersSet
  72858. * @classdesc 设置图层信息参数类。
  72859. * @param {Object} options - 参数。
  72860. * @param {string} options.resourceID - 临时图层的资源 ID。
  72861. * @param {string} options.tempLayerName - 临时图层下的子图层名。
  72862. * @param {string} options.layerInfo - 要更新的图层信息。
  72863. * @usage
  72864. */
  72865. class SetLayerInfoParameters {
  72866. constructor(options) {
  72867. options = options || {};
  72868. /**
  72869. * @member {string} SetLayerInfoParameters.prototype.resourceID
  72870. * @description 临时图层的资源 ID。
  72871. */
  72872. this.resourceID = null;
  72873. /**
  72874. * @member {string} SetLayerInfoParameters.prototype.tempLayerName
  72875. * @description 临时图层下子图层(或者其子图层)名,如:Countries@World.3@@World。
  72876. */
  72877. this.tempLayerName = null;
  72878. /**
  72879. * @member {Object} SetLayerInfoParameters.prototype.layerInfo
  72880. * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
  72881. */
  72882. this.layerInfo = null;
  72883. Util_Util.extend(this, options);
  72884. this.CLASS_NAME = "SuperMap.SetLayerInfoParameters";
  72885. }
  72886. /**
  72887. * @function SetLayerInfoParameters.prototype.destroy
  72888. * @description 释放资源,将引用资源的属性置空。
  72889. */
  72890. destroy() {
  72891. var me = this;
  72892. me.resourceID = null;
  72893. me.tempLayerName = null;
  72894. me.layerInfo = null;
  72895. }
  72896. }
  72897. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoParameters.js
  72898. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72899. * This program are made available under the terms of the Apache License, Version 2.0
  72900. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72901. /**
  72902. * @class SetLayersInfoParameters
  72903. * @deprecatedclass SuperMap.SetLayersInfoParameters
  72904. * @category iServer Map TempLayersSet
  72905. * @classdesc 设置图层信息参数类。
  72906. * @param {Object} options - 参数。
  72907. * @param {boolean} [options.isTempLayers=false] - 是否是临时图层。
  72908. * @param {string} options.resourceID - 临时图层资源 ID。
  72909. * @param {Object} options.layersInfo - 要更新的图层信息。
  72910. * @usage
  72911. */
  72912. class SetLayersInfoParameters {
  72913. constructor(options) {
  72914. options = options || {};
  72915. /**
  72916. * @member {boolean} [SetLayersInfoParameters.prototype.isTempLayers=false]
  72917. * @description 是否是临时图层。
  72918. */
  72919. this.isTempLayers = null;
  72920. /**
  72921. * @member {string} SetLayersInfoParameters.prototype.resourceID
  72922. * @description 临时图层资源 ID。
  72923. */
  72924. this.resourceID = null;
  72925. /**
  72926. * @member {Object} SetLayersInfoParameters.prototype.layersInfo
  72927. * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
  72928. */
  72929. this.layersInfo = null;
  72930. Util_Util.extend(this, options);
  72931. this.CLASS_NAME = "SuperMap.SetLayersInfoParameters";
  72932. }
  72933. /**
  72934. * @function SetLayersInfoParameters.prototype.destroy
  72935. * @description 释放资源,将引用资源的属性置空。
  72936. */
  72937. destroy() {
  72938. var me = this;
  72939. me.isTempLayers = null;
  72940. me.resourceID = null;
  72941. me.layersInfo = null;
  72942. }
  72943. }
  72944. ;// CONCATENATED MODULE: ./src/common/iServer/SupplyCenter.js
  72945. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72946. * This program are made available under the terms of the Apache License, Version 2.0
  72947. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72948. /**
  72949. * @class SupplyCenter
  72950. * @deprecatedclass SuperMap.SupplyCenter
  72951. * @category iServer NetworkAnalyst Location
  72952. * @classdesc 资源供给中心类。在资源分配和选址分区分析两个功能中使用。
  72953. * @param {Object} options - 参数。
  72954. * @param {number} options.maxWeight - 最大耗费值。
  72955. * @param {number} options.nodeID - 结点 ID 号。资源供给中心必须是结点。
  72956. * @param {number} options.resourceValue - 能提供的最大服务量或商品数量。
  72957. * @param {SupplyCenterType} [options.type] - 资源供给中心点的类型常量。
  72958. * @usage
  72959. */
  72960. class SupplyCenter {
  72961. constructor(options) {
  72962. /**
  72963. * @member {number} SupplyCenter.prototype.maxWeight
  72964. * @description 资源供给中心的最大耗费值。中心点最大阻值设置越小,表示中心点所提供的资源可影响范围越大。
  72965. * 最大阻力值是用来限制需求点到中心点的花费。
  72966. * 如果需求点(弧段或结点)到此中心的花费大于最大阻力值,则该需求点不属于该资源供给中心提供资源的范围。
  72967. */
  72968. this.maxWeight = null;
  72969. /**
  72970. * @member {number} SupplyCenter.prototype.nodeID
  72971. * @description 资源供给中心点的结点 ID 号,资源供给中心必须是结点。
  72972. */
  72973. this.nodeID = null;
  72974. /**
  72975. * @member {number} SupplyCenter.prototype.resourceValue
  72976. * @description 资源供给中心能提供的最大服务量或商品数量。例如资源中心为学校,资源中心资源量表示该学校能够接纳多少学生。
  72977. */
  72978. this.resourceValue = null;
  72979. /**
  72980. * @member {SupplyCenterType} [SupplyCenter.prototype.type]
  72981. * @description 资源供给中心点的类型常量。资源供给中心点的类型包括非中心,固定中心和可选中心。
  72982. * 固定中心用于资源分配分析;固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  72983. */
  72984. this.type = null;
  72985. if (options) {
  72986. Util_Util.extend(this, options);
  72987. }
  72988. this.CLASS_NAME = "SuperMap.SupplyCenter";
  72989. }
  72990. /**
  72991. * @function SupplyCenter.prototype.destroy
  72992. * @description 释放资源,将引用资源的属性置空。
  72993. */
  72994. destroy() {
  72995. var me = this;
  72996. me.maxWeight = null;
  72997. me.nodeID = null;
  72998. me.resourceValue = null;
  72999. me.type = null;
  73000. }
  73001. /**
  73002. * @function SupplyCenter.fromJson
  73003. * @description 将服务端 JSON 对象转换成当前客户端对象。
  73004. * @param {Object} jsonObject - 要转换的 JSON 对象。
  73005. * @returns {SupplyCenter} SupplyCenter 对象。
  73006. */
  73007. static fromJson(jsonObject) {
  73008. if (!jsonObject) {
  73009. return;
  73010. }
  73011. return new SupplyCenter({
  73012. maxWeight: jsonObject.maxWeight,
  73013. nodeID: jsonObject.nodeID,
  73014. resourceValue: jsonObject.resourceValue,
  73015. type: jsonObject.type
  73016. });
  73017. }
  73018. }
  73019. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeFlow.js
  73020. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73021. * This program are made available under the terms of the Apache License, Version 2.0
  73022. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73023. /**
  73024. * @class ThemeFlow
  73025. * @deprecatedclass SuperMap.ThemeFlow
  73026. * @private
  73027. * @category iServer Map Theme
  73028. * @classdesc 标签或符号流动显示和牵引线风格设置类。
  73029. * 通过该类可以设置专题图中符号是否流动显示、是否使用牵引线以及牵引线风格。
  73030. * @param {Object} options - 可选参数。
  73031. * @param {boolean} [options.flowEnabled=false] - 是否流动显示标签或符号。
  73032. * @param {boolean} [options.leaderLineDisplayed=false] - 是否显示标签或符号和它标注的对象之间的牵引线。
  73033. * @param {ServerStyle} [options.leaderLineStyle] - 标签或符号与其标注对象之间牵引线的风格。
  73034. * @usage
  73035. */
  73036. class ThemeFlow {
  73037. constructor(options) {
  73038. /**
  73039. * @member {boolean} [ThemeFlow.prototype.flowEnabled=false]
  73040. * @description 是否流动显示标签或符号。<br>
  73041. * 对于标签专题图而言,对于跨越比较大的区域和线条状的几何对象,在一个地图窗口中不能完全显示的情况下,如果其标签位置比较固定,
  73042. * 在当前地图窗口中该对象的标签不可见,则需要通过平移地图来查看对象的标签信息。如果采用了流动显示的效果,在当前地图窗口中,对象即使是部分显示,
  73043. * 其标签也会显示在当前地图窗口中。当平移地图时,对象的标签会随之移动,以保证在当前地图窗口中部分或全部显示的对象其标签都可见,从而可以方便地查看各要素的标签信息。
  73044. */
  73045. this.flowEnabled = false;
  73046. /**
  73047. * @member {boolean} [ThemeFlow.prototype.leaderLineDisplayed=false]
  73048. * @description 是否显示标签或符号和它标注的对象之间的牵引线。false表示不显示标签或符号和它标注的对象之间的牵引线。<br>
  73049. * 只有当 flowEnabled 为 true 时,牵引线才起作用。在当标签流动显示时,其位置不固定,由于牵引线始终指向要素的内点,
  73050. * 因而通过牵引线显示功能可以找到流动的标签或符号实际对应的要素。或者渲染符号偏移它所指向的对象时,图与对象之间可以采用牵引线进行连接。
  73051. */
  73052. this.leaderLineDisplayed = false;
  73053. /**
  73054. * @member {ServerStyle} ThemeFlow.prototype.leaderLineStyle
  73055. * @description 标签或符号与其标注对象之间牵引线的风格。
  73056. */
  73057. this.leaderLineStyle = new ServerStyle();
  73058. if (options) {
  73059. Util_Util.extend(this, options);
  73060. }
  73061. this.CLASS_NAME = "SuperMap.ThemeFlow";
  73062. }
  73063. /**
  73064. * @function ThemeFlow.prototype.destroy
  73065. * @description 释放资源,将引用资源的属性置空。
  73066. */
  73067. destroy() {
  73068. var me = this;
  73069. me.flowEnabled = null;
  73070. me.leaderLineDisplayed = null;
  73071. if (me.leaderLineStyle) {
  73072. me.leaderLineStyle.destroy();
  73073. me.leaderLineStyle = null;
  73074. }
  73075. }
  73076. /**
  73077. * @function ThemeFlow.fromObj
  73078. * @description 从传入对象获取标签或符号流动显示和牵引线风格设置类。
  73079. * @param {Object} obj - 传入对象。
  73080. * @returns {ThemeFlow} ThemeFlow 对象。
  73081. */
  73082. static fromObj(obj) {
  73083. if (!obj) {
  73084. return;
  73085. }
  73086. var res = new ThemeFlow();
  73087. Util_Util.copy(res, obj);
  73088. res.leaderLineStyle = ServerStyle.fromJson(obj.leaderLineStyle);
  73089. return res;
  73090. }
  73091. }
  73092. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridRangeItem.js
  73093. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73094. * This program are made available under the terms of the Apache License, Version 2.0
  73095. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73096. /**
  73097. * @class ThemeGridRangeItem
  73098. * @deprecatedclass SuperMap.ThemeGridRangeItem
  73099. * @category iServer Map Theme
  73100. * @classdesc 栅格分段专题图子项类。在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
  73101. * 本类用来设置每个范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
  73102. * @param {Object} options - 参数。
  73103. * @param {ServerColor} options.color - 栅格分段专题图中每一个分段专题图子项的对应的颜色。
  73104. * @param {string} [options.caption] - 栅格分段专题图子项的标题。
  73105. * @param {number} [options.end=0] - 栅格分段专题图子项的终止值。
  73106. * @param {number} [options.start=0] - 栅格分段专题图子项的起始值。
  73107. * @param {boolean} [options.visible=true] - 栅格分段专题图子项是否可见。
  73108. * @usage
  73109. */
  73110. class ThemeGridRangeItem {
  73111. constructor(options) {
  73112. /**
  73113. * @member {string} [ThemeGridRangeItem.prototype.caption]
  73114. * @description 栅格分段专题图子项的标题。
  73115. */
  73116. this.caption = null;
  73117. /**
  73118. * @member {ServerColor} ThemeGridRangeItem.prototype.color
  73119. * @description 栅格分段专题图中每一个分段专题图子项的对应的颜色。
  73120. */
  73121. this.color = new ServerColor();
  73122. /**
  73123. * @member {number} [ThemeGridRangeItem.prototype.end=0]
  73124. * @description 栅格分段专题图子项的终止值,即该段专题值范围的最大值。
  73125. */
  73126. this.end = 0;
  73127. /**
  73128. * @member {number} [ThemeGridRangeItem.prototype.start=0]
  73129. * @description 栅格分段专题图子项的起始值,即该段专题值范围的最小值。
  73130. */
  73131. this.start = 0;
  73132. /**
  73133. * @member {boolean} [ThemeGridRangeItem.prototype.visible=true]
  73134. * @description 栅格分段专题图子项是否可见。
  73135. */
  73136. this.visible = true;
  73137. if (options) {
  73138. Util_Util.extend(this, options);
  73139. }
  73140. this.CLASS_NAME = "SuperMap.ThemeGridRangeItem";
  73141. }
  73142. /**
  73143. * @function ThemeGridRangeItem.prototype.destroy
  73144. * @description 释放资源,将引用资源的属性置空。
  73145. */
  73146. destroy() {
  73147. var me = this;
  73148. me.caption = null;
  73149. me.end = null;
  73150. me.start = null;
  73151. //需要验证是够存在destroy方法
  73152. if (me.color) {
  73153. me.color.destroy();
  73154. me.color = null;
  73155. }
  73156. me.visible = null;
  73157. }
  73158. /**
  73159. * @function ThemeGridRangeItem.prototype.toServerJSONObject
  73160. * @description 转换成对应的 JSON 格式对象。
  73161. * @returns {Object} 对应的 JSON 格式对象。
  73162. */
  73163. toServerJSONObject() {
  73164. var obj = {};
  73165. obj = Util_Util.copyAttributes(obj, this);
  73166. if (obj.color) {
  73167. if (obj.color.toServerJSONObject) {
  73168. obj.color = obj.color.toServerJSONObject();
  73169. }
  73170. }
  73171. return obj;
  73172. }
  73173. /**
  73174. * @function ThemeGridRangeItem.fromObj
  73175. * @description 从传入对象获取栅格分段专题图子项类。
  73176. * @param {Object} obj - 传入对象。
  73177. * @returns {ThemeGridRangeItem} ThemeGridRangeItem 对象。
  73178. */
  73179. static fromObj(obj) {
  73180. if (!obj) {
  73181. return;
  73182. }
  73183. var res = new ThemeGridRangeItem();
  73184. Util_Util.copy(res, obj);
  73185. res.color = ServerColor.fromJson(obj.color);
  73186. return res;
  73187. }
  73188. }
  73189. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridRange.js
  73190. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73191. * This program are made available under the terms of the Apache License, Version 2.0
  73192. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73193. /**
  73194. * @class ThemeGridRange
  73195. * @deprecatedclass SuperMap.ThemeGridRange
  73196. * @category iServer Map Theme
  73197. * @classdesc 栅格分段专题图。栅格分段专题图,是将所有单元格的值按照某种分段方式分成多个范围段,值在同一个范围段中的单元格使用相同的颜色进行显示。一般用来反映连续分布现象的数量或程度特征。
  73198. * 比如某年的全国降水量分布图,将各气象站点的观测值经过内插之后生成的栅格数据进行分段显示。
  73199. * 该类类似于分段专题图类,不同点在于分段专题图的操作对象是矢量数据,而栅格分段专题图的操作对象是栅格数据。
  73200. * @extends {CommonTheme}
  73201. * @param {Object} options - 参数。
  73202. * @param {Array.<ThemeGridRangeItem>} options.items - 栅格分段专题图子项数组。
  73203. * @param {boolean} [options.reverseColor=false] - 是否对栅格分段专题图中分段的颜色风格进行反序显示。
  73204. * @param {RangeMode} [options.rangeMode=RangeMode.EQUALINTERVAL] - 分段专题图的分段模式。
  73205. * @param {number} [options.rangeParameter=0] - 分段参数。
  73206. * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  73207. * @usage
  73208. */
  73209. class ThemeGridRange extends Theme_Theme {
  73210. constructor(options) {
  73211. super("GRIDRANGE", options);
  73212. /**
  73213. * @member {Array.<ThemeGridRangeItem>} ThemeGridRange.prototype.items
  73214. * @description 栅格分段专题图子项数组。<br>
  73215. * 在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
  73216. * 本类用来设置每个栅格范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
  73217. */
  73218. this.items = null;
  73219. /**
  73220. * @member {RangeMode} [ThemeGridRange.prototype.rangeMode=RangeMode.EQUALINTERVAL]
  73221. * @description 分段专题图的分段模式。<br>
  73222. * 在栅格分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
  73223. * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
  73224. * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
  73225. */
  73226. this.rangeMode = RangeMode.EQUALINTERVAL;
  73227. /**
  73228. * @member {number} [ThemeGridRange.prototype.rangeParameter=0]
  73229. * @description 分段参数。<br>
  73230. * 当分段模式为等距离分段法,平方根分段,对数分段法,等计数分段法其中一种模式时,该参数用于设置分段个数,必设;当分段模式为标准差分段法时,
  73231. * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
  73232. */
  73233. this.rangeParameter = 0;
  73234. /**
  73235. * @member {ColorGradientType} [ThemeGridRange.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
  73236. * @description 渐变颜色枚举类。
  73237. *
  73238. */
  73239. this.colorGradientType = ColorGradientType.YELLOW_RED;
  73240. /**
  73241. * @member {boolean} ThemeGridRange.prototype.reverseColor
  73242. * @description 是否对栅格分段专题图中分段的颜色风格进行反序显示。
  73243. */
  73244. this.reverseColor = false;
  73245. if (options) {
  73246. Util_Util.extend(this, options);
  73247. }
  73248. this.CLASS_NAME = "SuperMap.ThemeGridRange";
  73249. }
  73250. /**
  73251. * @function ThemeGridRange.prototype.destroy
  73252. * @override
  73253. */
  73254. destroy() {
  73255. super.destroy();
  73256. var me = this;
  73257. if (me.items) {
  73258. if (me.items.length > 0) {
  73259. for (var item in me.items) {
  73260. me.items[item].destroy();
  73261. me.items[item] = null;
  73262. }
  73263. }
  73264. me.items = null;
  73265. }
  73266. me.reverseColor = null;
  73267. me.rangeMode = null;
  73268. me.rangeParameter = null;
  73269. me.colorGradientType = null;
  73270. }
  73271. /**
  73272. * @function ThemeGridRange.fromObj
  73273. * @description 从传入对象获取栅格分段专题图。
  73274. * @param {Object} obj - 传入对象。
  73275. * @returns {ThemeGridRange} ThemeGridRange 对象。
  73276. */
  73277. static fromObj(obj) {
  73278. if (!obj) {
  73279. return;
  73280. }
  73281. var res = new ThemeGridRange();
  73282. Util_Util.copy(res, obj);
  73283. var itemsR = obj.items;
  73284. var len = itemsR ? itemsR.length : 0;
  73285. res.items = [];
  73286. for (var i = 0; i < len; i++) {
  73287. res.items.push(ThemeGridRangeItem.fromObj(itemsR[i]));
  73288. }
  73289. return res;
  73290. }
  73291. }
  73292. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridUniqueItem.js
  73293. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73294. * This program are made available under the terms of the Apache License, Version 2.0
  73295. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73296. /**
  73297. * @class ThemeGridUniqueItem
  73298. * @deprecatedclass SuperMap.ThemeGridUniqueItem
  73299. * @category iServer Map Theme
  73300. * @classdesc 栅格单值专题图子项类。
  73301. * 栅格单值专题图是将值相同的单元格归为一类,每一类是一个专题图子项。
  73302. * @param {Object} options - 可选参数。
  73303. * @param {string} [options.caption] - 子项的名称。
  73304. * @param {ServerColor} [options.color] - 子项的显示颜色。
  73305. * @param {number} options.unique - 子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
  73306. * @param {boolean} [options.visible=true] - 子项是否可见。
  73307. * @usage
  73308. */
  73309. class ThemeGridUniqueItem {
  73310. constructor(options) {
  73311. /**
  73312. * @member {string} [ThemeGridUniqueItem.prototype.caption]
  73313. * @description 栅格单值专题图子项的名称。
  73314. */
  73315. this.caption = null;
  73316. /**
  73317. * @member {ServerColor} [ThemeGridUniqueItem.prototype.color]
  73318. * @description 栅格单值专题图子项的显示颜色。
  73319. */
  73320. this.color = new ServerColor();
  73321. /**
  73322. * @member {number} ThemeGridUniqueItem.prototype.unique
  73323. * @description 栅格单值专题图子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
  73324. */
  73325. this.unique = null;
  73326. /**
  73327. * @member {boolean} [ThemeGridUniqueItem.prototype.visible=true]
  73328. * @description 栅格单值专题图子项是否可见。
  73329. */
  73330. this.visible = true;
  73331. if (options) {
  73332. Util_Util.extend(this, options);
  73333. }
  73334. this.CLASS_NAME = "SuperMap.ThemeGridUniqueItem";
  73335. }
  73336. /**
  73337. * @function ThemeGridUniqueItem.prototype.destroy
  73338. * @description 释放资源,将引用资源的属性置空。
  73339. */
  73340. destroy() {
  73341. var me = this;
  73342. me.caption = null;
  73343. me.unique = null;
  73344. if (me.color) {
  73345. me.color.destroy();
  73346. me.color = null;
  73347. }
  73348. me.visible = null;
  73349. }
  73350. /**
  73351. * @function ThemeGridUniqueItem.prototype.toServerJSONObject
  73352. * @description 转换成对应的 JSON 格式对象。
  73353. * @returns {Object} 对应的 JSON 格式对象。
  73354. */
  73355. toServerJSONObject() {
  73356. var obj = {};
  73357. obj = Util_Util.copyAttributes(obj, this);
  73358. if (obj.color) {
  73359. if (obj.color.toServerJSONObject) {
  73360. obj.color = obj.color.toServerJSONObject();
  73361. }
  73362. }
  73363. return obj;
  73364. }
  73365. /**
  73366. * @function ThemeGridUniqueItem.fromObj
  73367. * @description 从传入对象获取栅格单值专题图子项类。
  73368. * @param {Object} obj - 传入对象。
  73369. * @returns {ThemeGridUniqueItem} ThemeGridUniqueItem 对象。
  73370. */
  73371. static fromObj(obj) {
  73372. var res = new ThemeGridUniqueItem();
  73373. Util_Util.copy(res, obj);
  73374. res.color = ServerColor.fromJson(obj.color);
  73375. return res;
  73376. }
  73377. }
  73378. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridUnique.js
  73379. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73380. * This program are made available under the terms of the Apache License, Version 2.0
  73381. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73382. /**
  73383. * @class ThemeGridUnique
  73384. * @deprecatedclass SuperMap.ThemeGridUnique
  73385. * @category iServer Map Theme
  73386. * @classdesc 栅格单值专题图类。栅格单值专题图是将单元格值相同的归为一类,为每一类设定一种颜色,从而用来区分不同的类别。
  73387. * 适用于离散栅格数据和部分连续栅格数据,对于单元格值各不相同的那些连续栅格数据,使用栅格单值专题图不具有任何意义。
  73388. * @extends {CommonTheme}
  73389. * @param {Object} options - 参数。
  73390. * @param {Array.<ThemeGridUniqueItem>} options.items - 栅格单值专题图子项数组。
  73391. * @param {ServerColor} [options.defaultcolor] - 栅格单值专题图的默认颜色。
  73392. * @usage
  73393. */
  73394. class ThemeGridUnique extends Theme_Theme {
  73395. constructor(options) {
  73396. super("GRIDUNIQUE", options);
  73397. /**
  73398. * @member {ServerColor} ThemeGridUnique.prototype.defaultcolor
  73399. * @description 栅格单值专题图的默认颜色。
  73400. * 对于那些未在格网单值专题图子项之列的要素使用该颜色显示。
  73401. */
  73402. this.defaultcolor = new ServerColor();
  73403. /**
  73404. * @member {Array.<ThemeGridUniqueItem>} ThemeGridUnique.prototype.items
  73405. * @description 栅格单值专题图子项数组。
  73406. * 栅格单值专题图将值相同的单元格归为一类,每一类是一个专题图子项。
  73407. */
  73408. this.items = null;
  73409. if (options) {
  73410. Util_Util.extend(this, options);
  73411. }
  73412. this.CLASS_NAME = "SuperMap.ThemeGridUnique";
  73413. }
  73414. /**
  73415. * @function ThemeGridUnique.prototype.destroy
  73416. * @override
  73417. */
  73418. destroy() {
  73419. super.destroy();
  73420. var me = this;
  73421. if (me.items) {
  73422. if (me.items.length > 0) {
  73423. for (var item in me.items) {
  73424. me.items[item].destroy();
  73425. me.items[item] = null;
  73426. }
  73427. }
  73428. me.items = null;
  73429. }
  73430. if (me.defaultcolor) {
  73431. me.defaultcolor.destroy();
  73432. me.defaultcolor = null;
  73433. }
  73434. }
  73435. /**
  73436. * @function ThemeGridUnique.prototype.toServerJSONObject
  73437. * @description 转换成对应的 JSON 格式对象。
  73438. * @returns {Object} 对应的 JSON 格式对象
  73439. */
  73440. toServerJSONObject() {
  73441. var obj = {};
  73442. obj = Util_Util.copyAttributes(obj, this);
  73443. if (obj.defaultcolor) {
  73444. if (obj.defaultcolor.toServerJSONObject) {
  73445. obj.defaultcolor = obj.defaultcolor.toServerJSONObject();
  73446. }
  73447. }
  73448. if (obj.items) {
  73449. var items = [],
  73450. len = obj.items.length;
  73451. for (var i = 0; i < len; i++) {
  73452. items.push(obj.items[i].toServerJSONObject());
  73453. }
  73454. obj.items = items;
  73455. }
  73456. return obj;
  73457. }
  73458. /**
  73459. * @function ThemeGridUnique.fromObj
  73460. * @description 从传入对象获取栅格单值专题图类。
  73461. * @param {Object} obj - 传入对象
  73462. * @returns {ThemeGridUnique} ThemeGridUnique 对象
  73463. */
  73464. static fromObj(obj) {
  73465. var res = new ThemeGridUnique();
  73466. var uItems = obj.items;
  73467. var len = uItems ? uItems.length : 0;
  73468. Util_Util.extend(res, obj);
  73469. res.items = [];
  73470. res.defaultcolor = ServerColor.fromJson(obj.defaultcolor);
  73471. for (var i = 0; i < len; i++) {
  73472. res.items.push(ThemeGridUniqueItem.fromObj(uItems[i]));
  73473. }
  73474. return res;
  73475. }
  73476. }
  73477. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelUniqueItem.js
  73478. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73479. * This program are made available under the terms of the Apache License, Version 2.0
  73480. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73481. /**
  73482. * @class ThemeLabelUniqueItem
  73483. * @deprecatedclass SuperMap.ThemeLabelUniqueItem
  73484. * @category iServer Map Theme
  73485. * @classdesc 单值标签专题图的子项。标签专题图用专题值对点、线、面等对象做标注,值得注意的是,单值标签专题图允许用户通过 uniqueExpression
  73486. * 字段指定用于单值的字段,同一值的标签具有相同的显示风格,其中每一个值就是一个专题图子项,
  73487. * 每一个子项都具有其名称、风格、指定的单值、X 方向偏移量和 Y 方向偏移量。
  73488. * @param {Object} options - 参数。
  73489. * @param {string} options.unique - 子项的值,可以为数字、字符串等。
  73490. * @param {string} [options.caption] - 子项的名称。
  73491. * @param {number} [options.offsetX=0] - 标签在 X 方向偏移量。
  73492. * @param {number} [options.offsetY=0] - 标签在 Y 方向偏移量。
  73493. * @param {boolean} [options.visible=true] - 子项是否可见。
  73494. * @param {ServerTextStyle} [options.style] - 子项文本的显示风格。
  73495. * @usage
  73496. */
  73497. class ThemeLabelUniqueItem {
  73498. constructor(options) {
  73499. /**
  73500. * @member {string} [ThemeLabelUniqueItem.prototype.caption]
  73501. * @description 标签专题子项的标题。
  73502. */
  73503. this.caption = null;
  73504. /**
  73505. * @member {string} ThemeLabelUniqueItem.prototype.unique
  73506. * @description 单值专题图子项的值,可以为数字、字符串等。
  73507. */
  73508. this.unique = null;
  73509. /**
  73510. * @member {number} [ThemeLabelUniqueItem.prototype.offsetX=0]
  73511. * @description 标签在 X 方向偏移量。
  73512. */
  73513. this.offsetX = 0;
  73514. /**
  73515. * @member {number} [ThemeLabelUniqueItem.prototype.offsetY=0]
  73516. * @description 标签在 Y 方向偏移量。
  73517. */
  73518. this.offsetY = 0;
  73519. /**
  73520. * @member {boolean} [ThemeLabelUniqueItem.prototype.visible=true]
  73521. * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
  73522. */
  73523. this.visible = true;
  73524. /**
  73525. * @member {ServerTextStyle} ThemeLabelUniqueItem.prototype.style
  73526. * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
  73527. * uniformMixedStyle(标签文本的复合风格),ThemeLabelUniqueItem.style(单值子项的文本风格),uniformStyle(统一文本风格)。
  73528. */
  73529. this.style = new ServerTextStyle();
  73530. if (options) {
  73531. Util_Util.extend(this, options);
  73532. }
  73533. this.CLASS_NAME = "SuperMap.ThemeLabelUniqueItem";
  73534. }
  73535. /**
  73536. * @function ThemeLabelUniqueItem.prototype.destroy
  73537. * @description 释放资源,将引用资源的属性置空。
  73538. */
  73539. destroy() {
  73540. var me = this;
  73541. me.unique = null;
  73542. me.caption = null;
  73543. me.offsetX = null;
  73544. me.offsetY = null;
  73545. if (me.style) {
  73546. me.style.destroy();
  73547. me.style = null;
  73548. }
  73549. me.visible = null;
  73550. }
  73551. /**
  73552. * @function ThemeLabelUniqueItem.fromObj
  73553. * @description 从传入对象获取单值标签专题图的子项类。
  73554. * @param {Object} obj - 传入对象。
  73555. * @returns {ThemeLabelUniqueItem} ThemeLabelUniqueItem 对象。
  73556. */
  73557. static fromObj(obj) {
  73558. if (!obj) {
  73559. return;
  73560. }
  73561. var t = new ThemeLabelUniqueItem();
  73562. Util_Util.copy(t, obj);
  73563. return t;
  73564. }
  73565. }
  73566. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeMemoryData.js
  73567. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73568. * This program are made available under the terms of the Apache License, Version 2.0
  73569. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73570. /**
  73571. * @class ThemeMemoryData
  73572. * @deprecatedclass SuperMap.ThemeMemoryData
  73573. * @category iServer Map Theme
  73574. * @classdesc 专题图内存数据类。
  73575. * @param {Array} srcData - 原始值数组。
  73576. * @param {Array} targetData - 外部值数组。
  73577. * @usage
  73578. */
  73579. class ThemeMemoryData {
  73580. constructor(srcData, targetData) {
  73581. /**
  73582. * @member {Array} ThemeMemoryData.prototype.srcData
  73583. * @description 原始值数组,该属性值将被 targetData 属性所指定的值替换掉,然后制作专题图,但数据库中的值并不会改变。
  73584. */
  73585. this.srcData = srcData;
  73586. /**
  73587. * @member {Array} ThemeMemoryData.prototype.targetData
  73588. * @description 外部值数组,即用于制作专题图的内存数据,设定该属性值后,会将 srcData 属性所指定的原始值替换掉制作专题图,但数据库中的值并不会改变。
  73589. */
  73590. this.targetData = targetData;
  73591. this.CLASS_NAME = "SuperMap.ThemeMemoryData";
  73592. }
  73593. /**
  73594. * @function ThemeMemoryData.prototype.destroy
  73595. * @description 释放资源,将引用资源的属性置空。
  73596. */
  73597. destroy() {
  73598. var me = this;
  73599. me.srcData = null;
  73600. me.targetData = null;
  73601. }
  73602. /**
  73603. * @function ThemeMemoryData.prototype.toJSON
  73604. * @description 将 ThemeMemoryData 对象转化为 JSON 字符串。
  73605. * @returns {string} 返回转换后的 JSON 字符串。
  73606. */
  73607. toJSON() {
  73608. if (this.srcData && this.targetData) {
  73609. var memoryDataStr = "";
  73610. var count = Math.min(this.srcData.length, this.targetData.length);
  73611. for (var i = 0; i < count; i++) {
  73612. memoryDataStr += "\'" + this.srcData[i] + "\':\'" + this.targetData[i] + "\',";
  73613. }
  73614. //去除多余的逗号
  73615. if (i > 0) {
  73616. memoryDataStr = memoryDataStr.substring(0, memoryDataStr.length - 1);
  73617. }
  73618. return "{" + memoryDataStr + "}";
  73619. } else {
  73620. return null;
  73621. }
  73622. }
  73623. }
  73624. ;// CONCATENATED MODULE: ./src/common/iServer/TransferLine.js
  73625. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73626. * This program are made available under the terms of the Apache License, Version 2.0
  73627. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73628. /**
  73629. * @class TransferLine
  73630. * @deprecatedclass SuperMap.TransferLine
  73631. * @category iServer TrafficTransferAnalyst TransferPath
  73632. * @classdesc 换乘路线信息类。
  73633. * @param {Object} options - 参数。
  73634. * @param {number} options.lineID - 乘车路线 ID。
  73635. * @param {string} options.lineName - 乘车路线名称。
  73636. * @param {string} options.lineAliasName - 乘车路线别名。
  73637. * @param {number} options.startStopIndex - 上车站点在本公交路线中的索引。
  73638. * @param {string} options.startStopName - 上车站点名称。
  73639. * @param {string} options.startStopAliasName - 上车站点别名。
  73640. * @param {number} options.endStopIndex - 下车站点在本公交路线中的索引。
  73641. * @param {string} options.endStopName - 下车站点名称。
  73642. * @param {string} options.endStopAliasName - 下车站点别名。
  73643. * @usage
  73644. */
  73645. class TransferLine {
  73646. constructor(options) {
  73647. options = options || {};
  73648. /**
  73649. * @member {number} TransferLine.prototype.lineID
  73650. * @description 乘车路线 ID。
  73651. */
  73652. this.lineID = null;
  73653. /**
  73654. * @member {string} TransferLine.prototype.lineName
  73655. * @description 乘车路线名称。
  73656. */
  73657. this.lineName = null;
  73658. /**
  73659. * @member {string} TransferLine.prototype.lineAliasName
  73660. * @description 乘车路线别名。
  73661. */
  73662. this.lineAliasName = null;
  73663. /**
  73664. * @member {number} TransferLine.prototype.startStopIndex
  73665. * @description 上车站点在本公交路线中的索引。
  73666. */
  73667. this.startStopIndex = null;
  73668. /**
  73669. * @member {string} TransferLine.prototype.startStopName
  73670. * @description 上车站点名称。
  73671. */
  73672. this.startStopName = null;
  73673. /**
  73674. * @member {string} TransferLine.prototype.startStopAliasName
  73675. * @description 上车站点别名。
  73676. */
  73677. this.startStopAliasName = null;
  73678. /**
  73679. * @member {number} TransferLine.prototype.endStopIndex
  73680. * @description 下车站点在本公交路线中的索引。
  73681. */
  73682. this.endStopIndex = null;
  73683. /**
  73684. * @member {string} TransferLine.prototype.endStopName
  73685. * @description 下车站点名称。
  73686. */
  73687. this.endStopName = null;
  73688. /**
  73689. * @member {string} TransferLine.prototype.endStopAliasName
  73690. * @description 下车站点别名。
  73691. */
  73692. this.endStopAliasName = null;
  73693. Util_Util.extend(this, options);
  73694. this.CLASS_NAME = "SuperMap.TransferLine";
  73695. }
  73696. /**
  73697. * @function TransferLine.prototype.destroy
  73698. * @description 释放资源,将引用资源的属性置空。
  73699. */
  73700. destroy() {
  73701. Util_Util.reset(this);
  73702. }
  73703. /**
  73704. * @function TransferLine.fromJson
  73705. * @description 将返回结果转化为 {@link TransferLine} 对象。
  73706. * @param {Object} jsonObject - 新的返回结果。
  73707. * @returns {TransferLine} 转化后的 {@link TransferLine} 对象。
  73708. */
  73709. static fromJson(jsonObject) {
  73710. if (!jsonObject) {
  73711. return;
  73712. }
  73713. return new TransferLine({
  73714. lineID: jsonObject['lineID'],
  73715. lineName: jsonObject['lineName'],
  73716. lineAliasName: jsonObject['lineAliasName'],
  73717. startStopIndex: jsonObject['startStopIndex'],
  73718. startStopName: jsonObject['startStopName'],
  73719. startStopAliasName: jsonObject['startStopAliasName'],
  73720. endStopIndex: jsonObject['endStopIndex'],
  73721. endStopName: jsonObject['endStopName'],
  73722. endStopAliasName: jsonObject['endStopAliasName']
  73723. });
  73724. }
  73725. }
  73726. ;// CONCATENATED MODULE: ./src/common/iServer/RasterFunctionParameter.js
  73727. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73728. * This program are made available under the terms of the Apache License, Version 2.0
  73729. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73730. /**
  73731. * @class RasterFunctionParameter
  73732. * @deprecatedclass SuperMap.RasterFunctionParameter
  73733. * @category iServer Map Tile
  73734. * @classdesc iServer 地图服务栅格分析参数基类。
  73735. * @param {Object} options - 参数。
  73736. * @param {RasterFunctionType} options.type - 栅格分析方法。
  73737. * @usage
  73738. */
  73739. class RasterFunctionParameter {
  73740. constructor(options) {
  73741. options = options || {};
  73742. /**
  73743. * @member {RasterFunctionType} [RasterFunctionParameter.prototype.type]
  73744. * @description 栅格分析方法。
  73745. */
  73746. this.type = null;
  73747. Util_Util.extend(this, options);
  73748. this.CLASS_NAME = 'SuperMap.RasterFunctionParameter';
  73749. }
  73750. /**
  73751. * @function RasterFunctionParameter.prototype.destroy
  73752. * @description 释放资源,将资源的属性置空。
  73753. */
  73754. destroy() {
  73755. this.type = null;
  73756. }
  73757. }
  73758. ;// CONCATENATED MODULE: ./src/common/iServer/NDVIParameter.js
  73759. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73760. * This program are made available under the terms of the Apache License, Version 2.0
  73761. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73762. /**
  73763. * @class NDVIParameter
  73764. * @deprecatedclass SuperMap.NDVIParameter
  73765. * @category iServer Map Tile
  73766. * @classdesc 归一化植被指数参数类。
  73767. * @param {Object} options - 参数。
  73768. * @param {number} [options.redIndex=0] - 红光谱波段索引。
  73769. * @param {number} [options.nirIndex=1] - 近红外光谱波段索引。
  73770. * @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。仅单波段数据时设定。
  73771. * @extends {RasterFunctionParameter}
  73772. * @usage
  73773. */
  73774. class NDVIParameter extends RasterFunctionParameter {
  73775. constructor(options) {
  73776. super(options);
  73777. /**
  73778. * @member {number} [NDVIParameter.prototype.redIndex=0]
  73779. * @description 红光谱波段索引。
  73780. */
  73781. this.redIndex = 0;
  73782. /**
  73783. * @member {number} [NDVIParameter.prototype.nirIndex=1]
  73784. * @description 近红外光谱波段索引。
  73785. */
  73786. this.nirIndex = 1;
  73787. /**
  73788. * @member {string} [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"]
  73789. * @description 颜色表。由栅格的中断值和颜色停止之间的映射组成的,如0.3->d9f0a3ff 指的是[0,0.3)显示d9f0a3ff。仅单波段数据时设定。
  73790. */
  73791. this.colorMap =
  73792. '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';
  73793. /**
  73794. * @member {RasterFunctionType} [NDVIParameter.prototype.type]
  73795. * @description 栅格分析方法。
  73796. */
  73797. this.type = RasterFunctionType.NDVI;
  73798. Util_Util.extend(this, options);
  73799. this.CLASS_NAME = 'SuperMap.NDVIParameter';
  73800. }
  73801. /**
  73802. * @function NDVIParameter.prototype.destroy
  73803. * @override
  73804. */
  73805. destroy() {
  73806. super.destroy();
  73807. this.redIndex = null;
  73808. this.nirIndex = null;
  73809. this.colorMap = null;
  73810. }
  73811. /**
  73812. * @function NDVIParameter.prototype.toJSON
  73813. * @description 将 NDVIParameter 对象转化为 JSON 字符串。
  73814. * @returns {string} 返回转换后的 JSON 字符串。
  73815. */
  73816. toJSON() {
  73817. return {
  73818. redIndex: this.redIndex,
  73819. nirIndex: this.nirIndex,
  73820. colorMap: this.colorMap,
  73821. type: this.type
  73822. };
  73823. }
  73824. }
  73825. ;// CONCATENATED MODULE: ./src/common/iServer/HillshadeParameter.js
  73826. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73827. * This program are made available under the terms of the Apache License, Version 2.0
  73828. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73829. /**
  73830. * @class HillshadeParameter
  73831. * @deprecatedclass SuperMap.HillshadeParameter
  73832. * @category iServer Map Tile
  73833. * @classdesc 阴影面分析参数类。
  73834. * @param {Object} options - 可选参数。
  73835. * @param {number} [options.altitude=45] - 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
  73836. * @param {number} [options.azimuth=315] - 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
  73837. * @param {number} [options.zFactor=1] - 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  73838. * z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  73839. * 如果 x,y 单位和 z 单位采用相同的测量单位,则 z 因子为 1。这是默认设置。
  73840. * 如果 x,y 单位和 z 单位采用不同的测量单位,则必须将 z 因子设置为适当的因子,否则会得到错误的结果。例如,如果 z 单位是英尺而 x,y 单位是米,则应使用 z 因子 0.3048 将 z 单位从英尺转换为米(1 英尺 = 0.3048 米)。
  73841. * 如果输入栅格位于球面坐标系中(如十进制度球面坐标系),则生成的山体阴影可能看起来很独特。这是因为水平地面单位与高程 z 单位之间的测量值存在差异。由于经度的长度随着纬度而变化,因此需要为该纬度指定一个适当的 z 因子。如果 x,y 单位是十进制度而 Z 单位是米,特定纬度的一些合适的 Z 因子为:
  73842. * Latitude Z-factor
  73843. * 0 0.00000898
  73844. * 10 0.00000912
  73845. * 20 0.00000956
  73846. * 30 0.00001036
  73847. * 40 0.00001171
  73848. * 50 0.00001395
  73849. * 60 0.00001792
  73850. * 70 0.00002619
  73851. * 80 0.00005156
  73852. * @extends {RasterFunctionParameter}
  73853. * @usage
  73854. */
  73855. class HillshadeParameter extends RasterFunctionParameter {
  73856. constructor(options) {
  73857. super(options);
  73858. /**
  73859. * @member {number} [HillshadeParameter.prototype.altitude = 45]
  73860. * @description 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
  73861. */
  73862. this.altitude = 45;
  73863. /**
  73864. * @member {number} [HillshadeParameter.prototype.azimuth = 315]
  73865. * @description 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
  73866. */
  73867. this.azimuth = 315;
  73868. /**
  73869. * @member {number} [HillshadeParameter.prototype.zFactor = 1]
  73870. * @description 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  73871. */
  73872. this.zFactor = 1;
  73873. /**
  73874. * @member {RasterFunctionType} HillshadeParameter.prototype.type
  73875. * @description 栅格分析方法。
  73876. */
  73877. this.type = RasterFunctionType.HILLSHADE;
  73878. Util_Util.extend(this, options);
  73879. this.CLASS_NAME = 'SuperMap.HillshadeParameter';
  73880. }
  73881. /**
  73882. * @function HillshadeParameter.prototype.destroy
  73883. * @override
  73884. */
  73885. destroy() {
  73886. super.destroy();
  73887. this.altitude = null;
  73888. this.azimuth = null;
  73889. this.zFactor = null;
  73890. }
  73891. /**
  73892. * @function HillshadeParameter.prototype.toJSON
  73893. * @description 将 HillshadeParameter 对象转化为 JSON 字符串。
  73894. * @returns {string} 返回转换后的 JSON 字符串。
  73895. */
  73896. toJSON() {
  73897. return {
  73898. altitude: this.altitude,
  73899. azimuth: this.azimuth,
  73900. zFactor: this.zFactor,
  73901. type: this.type
  73902. };
  73903. }
  73904. }
  73905. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobCustomItems.js
  73906. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73907. * This program are made available under the terms of the Apache License, Version 2.0
  73908. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73909. /**
  73910. * @class WebPrintingJobCustomItems
  73911. * @deprecatedclass SuperMap.WebPrintingJobCustomItems
  73912. * @classdesc Web 打印图例元素参数类。
  73913. * @version 10.1.0
  73914. * @category iServer WebPrintingJob
  73915. * @param {Object} option - 参数。
  73916. * @param {string} option.name - 图例元素的名称。
  73917. * @param {string} option.picAsUrl - 图例元素 Base64 格式图片。
  73918. * @param {string} [option.picAsBase64] - 图例元素图片的获取地址。如果已填了 URL 参数,此参数可不传。
  73919. * @usage
  73920. */
  73921. class WebPrintingJobCustomItems {
  73922. constructor(option) {
  73923. /**
  73924. * @member {string} WebPrintingJobCustomItems.prototype.name
  73925. * @description 图例元素的名称。
  73926. */
  73927. this.name = null;
  73928. /**
  73929. * @member {string} [WebPrintingJobCustomItems.prototype.picAsUrl]
  73930. * @description 图例元素 Base64 格式图片。
  73931. */
  73932. this.picAsUrl = null;
  73933. /**
  73934. * @member {string} [WebPrintingJobCustomItems.prototype.picAsBase64]
  73935. * @description 图例元素图片的获取地址。
  73936. */
  73937. this.picAsBase64 = null;
  73938. this.CLASS_NAME = 'SuperMap.WebPrintingJobCustomItems';
  73939. Util_Util.extend(this, option);
  73940. }
  73941. /**
  73942. * @function WebPrintingJobCustomItems.prototype.destroy
  73943. * @description 释放资源,将引用资源的属性置空。
  73944. */
  73945. destroy() {
  73946. var me = this;
  73947. me.name = null;
  73948. me.picAsUrl = null;
  73949. me.picAsBase64 = null;
  73950. }
  73951. /**
  73952. * @function WebPrintingJobCustomItems.prototype.toJSON
  73953. * @description 将 WebPrintingJobCustomItems 对象转化为 JSON 字符串。
  73954. * @returns {string} 转换后的 JSON 字符串。
  73955. */
  73956. toJSON() {
  73957. var params = {
  73958. name: this.name
  73959. };
  73960. if (this.title) {
  73961. params.title = this.title;
  73962. }
  73963. if (this.picAsUrl) {
  73964. params.picAsUrl = this.picAsUrl;
  73965. } else if (this.picAsBase64) {
  73966. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  73967. }
  73968. return Util_Util.toJSON(params);
  73969. }
  73970. }
  73971. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobImage.js
  73972. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73973. * This program are made available under the terms of the Apache License, Version 2.0
  73974. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73975. /**
  73976. * @class WebPrintingJobImage
  73977. * @deprecatedclass SuperMap.WebPrintingJobImage
  73978. * @classdesc 表达小地图的静态图片参数类。
  73979. * @version 10.1.0
  73980. * @category iServer WebPrintingJob
  73981. * @param {Object} option - 参数。
  73982. * @param {string} option.picAsUrl - 小地图的图片 URL 地址。
  73983. * @param {string} [option.picAsBase64] - 小地图的base64位图片信息。如果已填了 URL 参数,此参数可不传。
  73984. * @usage
  73985. */
  73986. class WebPrintingJobImage {
  73987. constructor(option) {
  73988. /**
  73989. * @member {string} [WebPrintingJobImage.prototype.picAsUrl]
  73990. * @description 小地图的图片 URL 地址。
  73991. */
  73992. this.picAsUrl = null;
  73993. /**
  73994. * @member {string} [WebPrintingJobImage.prototype.picAsBase64]
  73995. * @description 小地图的base64位图片信息。
  73996. */
  73997. this.picAsBase64 = null;
  73998. this.CLASS_NAME = 'SuperMap.WebPrintingJobImage';
  73999. Util_Util.extend(this, option);
  74000. }
  74001. /**
  74002. * @function WebPrintingJobImage.prototype.destroy
  74003. * @description 释放资源,将引用资源的属性置空。
  74004. */
  74005. destroy() {
  74006. this.picAsUrl = null;
  74007. this.picAsBase64 = null;
  74008. }
  74009. /**
  74010. * @function WebPrintingJobImage.prototype.toJSON
  74011. * @description 将 WebPrintingJobImage 对象转化为 JSON 字符串。
  74012. * @returns {string} 转换后的 JSON 字符串。
  74013. */
  74014. toJSON() {
  74015. var params = {};
  74016. if (this.picAsUrl) {
  74017. params.picAsUrl = this.picAsUrl;
  74018. }
  74019. if (this.picAsBase64) {
  74020. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  74021. }
  74022. return Util_Util.toJSON(params);
  74023. }
  74024. }
  74025. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayers.js
  74026. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74027. * This program are made available under the terms of the Apache License, Version 2.0
  74028. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74029. /**
  74030. * @class WebPrintingJobLayers
  74031. * @deprecatedclass SuperMap.WebPrintingJobLayers
  74032. * @classdesc 将图例添加到布局的业务图层参数类。
  74033. * @version 10.1.0
  74034. * @category iServer WebPrintingJob
  74035. * @param {Object} option - 参数。
  74036. * @param {string} option.name - 图层 name 的字符串。此 name 必须唯一,并且必须与定义业务图层的 LegendOptions_layers 元素中的图层 name 匹配。
  74037. * @usage
  74038. */
  74039. class WebPrintingJobLayers {
  74040. constructor(option) {
  74041. /**
  74042. * @member {string} WebPrintingJobLayers.prototype.name
  74043. * @description 图层 name。
  74044. */
  74045. this.name = null;
  74046. /**
  74047. * @member {string} WebPrintingJobLayers.prototype.layerType
  74048. * @description 图层 type。
  74049. */
  74050. this.layerType = null;
  74051. /**
  74052. * @member {string} WebPrintingJobLayers.prototype.url
  74053. * @description 图层 URL。
  74054. */
  74055. this.url = null;
  74056. this.CLASS_NAME = 'SuperMap.WebPrintingJobLayers';
  74057. Util_Util.extend(this, option);
  74058. }
  74059. /**
  74060. * @function WebPrintingJobLayers.prototype.destroy
  74061. * @description 释放资源,将引用资源的属性置空。
  74062. */
  74063. destroy() {
  74064. this.name = null;
  74065. this.layerType = null;
  74066. this.url = null;
  74067. }
  74068. }
  74069. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLegendOptions.js
  74070. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74071. * This program are made available under the terms of the Apache License, Version 2.0
  74072. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74073. /**
  74074. * @class WebPrintingJobLegendOptions
  74075. * @deprecatedclass SuperMap.WebPrintingJobLegendOptions
  74076. * @classdesc Web 打印图例参数类。
  74077. * @version 10.1.0
  74078. * @category iServer WebPrintingJob
  74079. * @param {Object} option - 参数。
  74080. * @param {string} [option.title] - 图例名称。
  74081. * @param {string} [option.picAsUrl] - 图例的图片 URL 地址。
  74082. * @param {string} [option.picAsBase64] - 图例的 base64 位图片信息。
  74083. * @param {WebPrintingJobLayers} [option.layers] - 图例的布局业务图层参数类。
  74084. * @param {WebPrintingJobCustomItems} [option.customItems] - 自定义图例元素参数类。
  74085. * @usage
  74086. */
  74087. class WebPrintingJobLegendOptions {
  74088. constructor(option) {
  74089. /**
  74090. * @member {string} WebPrintingJobLegendOptions.prototype.title
  74091. * @description 图例名称。
  74092. */
  74093. this.title = null;
  74094. /**
  74095. * @member {string} [WebPrintingJobLegendOptions.prototype.picAsUrl]
  74096. * @description 图例的图片 URL 地址。
  74097. */
  74098. this.picAsUrl = null;
  74099. /**
  74100. * @member {string} [WebPrintingJobLegendOptions.prototype.picAsBase64]
  74101. * @description 图例的 base64 位图片信息。
  74102. */
  74103. this.picAsBase64 = null;
  74104. /**
  74105. * @member {WebPrintingJobLayers} [WebPrintingJobLegendOptions.prototype.layers]
  74106. * @description 图例的布局业务图层参数类。
  74107. */
  74108. this.layers = null;
  74109. /**
  74110. * @member {WebPrintingJobCustomItems} [WebPrintingJobLegendOptions.prototype.customItems]
  74111. * @description 自定义图例元素参数类。
  74112. */
  74113. this.customItems = null;
  74114. this.CLASS_NAME = 'SuperMap.WebPrintingJobLegendOptions';
  74115. Util_Util.extend(this, option);
  74116. }
  74117. /**
  74118. * @function WebPrintingJobLegendOptions.prototype.destroy
  74119. * @description 释放资源,将引用资源的属性置空。
  74120. */
  74121. destroy() {
  74122. this.title = null;
  74123. this.picAsUrl = null;
  74124. this.picAsBase64 = null;
  74125. if (this.layers instanceof WebPrintingJobLayers) {
  74126. this.layers.destroy();
  74127. this.layers = null;
  74128. }
  74129. if (this.customItems instanceof WebPrintingJobCustomItems) {
  74130. this.customItems.destroy();
  74131. this.customItems = null;
  74132. }
  74133. }
  74134. /**
  74135. * @function WebPrintingJobLegendOptions.prototype.toJSON
  74136. * @description 将 WebPrintingJobLegendOptions 对象转化为 JSON 字符串。
  74137. * @returns {string} 转换后的 JSON 字符串。
  74138. */
  74139. toJSON() {
  74140. var params = {
  74141. title: this.title || ""
  74142. };
  74143. if (this.picAsUrl) {
  74144. params.picAsUrl = this.picAsUrl;
  74145. } else if (this.picAsBase64) {
  74146. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  74147. } else if (this.customItems) {
  74148. params.customItems = this.customItems;
  74149. }
  74150. return Util_Util.toJSON(params);
  74151. }
  74152. }
  74153. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLittleMapOptions.js
  74154. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74155. * This program are made available under the terms of the Apache License, Version 2.0
  74156. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74157. /**
  74158. * @class WebPrintingJobLittleMapOptions
  74159. * @deprecatedclass SuperMap.WebPrintingJobLittleMapOptions
  74160. * @classdesc Web 打印小地图参数类。
  74161. * @version 10.1.0
  74162. * @category iServer WebPrintingJob
  74163. * @param {Object} option - 参数。
  74164. * @param {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} option.center - 小地图的中心点。
  74165. * @param {number} [option.scale] - 小地图的比例尺。
  74166. * @param {Array.<string>} [option.layerNames] - 指定 WebMap中图层名称的列表,用于渲染小地图。
  74167. * @param {WebPrintingJobImage} [option.image] - 表达小地图的静态图类。
  74168. * @param {WebPrintingJobLayers} [option.layers] - 指定 WebMap 中的 layers 图层类。
  74169. * @usage
  74170. */
  74171. class WebPrintingJobLittleMapOptions {
  74172. constructor(option) {
  74173. /**
  74174. * @member {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} WebPrintingJobLittleMapOptions.prototype.center
  74175. * @description 小地图的中心点。
  74176. */
  74177. this.center = null;
  74178. /**
  74179. * @member {number} [WebPrintingJobLittleMapOptions.prototype.scale]
  74180. * @description 小地图的比例尺。
  74181. */
  74182. this.scale = null;
  74183. /**
  74184. * @member {Array.<string>} WebPrintingJobLittleMapOptions.prototype.layerNames
  74185. * @description 指定 WebMap中图层名称的列表,用于渲染小地图。
  74186. */
  74187. this.layerNames = null;
  74188. /**
  74189. * @member {WebPrintingJobImage} [WebPrintingJobLittleMapOptions.prototype.image]
  74190. * @description 表达小地图的静态图类。暂不支持。
  74191. */
  74192. this.image = null;
  74193. /**
  74194. * @member {WebPrintingJobLayers} [WebPrintingJobLittleMapOptions.prototype.layers]
  74195. * @description 指定 WebMap 中的 layers 图层类。
  74196. */
  74197. this.layers = null;
  74198. this.CLASS_NAME = 'SuperMap.WebPrintingJobLittleMapOptions';
  74199. Util_Util.extend(this, option);
  74200. }
  74201. /**
  74202. * @function WebPrintingJobLittleMapOptions.prototype.destroy
  74203. * @description 释放资源,将引用资源的属性置空。
  74204. */
  74205. destroy() {
  74206. this.center = null;
  74207. this.scale = null;
  74208. this.layerNames = null;
  74209. if (this.image instanceof WebPrintingJobImage) {
  74210. this.image.destroy();
  74211. this.image = null;
  74212. }
  74213. if (this.layers instanceof WebPrintingJobLayers) {
  74214. this.layers.destroy();
  74215. this.layers = null;
  74216. }
  74217. }
  74218. /**
  74219. * @function WebPrintingJobLittleMapOptions.prototype.toJSON
  74220. * @description 将 WebPrintingJobLittleMapOptions 对象转化为 JSON 字符串。
  74221. * @returns {string} 转换后的 JSON 字符串。
  74222. */
  74223. toJSON() {
  74224. var params = {
  74225. scale: this.scale,
  74226. center: this.center
  74227. };
  74228. if (this.layerNames) {
  74229. params.layerNames = this.layerNames;
  74230. } else if (this.layers) {
  74231. params.layers = this.layers;
  74232. }
  74233. if (this.image) {
  74234. params.image = this.image;
  74235. }
  74236. return Util_Util.toJSON(params);
  74237. }
  74238. }
  74239. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobNorthArrowOptions.js
  74240. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74241. * This program are made available under the terms of the Apache License, Version 2.0
  74242. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74243. /**
  74244. * @class WebPrintingJobNorthArrowOptions
  74245. * @deprecatedclass SuperMap.WebPrintingJobNorthArrowOptions
  74246. * @classdesc Web 打印地图指北针参数类。
  74247. * @version 10.1.0
  74248. * @category iServer WebPrintingJob
  74249. * @param {Object} option - 参数。
  74250. * @param {string} option.picAsUrl - 指北针的图片 URL 地址。
  74251. * @param {string} [option.picAsBase64] - 指北针的base64位图片信息。
  74252. * @usage
  74253. */
  74254. class WebPrintingJobNorthArrowOptions {
  74255. constructor(option) {
  74256. /**
  74257. * @member {string} WebPrintingJobNorthArrowOptions.prototype.picAsUrl
  74258. * @description 指北针的图片 URL 地址。
  74259. */
  74260. this.picAsUrl = null;
  74261. /**
  74262. * @member {string} [WebPrintingJobNorthArrowOptions.prototype.picAsBase64]
  74263. * @description 指北针的base64位图片信息。
  74264. */
  74265. this.picAsBase64 = null;
  74266. this.CLASS_NAME = 'SuperMap.WebPrintingJobNorthArrowOptions';
  74267. Util_Util.extend(this, option);
  74268. }
  74269. /**
  74270. * @function WebPrintingJobNorthArrowOptions.prototype.destroy
  74271. * @description 释放资源,将引用资源的属性置空。
  74272. */
  74273. destroy() {
  74274. this.picAsUrl = null;
  74275. this.picAsBase64 = null;
  74276. }
  74277. /**
  74278. * @function WebPrintingJobNorthArrowOptions.prototype.toJSON
  74279. * @description 将 WebPrintingJobNorthArrowOptions 对象转化为 JSON 字符串。
  74280. * @returns {string} 转换后的 JSON 字符串。
  74281. */
  74282. toJSON() {
  74283. var params = {};
  74284. if (this.picAsUrl) {
  74285. params.picAsUrl = this.picAsUrl;
  74286. } else if (this.picAsBase64) {
  74287. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  74288. }
  74289. return Util_Util.toJSON(params);
  74290. }
  74291. }
  74292. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobScaleBarOptions.js
  74293. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74294. * This program are made available under the terms of the Apache License, Version 2.0
  74295. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74296. /**
  74297. * @class WebPrintingJobScaleBarOptions
  74298. * @deprecatedclass SuperMap.WebPrintingJobScaleBarOptions
  74299. * @classdesc Web 打印比例尺参数类。
  74300. * @category iServer WebPrintingJob
  74301. * @version 10.1.0
  74302. * @param {Object} option - 参数。
  74303. * @param {string} [option.scaleText] - 比例尺文本信息。例如:1:1000000。
  74304. * @param {WebScaleOrientationType} [option.orientation] - 比例尺的方位样式。
  74305. * @param {WebScaleType} [option.type] - 比例尺的样式。
  74306. * @param {number} [option.intervals] - 比例尺条的段数。
  74307. * @param {WebScaleUnit} [option.unit] - 比例尺的单位制。
  74308. * @usage
  74309. */
  74310. class WebPrintingJobScaleBarOptions {
  74311. constructor(option) {
  74312. /**
  74313. * @member {string} WebPrintingJobScaleBarOptions.prototype.scaleText
  74314. * @description 比例尺文本信息。
  74315. */
  74316. this.scaleText = null;
  74317. /**
  74318. * @member {WebScaleOrientationType} [WebPrintingJobScaleBarOptions.prototype.orientation]
  74319. * @description 比例尺的方位样式。
  74320. */
  74321. this.orientation = null;
  74322. /**
  74323. * @member {WebScaleType} [WebPrintingJobScaleBarOptions.prototype.type]
  74324. * @description 比例尺的样式。
  74325. */
  74326. this.type = null;
  74327. /**
  74328. * @member {Object} [WebPrintingJobScaleBarOptions.prototype.intervals]
  74329. * @description 比例尺条的段数。
  74330. */
  74331. this.intervals = null;
  74332. /**
  74333. * @member {WebScaleUnit} [WebPrintingJobScaleBarOptions.prototype.unit]
  74334. * @description 比例尺的单位制。
  74335. */
  74336. this.unit = null;
  74337. this.CLASS_NAME = 'SuperMap.WebPrintingJobScaleBarOptions';
  74338. Util_Util.extend(this, option);
  74339. }
  74340. /**
  74341. * @function WebPrintingJobScaleBarOptions.prototype.destroy
  74342. * @description 释放资源,将引用资源的属性置空。
  74343. */
  74344. destroy() {
  74345. this.scaleText = null;
  74346. this.orientation = null;
  74347. this.type = null;
  74348. this.intervals = null;
  74349. this.unit = null;
  74350. }
  74351. /**
  74352. * @function WebPrintingJobScaleBarOptions.prototype.toJSON
  74353. * @description 将 WebPrintingJobScaleBarOptions 对象转化为 JSON 字符串。
  74354. * @returns {string} 转换后的 JSON 字符串。
  74355. */
  74356. toJSON() {
  74357. var params = {
  74358. scaleText: this.scaleText || "",
  74359. type: this.type || "BAR",
  74360. intervals: this.intervals || "",
  74361. unit: this.unit || "METER"
  74362. };
  74363. if (this.orientation) {
  74364. params.orientation = this.orientation;
  74365. }
  74366. return Util_Util.toJSON(params);
  74367. }
  74368. }
  74369. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobContent.js
  74370. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74371. * This program are made available under the terms of the Apache License, Version 2.0
  74372. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74373. /**
  74374. * @class WebPrintingJobContent
  74375. * @deprecatedclass SuperMap.WebPrintingJobContent
  74376. * @classdesc Web 打印内容参数类。
  74377. * @version 10.1.0
  74378. * @category iServer WebPrintingJob
  74379. * @param {Object} option - 参数。
  74380. * @param {string} option.type - Web 打印内容支持的类型。目前支持的类型:WEBMAP。
  74381. * @param {string} [option.url] - 待打印的 SuperMap iPortal WebMap 的 URL 地址。例如:http://supermapiportal:8190/iportal/web/maps/{mapid}/map.rjson 。
  74382. * @param {string} [option.token] - 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
  74383. * @param {WebMapSummaryObject} [option.value] - 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 JSON 表达。如果已填了 URL 参数,此参数可不传。
  74384. * @usage
  74385. */
  74386. class WebPrintingJobContent {
  74387. constructor(option) {
  74388. /**
  74389. * @member {string} WebPrintingJobContent.prototype.type
  74390. * @description Web 打印内容支持的类型。
  74391. */
  74392. this.type = null;
  74393. /**
  74394. * @member {string} [WebPrintingJobContent.prototype.url]
  74395. * @description 待打印的 SuperMap iPortal WebMap 的 URL 地址。
  74396. */
  74397. this.url = null;
  74398. /**
  74399. * @member {string} [WebPrintingJobContent.prototype.token]
  74400. * @description 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
  74401. */
  74402. this.token = null;
  74403. /**
  74404. * @member {WebMapSummaryObject} [WebPrintingJobContent.prototype.value]
  74405. * @description 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 JSON 表达。
  74406. */
  74407. this.value = null;
  74408. this.CLASS_NAME = 'SuperMap.WebPrintingJobContent';
  74409. Util_Util.extend(this, option);
  74410. }
  74411. /**
  74412. * @function WebPrintingJobContent.prototype.destroy
  74413. * @description 释放资源,将引用资源的属性置空。
  74414. */
  74415. destroy() {
  74416. this.type = false || "WEBMAP";
  74417. this.url = null;
  74418. this.token = null;
  74419. this.value = null;
  74420. }
  74421. /**
  74422. * @function WebPrintingJobContent.prototype.toJSON
  74423. * @description 将 WebPrintingJobContent 对象转化为 JSON 字符串。
  74424. * @returns {string} 转换后的 JSON 字符串。
  74425. */
  74426. toJSON() {
  74427. var params = {
  74428. type: this.type
  74429. };
  74430. if (this.token) {
  74431. params.token = this.token;
  74432. }
  74433. if (this.url) {
  74434. params.url = this.url;
  74435. } else if (this.value) {
  74436. params.value = this.value;
  74437. }
  74438. return Util_Util.toJSON(params);
  74439. }
  74440. }
  74441. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayoutOptions.js
  74442. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74443. * This program are made available under the terms of the Apache License, Version 2.0
  74444. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74445. /**
  74446. * @class WebPrintingJobLayoutOptions
  74447. * @deprecatedclass SuperMap.WebPrintingJobLayoutOptions
  74448. * @classdesc Web 打印的布局参数类。
  74449. * @version 10.1.0
  74450. * @category iServer WebPrintingJob
  74451. * @param {Object} option - 参数。
  74452. * @param {string} option.templateName - 布局模板的名称。
  74453. * @param {string} option.title - 地图主标题名称。
  74454. * @param {string} option.subTitle - 地图副标题名称。
  74455. * @param {string} option.author - 作者名称。
  74456. * @param {string} option.copyright - 版权信息。
  74457. * @param {WebPrintingJobLittleMapOptions} option.littleMapOptions - 小地图参数类。
  74458. * @param {WebPrintingJobLegendOptions} option.legendOptions - 图例参数类。
  74459. * @param {WebPrintingJobScaleBarOptions} [option.scaleBarOptions] - 地图比例尺参数类。
  74460. * @param {WebPrintingJobNorthArrowOptions} [option.northArrowOptions] - 地图指北针参数类。
  74461. * @usage
  74462. */
  74463. class WebPrintingJobLayoutOptions {
  74464. constructor(option) {
  74465. /**
  74466. * @member {string} WebPrintingJobLayoutOptions.prototype.templateName
  74467. * @description 布局模板的名称。
  74468. */
  74469. this.templateName = null;
  74470. /**
  74471. * @member {string} WebPrintingJobLayoutOptions.prototype.title
  74472. * @description 地图主标题名称。
  74473. */
  74474. this.title = null;
  74475. /**
  74476. * @member {string} WebPrintingJobLayoutOptions.prototype.subTitle
  74477. * @description 地图副标题名称。
  74478. */
  74479. this.subTitle = null;
  74480. /**
  74481. * @member {string} WebPrintingJobLayoutOptions.prototype.author
  74482. * @description 地图作者名称。
  74483. */
  74484. this.author = null;
  74485. /**
  74486. * @member {string} WebPrintingJobLayoutOptions.prototype.copyright
  74487. * @description 地图版权信息。
  74488. */
  74489. this.copyright = null;
  74490. /**
  74491. * @member {WebPrintingJobScaleBarOptions} [WebPrintingJobLayoutOptions.prototype.scaleBarOptions]
  74492. * @description 地图比例尺参数类。
  74493. */
  74494. this.scaleBarOptions = null;
  74495. /**
  74496. * @member {WebPrintingJobNorthArrowOptions} [WebPrintingJobLayoutOptions.prototype.northArrowOptions]
  74497. * @description 地图指北针参数类。
  74498. */
  74499. this.northArrowOptions = null;
  74500. /**
  74501. * @member {WebPrintingJobLittleMapOptions} WebPrintingJobLayoutOptions.prototype.littleMapOptions
  74502. * @description 小地图参数类。
  74503. */
  74504. this.littleMapOptions = null;
  74505. /**
  74506. * @member {WebPrintingJobLegendOptions} WebPrintingJobLayoutOptions.prototype.legendOptions
  74507. * @description 图例参数类。
  74508. */
  74509. this.legendOptions = null;
  74510. this.CLASS_NAME = 'SuperMap.WebPrintingJobLayoutOptions';
  74511. Util_Util.extend(this, option);
  74512. }
  74513. /**
  74514. * @function WebPrintingJobLayoutOptions.prototype.destroy
  74515. * @description 释放资源,将引用资源的属性置空。
  74516. */
  74517. destroy() {
  74518. this.templateName = null;
  74519. this.title = null;
  74520. this.subTitle = null;
  74521. this.author = null;
  74522. this.copyright = null;
  74523. if (this.scaleBarOptions instanceof WebPrintingJobScaleBarOptions) {
  74524. this.scaleBarOptions.destroy();
  74525. this.scaleBarOptions = null;
  74526. }
  74527. if (this.northArrowOptions instanceof WebPrintingJobNorthArrowOptions) {
  74528. this.northArrowOptions.destroy();
  74529. this.northArrowOptions = null;
  74530. }
  74531. if (this.littleMapOptions instanceof WebPrintingJobLittleMapOptions) {
  74532. this.littleMapOptions.destroy();
  74533. this.littleMapOptions = null;
  74534. }
  74535. if (this.legendOptions instanceof WebPrintingJobLegendOptions) {
  74536. this.legendOptions.destroy();
  74537. this.legendOptions = null;
  74538. }
  74539. }
  74540. /**
  74541. * @function WebPrintingJobLayoutOptions.prototype.toJSON
  74542. * @description 将 WebPrintingJobLayoutOptions 对象转化为 JSON 字符串。
  74543. * @returns {string} 转换后的 JSON 字符串。
  74544. */
  74545. toJSON() {
  74546. var params = {
  74547. templateName: this.templateName,
  74548. title: this.title,
  74549. subTitle: this.subTitle,
  74550. author: this.author,
  74551. copyright: this.copyright
  74552. };
  74553. if (this.scaleBarOptions) {
  74554. params.scaleBarOptions = this.scaleBarOptions;
  74555. }
  74556. if (this.northArrowOptions) {
  74557. params.northArrowOptions = this.northArrowOptions;
  74558. }
  74559. if (this.littleMapOptions) {
  74560. params.littleMapOptions = this.littleMapOptions;
  74561. }
  74562. if (this.legendOptions) {
  74563. params.legendOptions = this.legendOptions;
  74564. }
  74565. return Util_Util.toJSON(params);
  74566. }
  74567. }
  74568. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobExportOptions.js
  74569. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74570. * This program are made available under the terms of the Apache License, Version 2.0
  74571. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74572. /**
  74573. * @class WebPrintingJobExportOptions
  74574. * @deprecatedclass SuperMap.WebPrintingJobExportOptions
  74575. * @classdesc Web 打印的输出参数类。
  74576. * @version 10.1.0
  74577. * @category iServer WebPrintingJob
  74578. * @param {Object} option - 参数。
  74579. * @param {WebExportFormatType} option.format - Web 打印输出的格式,目前支持:PNG、PDF。
  74580. * @param {number} [option.dpi=96] - Web 打印输出的分辨率,单位为每英寸点数。默认值为 96 DPI。
  74581. * @param {number} [option.scale] - Web 打印输出的地图比例尺。
  74582. * @param {number} [option.rotation] - Web 打印输出的地图角度。
  74583. * @param {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} [option.center] - Web 打印输出的地图中心点。
  74584. * @usage
  74585. */
  74586. class WebPrintingJobExportOptions {
  74587. constructor(option) {
  74588. /**
  74589. * @member {WebExportFormatType} WebPrintingJobExportOptions.prototype.format
  74590. * @description Web 打印输出的格式。
  74591. */
  74592. this.format = null;
  74593. /**
  74594. * @member {number} [WebPrintingJobExportOptions.prototype.dpi=96]
  74595. * @description Web 打印输出的分辨率,单位为每英寸点数。
  74596. */
  74597. this.dpi = 96;
  74598. /**
  74599. * @member {number} [WebPrintingJobExportOptions.prototype.scale]
  74600. * @description Web 打印输出的地图比例尺。
  74601. */
  74602. this.scale = null;
  74603. /**
  74604. * @member {number} [WebPrintingJobExportOptions.prototype.rotation]
  74605. * @description Web 打印输出的地图角度。
  74606. */
  74607. this.rotation = null;
  74608. /**
  74609. * @member {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} [WebPrintingJobExportOptions.prototype.center]
  74610. * @description Web 打印输出的地图中心点。
  74611. */
  74612. this.center = null;
  74613. this.CLASS_NAME = 'SuperMap.WebPrintingJobExportOptions';
  74614. Util_Util.extend(this, option);
  74615. }
  74616. /**
  74617. * @function WebPrintingJobExportOptions.prototype.destroy
  74618. * @description 释放资源,将引用资源的属性置空。
  74619. */
  74620. destroy() {
  74621. this.format = null;
  74622. this.dpi = null;
  74623. this.scale = null;
  74624. this.rotation = null;
  74625. this.center = null;
  74626. this.outputSize = null;
  74627. }
  74628. /**
  74629. * @function WebPrintingJobExportOptions.prototype.toJSON
  74630. * @description 将 WebPrintingJobExportOptions 对象转化为 JSON 字符串。
  74631. * @returns {string} 转换后的 JSON 字符串。
  74632. */
  74633. toJSON() {
  74634. var params = {
  74635. format: this.format || "PDF",
  74636. dpi: this.dpi,
  74637. scale: this.scale,
  74638. center: this.center
  74639. };
  74640. if (this.rotation) {
  74641. params.rotation = this.rotation;
  74642. }
  74643. if (this.outputSize) {
  74644. params.outputSize = this.outputSize;
  74645. }
  74646. return Util_Util.toJSON(params);
  74647. }
  74648. }
  74649. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobParameters.js
  74650. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74651. * This program are made available under the terms of the Apache License, Version 2.0
  74652. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74653. /**
  74654. * @class WebPrintingJobParameters
  74655. * @deprecatedclass SuperMap.WebPrintingJobParameters
  74656. * @category iServer WebPrintingJob
  74657. * @version 10.1.0
  74658. * @classdesc Web 打印参数类。
  74659. * @param {Object} options - 参数。
  74660. * @param {WebPrintingJobContent} options.content - Web 打印的内容类。
  74661. * @param {WebPrintingJobLayoutOptions} options.layoutOptions - Web 打印的布局类,包含各种布局元素的设置。
  74662. * @param {WebPrintingJobExportOptions} options.exportOptions - Web 打印的输出类,包含 DPI、页面大小等。
  74663. * @usage
  74664. */
  74665. class WebPrintingJobParameters {
  74666. constructor(options) {
  74667. if (!options) {
  74668. return;
  74669. }
  74670. /**
  74671. * @member {WebPrintingJobContent} WebPrintingJobParameters.prototype.content
  74672. * @description Web 打印的内容类。
  74673. */
  74674. this.content = null;
  74675. /**
  74676. * @member {WebPrintingJobLayoutOptions} WebPrintingJobParameters.prototype.layoutOptions
  74677. * @description Web 打印的布局类,包含各种布局元素的设置。
  74678. */
  74679. this.layoutOptions = null;
  74680. /**
  74681. * @member {WebPrintingJobExportOptions} WebPrintingJobParameters.prototype.exportOptions
  74682. * @description Web 打印的输出类,包含 DPI、页面大小等。
  74683. */
  74684. this.exportOptions = null;
  74685. Util_Util.extend(this, options);
  74686. this.CLASS_NAME = 'SuperMap.WebPrintingJobParameters';
  74687. }
  74688. /**
  74689. * @function WebPrintingJobParameters.prototype.destroy
  74690. * @description 释放资源,将引用资源的属性置空。
  74691. */
  74692. destroy() {
  74693. if (this.content instanceof WebPrintingJobContent) {
  74694. this.content.destroy();
  74695. this.content = null;
  74696. }
  74697. if (this.layoutOptions instanceof WebPrintingJobLayoutOptions) {
  74698. this.layoutOptions.destroy();
  74699. this.layoutOptions = null;
  74700. }
  74701. if (this.exportOptions instanceof WebPrintingJobExportOptions) {
  74702. this.exportOptions.destroy();
  74703. this.exportOptions = null;
  74704. }
  74705. }
  74706. }
  74707. ;// CONCATENATED MODULE: ./src/common/iServer/FieldsFilter.js
  74708. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74709. * This program are made available under the terms of the Apache License, Version 2.0
  74710. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74711. /**
  74712. * @class FieldsFilter
  74713. * @deprecatedclass SuperMap.FieldsFilter
  74714. * @category iServer Data Field
  74715. * @classdesc 指定返回的用于描述 Feature 的字段。
  74716. * @param {Object} options - 可选参数。
  74717. * @param {Array.<string>} [options.include] 对返回的字段内容进行过滤,需保留的字段列表。
  74718. * @param {Array.<string>} [options.exclude] 对返回的字段内容进行过滤,需排除的字段列表。
  74719. * @usage
  74720. */
  74721. class FieldsFilter {
  74722. constructor(options) {
  74723. /**
  74724. * @description 对返回的字段内容进行过滤,需保留的字段列表。
  74725. * @member {Array.<string>} FieldsFilter.prototype.include
  74726. */
  74727. this.include = undefined;
  74728. /**
  74729. * @description 对返回的字段内容进行过滤,需排除的字段列表。
  74730. * @member {Array.<string>} FieldsFilter.prototype.exclude
  74731. */
  74732. this.exclude = undefined;
  74733. this.CLASS_NAME = 'SuperMap.FieldsFilter';
  74734. Util_Util.extend(this, options);
  74735. }
  74736. /**
  74737. * @function FieldsFilter.prototype.destroy
  74738. * @description 释放资源,将引用资源的属性置空。
  74739. */
  74740. destroy() {
  74741. var me = this;
  74742. me.include = undefined;
  74743. me.exclude = undefined;
  74744. }
  74745. /**
  74746. * @function FieldsFilter.prototype.constructFromObject
  74747. * @description 目标对象新增该类的可选参数。
  74748. * @param {Object} data 要转换的数据。
  74749. * @param {FieldsFilter} obj 返回的模型。
  74750. * @return {FieldsFilter} 返回结果。
  74751. */
  74752. static constructFromObject(data, obj) {
  74753. if (data) {
  74754. obj = obj || new FieldsFilter();
  74755. if (data.hasOwnProperty('include')) {
  74756. obj.include = data.include
  74757. }
  74758. if (data.hasOwnProperty('exclude')) {
  74759. obj.exclude = data.exclude
  74760. }
  74761. }
  74762. return obj;
  74763. }
  74764. }
  74765. ;// CONCATENATED MODULE: ./src/common/iServer/Sortby.js
  74766. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74767. * This program are made available under the terms of the Apache License, Version 2.0
  74768. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74769. /**
  74770. * @class Sortby
  74771. * @deprecatedclass SuperMap.Sortby
  74772. * @classdesc 通过指定字段进行排序的方法类。
  74773. * @category BaseTypes Util
  74774. * @param {Object} options - 参数。
  74775. * @param {string} options.field 属性名称。
  74776. * @param {Sortby.Direction} options.direction 排序规则,默认升序。
  74777. * @usage
  74778. */
  74779. class Sortby {
  74780. constructor(options) {
  74781. /**
  74782. * @description 属性名称。
  74783. * @member {string} Sortby.prototype.field
  74784. */
  74785. this.field = undefined;
  74786. /**
  74787. * @description 排序规则。
  74788. * @member {Sortby.Direction} Sortby.prototype.direction
  74789. * @default Sortby.Direction.ASC
  74790. */
  74791. this.direction = Sortby.Direction.ASC;
  74792. this.CLASS_NAME = 'SuperMap.Sortby';
  74793. Util_Util.extend(this, options);
  74794. }
  74795. /**
  74796. * @function Sortby.prototype.destroy
  74797. * @description 释放资源,将引用资源的属性置空。
  74798. */
  74799. destroy() {
  74800. var me = this;
  74801. me.field = undefined;
  74802. me.direction = 'ASC';
  74803. }
  74804. /**
  74805. * @function Sortby.prototype.constructFromObject
  74806. * @description 目标对象新增该类的可选参数。
  74807. * @param {Object} data 要转换的数据。
  74808. * @param {Sortby} obj 返回的模型。
  74809. * @return {Sortby} 返回结果。
  74810. */
  74811. static constructFromObject(data, obj) {
  74812. if (data) {
  74813. obj = obj || new Sortby();
  74814. if (data.hasOwnProperty('field')) {
  74815. obj.field = data.field;
  74816. }
  74817. if (data.hasOwnProperty('direction')) {
  74818. obj.direction = data.direction;
  74819. }
  74820. }
  74821. return obj;
  74822. }
  74823. }
  74824. /**
  74825. * @enum Direction
  74826. * @description 排序的类型枚举。
  74827. * @memberOf Sortby
  74828. * @readonly
  74829. * @type {string}
  74830. */
  74831. Sortby.Direction = {
  74832. /** 升序。 */
  74833. ASC: 'ASC',
  74834. /** 降序。 */
  74835. DESC: 'DESC'
  74836. };
  74837. ;// CONCATENATED MODULE: ./src/common/iServer/ImageSearchParameter.js
  74838. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74839. * This program are made available under the terms of the Apache License, Version 2.0
  74840. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74841. /**
  74842. * @class ImageSearchParameter
  74843. * @deprecatedclass SuperMap.ImageSearchParameter
  74844. * @classdesc 影像服务查询参数类。
  74845. * @category iServer Image
  74846. * @param {Object} options - 可选参数。
  74847. * @param {Array.<number>} [options.bbox] 指定查询范围。只有具有几何对象(geometry)属性的Features,并且该几何对象与该参数指定的范围相交的 Features 才会被选择出来。该参数可以包含4个数值或者6个数值,这取决于使用的坐标参考系统是否包含高程值: * 左下角坐标轴 1 的值 * 左下角坐标轴 2 的值 * 坐标轴 3 的最小值(可选) * 右上角坐标轴 1 的值 * 右上角坐标轴 2 的值 * 坐标轴 3 的最大值(可选) 坐标参考系统为 WGS 84 经度/纬度 (http://www.opengis.net/def/crs/OGC/1.3/CRS84)。对于 “WGS 84 经度/纬度” 坐标参考系统,该参数值的格式通常为:最小经度,最小纬度,最大经度,最大纬度。如果包含了高程值,该参数的格式为:最小经度,最小纬度,最小高程值,最大经度,最大纬度,最大高程值。如果一个 Feature 具有多个空间几何对象(geometry)属性,由服务器决定是否使用单一的空间几何对象属性,还是使用所有相关的几何对象作为最终的查询空间范围。
  74848. * @param {Array.<string>} [options.collections] 影像集合的ID数组,将在该指定的Collection中搜索Items。
  74849. * @param {Array.<string>} [options.ids] 只返回指定 Item 的 ID 数组中的Item。返回的 Item 的 ID 值数组。设置了该参数,所有其他过滤器参数(除了next和limit)将被忽略。
  74850. * @param {number} [options.limit] 返回的最大结果数,即响应文档包含的 Item 的数目。
  74851. * @param {FieldsFilter} [options.fields] 通过‘include’和‘exclude’属性分别指定哪些字段包含在查询结果的 Feature 描述中,哪些需要排除。返回结果中的stac_version,id,bbox,assets,links,geometry,type,properties这些字段为必须字段,若要返回结果中不含这种字段信息,需要显示地进行排除设置,如:排除geometry和bbox字段;在POST请求中,则需要将这些字段添加到“exclude”字段中,例如: "fields": { "exclude": ["geometry","bbox"] } } 。而对于返回的“properties”对象中的扩展字段内容,可以将字段前添加到‘include’字段中,如: "fields": { "include": ["properties.SmFileName","properties.SmHighPS"] } ,表示properties.SmFileName和properties.SmHighPS 属性都包含在查询结果中。
  74852. * @param {Object} [options.query] 定义查询哪些属性,查询运算符将应用于这些属性。运算符包括:eq、neq、gt、lt、gte、lte、startsWith、endsWith、contains、in。其中in是Array.<string>类型,例如:{ "SmFileName": { "eq":"B49C001002.tif" }}
  74853. * @param {Array.<Sortby>} [options.sortby] 由包含属性名称和排序规则的对象构成的数组。
  74854. * @usage
  74855. */
  74856. class ImageSearchParameter {
  74857. constructor(options) {
  74858. /**
  74859. * @description 指定查询范围。只有具有几何对象(geometry)属性的Features,并且该几何对象与该参数指定的范围相交的 Features 才会被选择出来该参数可以包含4个数值或者6个数值,这取决于使用的坐标参考系统是否包含高程值: * 左下角坐标轴 1 的值 * 左下角坐标轴 2 的值 * 坐标轴 3 的最小值(可选) * 右上角坐标轴 1 的值 * 右上角坐标轴 2 的值 * 坐标轴 3 的最大值(可选) 坐标参考系统为 WGS 84 经度/纬度 (http://www.opengis.net/def/crs/OGC/1.3/CRS84). 对于 “WGS 84 经度/纬度” 坐标参考系统,该参数值的格式通常为:最小经度,最小纬度,最大经度,最大纬度。如果包含了高程值,该参数的格式为:最小经度,最小纬度,最小高程值,最大经度,最大纬度,最大高程值。如果一个 Feature 具有多个空间几何对象(geometry)属性,由服务器决定是否使用单一的空间几何对象属性,还是使用所有相关的几何对象作为最终的查询空间范围。
  74860. * @member {Array.<number>} ImageSearchParameter.prototype.bbox
  74861. */
  74862. this.bbox = undefined;
  74863. /**
  74864. * @description 影像集合的ID数组,将在该指定的Collection中搜索Items。
  74865. * @member {Array.<string>} ImageSearchParameter.prototype.collections
  74866. */
  74867. this.collections = undefined;
  74868. /**
  74869. * @description 返回的 Item 的 ID 值数组。设置了该参数,所有其他过滤器参数(除了next和limit)将被忽略。
  74870. * @member {Array.<string>} ImageSearchParameter.prototype.ids
  74871. */
  74872. this.ids = undefined;
  74873. /**
  74874. * @description 单页返回的最大结果数。最小值为1,最大值为10000。
  74875. * @member {number} ImageSearchParameter.prototype.limit
  74876. */
  74877. this.limit = undefined;
  74878. /**
  74879. * @description 通过‘include’和‘exclude’属性分别指定哪些字段包含在查询结果的 Feature 描述中,哪些需要排除。返回结果中的stac_version,id,bbox,assets,links,geometry,type,properties这些字段为必须字段,若要返回结果中不含这种字段信息,需要显示地进行排除设置,如:排除geometry和bbox字段;在POST请求中,则需要将这些字段添加到“exclude”字段中,例如: "fields": { "exclude": ["geometry","bbox"] } } 。而对于返回的“properties”对象中的扩展字段内容,可以将字段前添加到‘include’字段中,如: "fields": { "include": ["properties.SmFileName","properties.SmHighPS"] } } ,表示properties.SmFileName和properties.SmHighPS 属性都包含在查询结果中。
  74880. * @member {FieldsFilter} ImageSearchParameter.prototype.fields
  74881. */
  74882. this.fields = undefined;
  74883. /**
  74884. * @description 定义查询哪些属性,查询运算符将应用于这些属性。
  74885. * @member {Object} ImageSearchParameter.prototype.query
  74886. */
  74887. this.query = undefined;
  74888. /**
  74889. * @description 由包含属性名称和排序规则的对象构成的数组。
  74890. * @member {Array.<Sortby>} ImageSearchParameter.prototype.sortby
  74891. */
  74892. this.sortby = undefined;
  74893. this.CLASS_NAME = 'SuperMap.ImageSearchParameter';
  74894. Util_Util.extend(this, options);
  74895. }
  74896. /**
  74897. * @function ImageSearchParameter.prototype.destroy
  74898. * @description 释放资源,将引用资源的属性置空。
  74899. */
  74900. destroy() {
  74901. var me = this;
  74902. me.bbox = undefined;
  74903. me.collections = undefined;
  74904. me.ids = undefined;
  74905. me.limit = undefined;
  74906. me.fields = undefined;
  74907. me.query = undefined;
  74908. me.sortby = undefined;
  74909. }
  74910. /**
  74911. * @function ImageSearchParameter.prototype.constructFromObject
  74912. * @description 目标对象新增该类的可选参数。
  74913. * @param {Object} data 要转换的数据。
  74914. * @param {ImageSearchParameter} obj 返回的模型。
  74915. * @return {ImageSearchParameter} 返回结果。
  74916. */
  74917. static constructFromObject(data, obj) {
  74918. if (data) {
  74919. obj = obj || new ImageSearchParameter();
  74920. if (data.hasOwnProperty('bbox')) {
  74921. obj.bbox = data.bbox;
  74922. }
  74923. if (data.hasOwnProperty('collections')) {
  74924. obj.collections = data.collections;
  74925. }
  74926. if (data.hasOwnProperty('ids')) {
  74927. obj.ids = data.ids;
  74928. }
  74929. if (data.hasOwnProperty('limit')) {
  74930. obj.limit = data.limit;
  74931. }
  74932. if (data.hasOwnProperty('fields')) {
  74933. obj.fields = (FieldsFilter.constructFromObject && FieldsFilter.constructFromObject(data.fields, {})) || data.fields;
  74934. }
  74935. if (data.hasOwnProperty('query')) {
  74936. obj.query = data.query;
  74937. }
  74938. if (data.hasOwnProperty('sortby')) {
  74939. obj.sortby = data.sortby;
  74940. if (data.sortby) {
  74941. obj.sortby = data.sortby.map((item) => {
  74942. return (Sortby.constructFromObject && Sortby.constructFromObject(item, {})) || item;
  74943. });
  74944. }
  74945. }
  74946. }
  74947. return obj;
  74948. }
  74949. }
  74950. ;// CONCATENATED MODULE: ./src/common/iServer/ImageStretchOption.js
  74951. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74952. * This program are made available under the terms of the Apache License, Version 2.0
  74953. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74954. /**
  74955. * @class ImageStretchOption
  74956. * @deprecatedclass SuperMap.ImageStretchOption
  74957. * @classdesc 影像拉伸类。
  74958. * @category iServer Image
  74959. * @param {Object} options - 可选参数。
  74960. * @param {ImageStretchOption.StretchType} [options.stretchType] 影像拉伸类型。该属性的值有以下几种情况:NONE,无拉伸;GAUSSIAN,高斯拉伸;PERCENTCLIP,百分比截断拉伸;MINIMUMMAXIMUM,最值拉伸;STANDARDDEVIATION,标准差拉伸。
  74961. * @param {number} [options.stdevCoefficient] 标准差系数。
  74962. * @param {number} [options.gaussianCoefficient] 高斯系数。
  74963. * @param {boolean} [options.useMedianValue] 高斯拉伸时,是否使用中间值,若该属性值为true,表示使用中间值;false,表示使用平均值。
  74964. * @param {number} [options.minPercent] 使用百分比截断拉伸时,排除影像直方图最低值区域的像元,该参数值为这部分像元占总像元百分比。
  74965. * @param {number} [options.maxPercent] 使用百分比截断拉伸时,排除影像直方图最高值区域的像元,该参数值为这部分像元占总像元百分比。
  74966. * @usage
  74967. */
  74968. class ImageStretchOption {
  74969. constructor(options) {
  74970. /**
  74971. * @description 影像拉伸类型。该属性的值有以下几种情况:NONE,无拉伸;GAUSSIAN,高斯拉伸;PERCENTCLIP,百分比截断拉伸;MINIMUMMAXIMUM,最值拉伸;STANDARDDEVIATION,标准差拉伸。
  74972. * @member {ImageStretchOption.StretchType} ImageStretchOption.prototype.stretchType
  74973. */
  74974. this.stretchType = undefined;
  74975. /**
  74976. * @description 标准差系数。
  74977. * @member {number} ImageStretchOption.prototype.stdevCoefficient
  74978. */
  74979. this.stdevCoefficient = undefined;
  74980. /**
  74981. * @description 高斯系数。
  74982. * @member {number} ImageStretchOption.prototype.gaussianCoefficient
  74983. */
  74984. this.gaussianCoefficient = undefined;
  74985. /**
  74986. * @description 高斯拉伸时,是否使用中间值,若该属性值为true,表示使用中间值;false,表示使用平均值。
  74987. * @member {boolean} ImageStretchOption.prototype.useMedianValue
  74988. */
  74989. this.useMedianValue = undefined;
  74990. /**
  74991. * @description 使用百分比截断拉伸时,排除影像直方图最低值区域的像元,该参数值为这部分像元占总像元百分比。
  74992. * @member {number} ImageStretchOption.prototype.minPercent
  74993. */
  74994. this.minPercent = undefined;
  74995. /**
  74996. * @description 使用百分比截断拉伸时,排除影像直方图最高值区域的像元,该参数值为这部分像元占总像元百分比。
  74997. * @member {number} ImageStretchOption.prototype.maxPercent
  74998. */
  74999. this.maxPercent = undefined;
  75000. this.CLASS_NAME = 'SuperMap.ImageStretchOption';
  75001. Util_Util.extend(this, options);
  75002. }
  75003. /**
  75004. * @function ImageStretchOption.prototype.destroy
  75005. * @description 释放资源,将引用资源的属性置空。
  75006. */
  75007. destroy() {
  75008. var me = this;
  75009. me.stretchType = undefined;
  75010. me.stdevCoefficient = undefined;
  75011. me.gaussianCoefficient = undefined;
  75012. me.useMedianValue = undefined;
  75013. me.minPercent = undefined;
  75014. me.maxPercent = undefined;
  75015. }
  75016. /**
  75017. * @function ImageStretchOption.prototype.constructFromObject
  75018. * @description 目标对象新增该类的可选参数。
  75019. * @param {Object} data 要转换的数据。
  75020. * @param {ImageStretchOption} obj 返回的模型。
  75021. * @return {ImageStretchOption} 返回结果。
  75022. */
  75023. static constructFromObject(data, obj) {
  75024. if (data) {
  75025. obj = obj || new ImageStretchOption();
  75026. if (data.hasOwnProperty('stretchType')) {
  75027. obj.stretchType = data.stretchType;
  75028. }
  75029. if (data.hasOwnProperty('stdevCoefficient')) {
  75030. obj.stdevCoefficient = data.stdevCoefficient;
  75031. }
  75032. if (data.hasOwnProperty('gaussianCoefficient')) {
  75033. obj.gaussianCoefficient = data.gaussianCoefficient;
  75034. }
  75035. if (data.hasOwnProperty('useMedianValue')) {
  75036. obj.useMedianValue = data.useMedianValue;
  75037. }
  75038. if (data.hasOwnProperty('minPercent')) {
  75039. obj.minPercent = data.minPercent;
  75040. }
  75041. if (data.hasOwnProperty('maxPercent')) {
  75042. obj.maxPercent = data.maxPercent;
  75043. }
  75044. }
  75045. return obj;
  75046. }
  75047. }
  75048. /**
  75049. * @enum StretchType
  75050. * @description 影像拉伸类型枚举。
  75051. * @memberOf ImageStretchOption
  75052. * @readonly
  75053. * @type {string}
  75054. */
  75055. ImageStretchOption.StretchType = {
  75056. /** 无拉伸。 */
  75057. NONE: 'NONE',
  75058. /** 高斯拉伸。 */
  75059. GAUSSIAN: 'GAUSSIAN',
  75060. /** 百分比截断拉伸。 */
  75061. PERCENTCLIP: 'PERCENTCLIP',
  75062. /** 最值拉伸。 */
  75063. MINIMUMMAXIMUM: 'MINIMUMMAXIMUM',
  75064. /** 标准差拉伸。 */
  75065. STANDARDDEVIATION: 'STANDARDDEVIATION'
  75066. };
  75067. ;// CONCATENATED MODULE: ./src/common/iServer/ImageRenderingRule.js
  75068. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75069. * This program are made available under the terms of the Apache License, Version 2.0
  75070. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75071. /**
  75072. * @class ImageRenderingRule
  75073. * @deprecatedclass SuperMap.ImageRenderingRule
  75074. * @classdesc 定义请求的影像如何进行渲染或者处理,如:影像的拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。
  75075. * @category iServer Image
  75076. * @param {Object} options - 可选参数。
  75077. * @param {ImageRenderingRule.DisplayMode} [options.displayMode] 影像显示模式,其中:Composite表示多波段组合显示;Stretched表示单波段拉伸显示。
  75078. * @param {string} [options.displayBands] 影像显示的波段或者波段组合。若影像的显示模式为STRETCHED,该属性指定一个波段的索引号(波段索引号从0开始计数);若影像的显示模式为COMPOSITE,该属性为组合的波段索引号,例如:属性值3,2,1表示采用4波段、3波段、2波段分别对应 R、G、B颜色通道进行组合显示。
  75079. * @param {ImageStretchOption} [options.stretchOption] 影像的拉伸参数。
  75080. * @param {ImageRenderingRule.InterpolationMode} [options.interpolationMode] 影像显示时使用的插值算法。
  75081. * @param {Array.<string>} [options.colorScheme] 影像拉伸显示的颜色方案。颜色方案为RGBA颜色数组。RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha的色彩空间。Alpha值可以省略不写,表示完全不透明。Alpha通道表示不透明度参数,若该值为0表示完全透明。例如:"255,0,0","0,255,0","0,0,255" 表示由红色、绿色、蓝色三种颜色构成的色带。
  75082. * @param {Array.<string>} [options.colorTable] 影像的颜色表。颜色表为栅格值与RGBA颜色值的对照表。RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha的色彩空间。Alpha值可以省略不写,表示完全不透明。Alpha通道表示不透明度参数,若该值为0表示完全透明。以下示例表示该颜色对照表由三组构成,第一组高程值为500,对应的颜色为红色;第二组高程值为700,对应的颜色为绿色;第三组高程值为700,对应的颜色为蓝色。示例:"500: 255,0,0", "700: 0,255,0" , "900: 0,0,255"。
  75083. * @param {number} [options.brightness] 影像显示的亮度。数值范围为-100到100,增加亮度为正,降低亮度为负。
  75084. * @param {number} [options.contrast] 影像显示的对比度。数值范围为-100到100,增加对比度为正,降低对比度为负。
  75085. * @param {string} [options.noData] 影像的无值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的无值。
  75086. * @param {string} [options.noDataColor] 影像的无值的显示颜色,支持RGB颜色,例如:255,0,0(红色),那么无值将以指定的红色显示。
  75087. * @param {boolean} [options.noDataTransparent] 无值是否透明显示,true表示透明显示无值;否则为false。
  75088. * @param {string} [options.backgroundValue] 影像的背景值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的背景值。
  75089. * @param {string} [options.backgroundColor] 指定背景值的颜色。支持指定RGB颜色,例如:255,0,0(红色),那么背景值将以指定的红色显示。
  75090. * @param {boolean} [options.backgroundTransparent] 背景值是否透明显示,true表示透明显示背景值;否则为false。
  75091. * @param {Array.<ImageGFHillShade|ImageGFSlope|ImageGFAspect|ImageGFOrtho>} [options.gridFunctions] 栅格函数链。
  75092. * @usage
  75093. */
  75094. class ImageRenderingRule {
  75095. constructor(options) {
  75096. /**
  75097. * @description 影像显示模式,其中:Composite表示多波段组合显示;Stretched表示单波段拉伸显示。
  75098. * @member {ImageRenderingRule.DisplayMode} ImageRenderingRule.prototype.displayMode
  75099. */
  75100. this.displayMode = undefined;
  75101. /**
  75102. * @description 影像显示的波段或者波段组合。该参数为一个数组,数组元素为波段索引号。若影像的显示模式为Stretched,该属性指定一个显示的波段;若影像的显示模式为Composite,该属性为组合的波段索引号,例如:属性值4,3,2表示采用4波段、3波段、2波段分别对应 R、G、B颜色通道进行组合显示。
  75103. * @member {string} ImageRenderingRule.prototype.displayBands
  75104. */
  75105. this.displayBands = undefined;
  75106. /**
  75107. * @description 影像的拉伸参数。
  75108. * @member {ImageStretchOption} ImageRenderingRule.prototype.stretchOption
  75109. */
  75110. this.stretchOption = undefined;
  75111. /**
  75112. * @description 影像显示时使用的插值算法。
  75113. * @member {ImageRenderingRule.InterpolationMode} ImageRenderingRule.prototype.interpolationMode
  75114. */
  75115. this.interpolationMode = undefined;
  75116. /**
  75117. * @description 影像拉伸显示的颜色方案。颜色方案为RGBA颜色数组。RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha的色彩空间。Alpha值可以省略不写,表示完全不透明。Alpha通道表示不透明度参数,若该值为0表示完全透明。例如:"255,0,0","0,255,0","0,0,255" 表示由红色、绿色、蓝色三种颜色构成的色带。
  75118. * @member {Array.<string>} ImageRenderingRule.prototype.colorScheme
  75119. */
  75120. this.colorScheme = undefined;
  75121. /**
  75122. * @description 影像的颜色表。颜色表为栅格值与RGBA颜色值的对照表。RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha的色彩空间。Alpha值可以省略不写,表示完全不透明。Alpha通道表示不透明度参数,若该值为0表示完全透明。以下示例表示该颜色对照表由三组构成,第一组高程值为500,对应的颜色为红色;第二组高程值为700,对应的颜色为绿色;第三组高程值为700,对应的颜色为蓝色。示例:"500: 255,0,0", "700: 0,255,0" , "900: 0,0,255"
  75123. * @member {Array.<string>} ImageRenderingRule.prototype.colorTable
  75124. */
  75125. this.colorTable = undefined;
  75126. /**
  75127. * @description 影像显示的亮度。数值范围为-100到100,增加亮度为正,降低亮度为负。
  75128. * @member {number} ImageRenderingRule.prototype.brightness
  75129. */
  75130. this.brightness = undefined;
  75131. /**
  75132. * @description 影像显示的对比度。数值范围为-100到100,增加对比度为正,降低对比度为负。
  75133. * @member {number} ImageRenderingRule.prototype.contrast
  75134. */
  75135. this.contrast = undefined;
  75136. /**
  75137. * @description 影像的无值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的无值。
  75138. * @member {string} ImageRenderingRule.prototype.noData
  75139. */
  75140. this.noData = undefined;
  75141. /**
  75142. * @description 影像的无值的显示颜色,支持RGB颜色,例如:255,0,0(红色),那么无值将以指定的红色显示。
  75143. * @member {string} ImageRenderingRule.prototype.noDataColor
  75144. */
  75145. this.noDataColor = undefined;
  75146. /**
  75147. * @description 无值是否透明显示,true表示透明显示无值;否则为false。
  75148. * @member {boolean} ImageRenderingRule.prototype.noDataTransparent
  75149. */
  75150. this.noDataTransparent = undefined;
  75151. /**
  75152. * @description 影像的背景值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的背景值。
  75153. * @member {string} ImageRenderingRule.prototype.backgroundValue
  75154. */
  75155. this.backgroundValue = undefined;
  75156. /**
  75157. * @description 指定背景值的颜色。支持指定RGB颜色,例如:255,0,0(红色),那么背景值将以指定的红色显示。
  75158. * @member {string} ImageRenderingRule.prototype.backgroundColor
  75159. */
  75160. this.backgroundColor = undefined;
  75161. /**
  75162. * @description 背景值是否透明显示,true表示透明显示背景值;否则为false。
  75163. * @member {boolean} ImageRenderingRule.prototype.backgroundTransparent
  75164. */
  75165. this.backgroundTransparent = undefined;
  75166. /**
  75167. * @description 栅格函数选项,通过应用栅格函数,可以对影像进行快速显示处理。
  75168. * @member {Array.<ImageGFHillShade|ImageGFSlope|ImageGFAspect|ImageGFOrtho>} ImageRenderingRule.prototype.gridFunctions
  75169. */
  75170. this.gridFunctions = undefined;
  75171. this.CLASS_NAME = 'SuperMap.ImageRenderingRule';
  75172. Util_Util.extend(this, options);
  75173. }
  75174. /**
  75175. * @function ImageRenderingRule.prototype.destroy
  75176. * @description 释放资源,将引用资源的属性置空。
  75177. */
  75178. destroy() {
  75179. var me = this;
  75180. me.displayMode = undefined;
  75181. me.displayBands = undefined;
  75182. me.stretchOption = undefined;
  75183. me.interpolationMode = undefined;
  75184. me.colorScheme = undefined;
  75185. me.colorTable = undefined;
  75186. me.brightness = undefined;
  75187. me.contrast = undefined;
  75188. me.noData = undefined;
  75189. me.noDataColor = undefined;
  75190. me.noDataTransparent = undefined;
  75191. me.backgroundValue = undefined;
  75192. me.backgroundColor = undefined;
  75193. me.backgroundTransparent = undefined;
  75194. me.gridFuncOptions = undefined;
  75195. }
  75196. /**
  75197. * @function ImageRenderingRule.prototype.constructFromObject
  75198. * @description 目标对象新增该类的可选参数。
  75199. * @param {Object} data 要转换的数据。
  75200. * @param {ImageRenderingRule} obj 返回的模型。
  75201. * @return {ImageRenderingRule} 返回结果。
  75202. */
  75203. static constructFromObject(data, obj) {
  75204. if (data) {
  75205. obj = obj || new ImageRenderingRule();
  75206. if (data.hasOwnProperty('displayMode')) {
  75207. obj.displayMode = data.displayMode;
  75208. }
  75209. if (data.hasOwnProperty('displayBands')) {
  75210. obj.displayBands = data.displayBands;
  75211. }
  75212. if (data.hasOwnProperty('stretchOption')) {
  75213. obj.stretchOption =
  75214. (ImageStretchOption.constructFromObject && ImageStretchOption.constructFromObject(data.stretchOption, {})) ||
  75215. data.stretchOption;
  75216. }
  75217. if (data.hasOwnProperty('interpolationMode')) {
  75218. obj.interpolationMode = data.interpolationMode;
  75219. }
  75220. if (data.hasOwnProperty('colorScheme')) {
  75221. obj.colorScheme = data.colorScheme;
  75222. }
  75223. if (data.hasOwnProperty('colorTable')) {
  75224. obj.colorTable = data.colorTable;
  75225. }
  75226. if (data.hasOwnProperty('brightness')) {
  75227. obj.brightness = data.brightness;
  75228. }
  75229. if (data.hasOwnProperty('contrast')) {
  75230. obj.contrast = data.contrast;
  75231. }
  75232. if (data.hasOwnProperty('noData')) {
  75233. obj.noData = data.noData;
  75234. }
  75235. if (data.hasOwnProperty('noDataColor')) {
  75236. obj.noDataColor = data.noDataColor;
  75237. }
  75238. if (data.hasOwnProperty('backgroundValue')) {
  75239. obj.backgroundValue = data.backgroundValue;
  75240. }
  75241. if (data.hasOwnProperty('noDataTransparent')) {
  75242. obj.noDataTransparent = data.noDataTransparent;
  75243. }
  75244. if (data.hasOwnProperty('backgroundColor')) {
  75245. obj.backgroundColor = data.backgroundColor;
  75246. }
  75247. if (data.hasOwnProperty('backgroundTransparent')) {
  75248. obj.backgroundTransparent = data.backgroundTransparent;
  75249. }
  75250. if (data.hasOwnProperty('gridFunctions')) {
  75251. obj.gridFunctions = data.gridFunctions;
  75252. }
  75253. }
  75254. return obj;
  75255. }
  75256. }
  75257. /**
  75258. * @enum DisplayMode
  75259. * @description 影像显示模式。
  75260. * @memberOf ImageRenderingRule
  75261. * @readonly
  75262. * @type {string}
  75263. */
  75264. ImageRenderingRule.DisplayMode = {
  75265. COMPOSITE: 'COMPOSITE',
  75266. STRETCHED: 'Stretched'
  75267. };
  75268. /**
  75269. * @enum InterpolationMode
  75270. * @description 影像显示时使用的插值算法枚举。
  75271. * @memberOf ImageRenderingRule
  75272. * @readonly
  75273. * @type {string}
  75274. */
  75275. ImageRenderingRule.InterpolationMode = {
  75276. /** 最邻近插值模式。 */
  75277. NEARESTNEIGHBOR: 'NEARESTNEIGHBOR',
  75278. /** 高质量的双线性插值模式。 */
  75279. HIGHQUALITYBILINEAR: 'HIGHQUALITYBILINEAR',
  75280. /** 默认插值模式。 */
  75281. DEFAULT: 'DEFAULT'
  75282. };
  75283. ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFHillShade.js
  75284. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75285. * This program are made available under the terms of the Apache License, Version 2.0
  75286. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75287. /**
  75288. * @class ImageGFHillShade
  75289. * @deprecatedclass SuperMap.ImageGFHillShade
  75290. * @classdesc 栅格函数对象:对DEM数据生成三维晕渲图。
  75291. * @category iServer Image
  75292. * @param {Object} options - 可选参数。
  75293. * @param {string} [options.girdFuncName='GFHillShade'] 栅格函数名称,参数值为:GFHillShade。
  75294. * @param {number} [options.Azimuth = 315] 光源方位角。用于确定光源的方向,是从光源所在位置的正北方向线起,依顺时针方向到光源与目标方向线的夹角,范围为 0-360 度,以正北方向为 0 度,依顺时针方向递增。默认值为:315。
  75295. * @param {number} [options.Altitude = 45] 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
  75296. * @param {number} [options.ZFactor = 1] 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
  75297. * @usage
  75298. */
  75299. class ImageGFHillShade {
  75300. constructor(options) {
  75301. /**
  75302. * @description 栅格函数名称,参数值为:GFHillShade。
  75303. * @member {string} ImageGFHillShade.prototype.girdFuncName
  75304. * @default 'GFHillShade'
  75305. */
  75306. this.girdFuncName = 'GFHillShade';
  75307. /**
  75308. * @description 光源方位角。用于确定光源的方向,是从光源所在位置的正北方向线起,依顺时针方向到光源与目标方向线的夹角,范围为 0-360 度,以正北方向为 0 度,依顺时针方向递增。默认值为:315。
  75309. * @member {number} ImageGFHillShade.prototype.Azimuth
  75310. */
  75311. this.Azimuth = 315;
  75312. /**
  75313. * @description 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
  75314. * @member {number} ImageGFHillShade.prototype.Altitude
  75315. */
  75316. this.Altitude = 45;
  75317. /**
  75318. * @description 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
  75319. * @member {number} ImageGFHillShade.prototype.ZFactor
  75320. */
  75321. this.ZFactor = 1;
  75322. this.CLASS_NAME = 'SuperMap.ImageGFHillShade';
  75323. Util_Util.extend(this, options);
  75324. }
  75325. /**
  75326. * @function ImageGFHillShade.prototype.destroy
  75327. * @description 释放资源,将引用资源的属性置空。
  75328. */
  75329. destroy() {
  75330. var me = this;
  75331. me.girdFuncName = 'GFHillShade';
  75332. me.Azimuth = 315;
  75333. me.Altitude = 45;
  75334. me.ZFactor = 1;
  75335. }
  75336. /**
  75337. * @function ImageGFHillShade.prototype.constructFromObject
  75338. * @description 目标对象新增该类的可选参数。
  75339. * @param {Object} data 要转换的数据。
  75340. * @param {ImageGFHillShade} obj 返回的模型。
  75341. * @return {ImageGFHillShade} 返回结果。
  75342. */
  75343. static constructFromObject(data, obj) {
  75344. if (data) {
  75345. obj = obj || new ImageGFHillShade();
  75346. if (data.hasOwnProperty('girdFuncName')) {
  75347. obj.girdFuncName = data.girdFuncName
  75348. }
  75349. if (data.hasOwnProperty('Azimuth')) {
  75350. obj.Azimuth = data.Azimuth
  75351. }
  75352. if (data.hasOwnProperty('Altitude')) {
  75353. obj.Altitude = data.Altitude
  75354. }
  75355. if (data.hasOwnProperty('ZFactor')) {
  75356. obj.ZFactor = data.ZFactor
  75357. }
  75358. }
  75359. return obj;
  75360. }
  75361. }
  75362. ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFAspect.js
  75363. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75364. * This program are made available under the terms of the Apache License, Version 2.0
  75365. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75366. /**
  75367. * @class ImageGFAspect
  75368. * @deprecatedclass SuperMap.ImageGFAspect
  75369. * @classdesc 栅格函数对象:对DEM数据生成坡向渲图。
  75370. * @category iServer Image
  75371. * @param {Object} options -可选参数。
  75372. * @param {string} [options.girdFuncName='GFAspect'] 栅格函数名称,参数值为:GFAspect。
  75373. * @param {number} [options.Azimuth] 光源方位角,固定为360度。
  75374. * @usage
  75375. */
  75376. class ImageGFAspect {
  75377. constructor(options) {
  75378. /**
  75379. * @description 栅格函数名称,参数值为:GFAspect。
  75380. * @member {string} ImageGFAspect.prototype.girdFuncName
  75381. * @default 'GFAspect'
  75382. */
  75383. this.girdFuncName = 'GFAspect';
  75384. /**
  75385. * @description 光源方位角,固定为360度。
  75386. * @member {number} ImageGFAspect.prototype.Azimuth
  75387. */
  75388. this.Azimuth = undefined;
  75389. this.CLASS_NAME = 'SuperMap.ImageGFAspect';
  75390. Util_Util.extend(this, options);
  75391. }
  75392. /**
  75393. * @function ImageGFAspect.prototype.destroy
  75394. * @description 释放资源,将引用资源的属性置空。
  75395. */
  75396. destroy() {
  75397. var me = this;
  75398. me.girdFuncName = 'GFAspect';
  75399. me.Azimuth = undefined;
  75400. }
  75401. /**
  75402. * @function ImageGFAspect.prototype.constructFromObject
  75403. * @description 目标对象新增该类的可选参数。
  75404. * @param {Object} data 要转换的数据。
  75405. * @param {ImageGFAspect} obj 返回的模型。
  75406. * @return {ImageGFAspect} 返回结果。
  75407. */
  75408. static constructFromObject(data, obj) {
  75409. if (data) {
  75410. obj = obj || new ImageGFAspect();
  75411. if (data.hasOwnProperty('girdFuncName')) {
  75412. obj.girdFuncName = data.girdFuncName
  75413. }
  75414. if (data.hasOwnProperty('Azimuth')) {
  75415. obj.Azimuth = data.Azimuth
  75416. }
  75417. }
  75418. return obj;
  75419. }
  75420. }
  75421. ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFOrtho.js
  75422. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75423. * This program are made available under the terms of the Apache License, Version 2.0
  75424. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75425. /**
  75426. * @class ImageGFOrtho
  75427. * @deprecatedclass SuperMap.ImageGFOrtho
  75428. * @classdesc 栅格函数对象:对DEM数据生成三维晕渲图。该栅格函数不需要输入参数,采用系统默认设置。
  75429. * @category iServer Image
  75430. * @param {Object} options - 可选参数。
  75431. * @param {string} [options.girdFuncName='GFOrtho'] 栅格函数名称,参数值为:GFOrtho。
  75432. * @usage
  75433. */
  75434. class ImageGFOrtho {
  75435. constructor(options) {
  75436. /**
  75437. * @description 栅格函数名称,参数值为:GFOrtho。
  75438. * @member {string} ImageGFOrtho.prototype.girdFuncName
  75439. * @default 'GFOrtho'
  75440. */
  75441. this.girdFuncName = 'GFOrtho';
  75442. this.CLASS_NAME = 'SuperMap.ImageGFOrtho';
  75443. Util_Util.extend(this, options);
  75444. }
  75445. /**
  75446. * @function ImageGFOrtho.prototype.destroy
  75447. * @description 释放资源,将引用资源的属性置空。
  75448. */
  75449. destroy() {
  75450. var me = this;
  75451. me.girdFuncName = 'GFOrtho';
  75452. }
  75453. /**
  75454. * @function ImageGFOrtho.prototype.constructFromObject
  75455. * @description 目标对象新增该类的可选参数。
  75456. * @param {Object} data 要转换的数据。
  75457. * @param {ImageGFOrtho} obj 返回的模型。
  75458. * @return {ImageGFOrtho} 返回结果。
  75459. */
  75460. static constructFromObject(data, obj) {
  75461. if (data) {
  75462. obj = obj || new ImageGFOrtho();
  75463. if (data.hasOwnProperty('girdFuncName')) {
  75464. obj.girdFuncName = data.girdFuncName
  75465. }
  75466. }
  75467. return obj;
  75468. }
  75469. }
  75470. ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFSlope.js
  75471. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75472. * This program are made available under the terms of the Apache License, Version 2.0
  75473. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75474. /**
  75475. * @class ImageGFSlope
  75476. * @deprecatedclass SuperMap.ImageGFSlope
  75477. * @classdesc 栅格函数对象:对DEM数据生成坡度图。
  75478. * @category iServer Image
  75479. * @param {Object} options - 可选参数。
  75480. * @param {string} [options.girdFuncName='GFSlope'] 栅格函数名称,参数值为:GFSlope。
  75481. * @param {number} [options.Altitude = 45] 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
  75482. * @param {number} [options.ZFactor = 1] 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
  75483. * @usage
  75484. */
  75485. class ImageGFSlope {
  75486. constructor(options) {
  75487. /**
  75488. * @description 栅格函数名称,参数值为:GFSlope。
  75489. * @member {string} ImageGFSlope.prototype.girdFuncName
  75490. * @default 'GFSlope'
  75491. */
  75492. this.girdFuncName = 'GFSlope';
  75493. /**
  75494. * @description 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
  75495. * @member {number} ImageGFSlope.prototype.Altitude
  75496. */
  75497. this.Altitude = 45;
  75498. /**
  75499. * @description 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
  75500. * @member {number} ImageGFSlope.prototype.ZFactor
  75501. */
  75502. this.ZFactor = 1;
  75503. this.CLASS_NAME = 'SuperMap.ImageGFSlope';
  75504. Util_Util.extend(this, options);
  75505. }
  75506. /**
  75507. * @function ImageGFSlope.prototype.destroy
  75508. * @description 释放资源,将引用资源的属性置空。
  75509. */
  75510. destroy() {
  75511. var me = this;
  75512. me.girdFuncName = 'GFSlope';
  75513. me.Altitude = 45;
  75514. me.ZFactor = 1;
  75515. }
  75516. /**
  75517. * @function ImageGFSlope.prototype.constructFromObject
  75518. * @description 目标对象新增该类的可选参数。
  75519. * @param {Object} data 要转换的数据。
  75520. * @param {ImageGFSlope} obj 返回的模型。
  75521. * @return {ImageGFSlope} 返回结果。
  75522. */
  75523. static constructFromObject(data, obj) {
  75524. if (data) {
  75525. obj = obj || new ImageGFSlope();
  75526. if (data.hasOwnProperty('girdFuncName')) {
  75527. obj.girdFuncName = data.girdFuncName
  75528. }
  75529. if (data.hasOwnProperty('Altitude')) {
  75530. obj.Altitude = data.Altitude
  75531. }
  75532. if (data.hasOwnProperty('ZFactor')) {
  75533. obj.ZFactor = data.ZFactor
  75534. }
  75535. }
  75536. return obj;
  75537. }
  75538. }
  75539. ;// CONCATENATED MODULE: ./src/common/iServer/KnowledgeGraphNodeParameter.js
  75540. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75541. * This program are made available under the terms of the Apache License, Version 2.0
  75542. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75543. /**
  75544. * @private
  75545. * @class KnowledgeGraphNodeParameter
  75546. * @deprecatedclass SuperMap.KnowledgeGraphNodeParameter
  75547. * @classdesc 知识图谱实体的参数设置。
  75548. * @category iServer KnowledgeGraph
  75549. * @version 11.1.0
  75550. * @param {Object} options - 参数。
  75551. * @param {string} options.id - 实体id。
  75552. * @param {Array.<string>} [options.labels] - 实体分类。
  75553. * @param {Object} [options.properties] - 属性。
  75554. * @usage
  75555. */
  75556. // {
  75557. // "id": 5348024557502471,
  75558. // "properties": {
  75559. // "server": "test1",
  75560. // "_labelfieldname": "FEATUREGUID",
  75561. // "_entityname": "院落",
  75562. // "_bindfindid": "院落@ST_YARDA@1",
  75563. // "FEATUREGUID": "{409E615B-A545-4E07-872D-B12EDA0B4A1A}",
  75564. // "_findid": 1,
  75565. // "ENTITYNAME": "公共管理与公共服务"
  75566. // },
  75567. // "labels": ["院落"]
  75568. // }
  75569. class KnowledgeGraphNodeParameter {
  75570. constructor(options) {
  75571. /**
  75572. * @member {string} KnowledgeGraphNodeParameter.prototype.id
  75573. * @description 实体ID。
  75574. */
  75575. this.id = null;
  75576. /**
  75577. * @member {Array.<string>} KnowledgeGraphNodeParameter.prototype.labels
  75578. * @description 实体分类。
  75579. */
  75580. this.labels = null;
  75581. /**
  75582. * @member {Object} KnowledgeGraphNodeParameter.prototype.properties
  75583. * @description 实体属性。
  75584. */
  75585. this.properties = null;
  75586. this.CLASS_NAME = 'SuperMap.KnowledgeGraphNodeParameter';
  75587. Util.extend(this, options);
  75588. }
  75589. destroy() {
  75590. var me = this;
  75591. me.id = null;
  75592. me.labels = null;
  75593. me.properties = null;
  75594. }
  75595. }
  75596. ;// CONCATENATED MODULE: ./src/common/iServer/KnowledgeGraphEdgeParameter.js
  75597. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75598. * This program are made available under the terms of the Apache License, Version 2.0
  75599. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75600. /**
  75601. * @private
  75602. * @class KnowledgeGraphEdgeParameter
  75603. * @deprecatedclass SuperMap.KnowledgeGraphEdgeParameter
  75604. * @classdesc 知识图谱关系的参数设置。
  75605. * @category iServer KnowledgeGraph
  75606. * @version 11.1.0
  75607. * @param {Object} options - 参数。
  75608. * @param {string} options.id - 边id。
  75609. * @param {string} options.start - 开始实体id。
  75610. * @param {string} options.end - 结束实体id。
  75611. * @param {string} [options.type] - 标签,关系。
  75612. * @param {Object} [options.properties] - 属性。
  75613. * @usage
  75614. */
  75615. class KnowledgeGraphEdgeParameter {
  75616. constructor(options) {
  75617. /**
  75618. * @member {string} KnowledgeGraphEdgeParameter.prototype.id
  75619. * @description 边id。
  75620. */
  75621. this.id = null;
  75622. /**
  75623. * @member {string} KnowledgeGraphEdgeParameter.prototype.start
  75624. * @description 开始实体id。
  75625. */
  75626. this.start = null;
  75627. /**
  75628. * @member {string} KnowledgeGraphEdgeParameter.prototype.end
  75629. * @description 结束实体id。
  75630. */
  75631. this.end = null;
  75632. /**
  75633. * @member {string} KnowledgeGraphEdgeParameter.prototype.type
  75634. * @description 标签,关系。
  75635. */
  75636. this.type = null;
  75637. /**
  75638. * @member {Object} KnowledgeGraphEdgeParameter.prototype.properties
  75639. * @description 实体属性。
  75640. */
  75641. this.properties = null;
  75642. this.CLASS_NAME = 'SuperMap.KnowledgeGraphEdgeParameter';
  75643. Util.extend(this, options);
  75644. }
  75645. destroy() {
  75646. var me = this;
  75647. me.id = null;
  75648. me.start = null;
  75649. me.end = null;
  75650. me.type = null;
  75651. me.properties = null;
  75652. }
  75653. }
  75654. ;// CONCATENATED MODULE: ./src/common/iServer/index.js
  75655. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75656. * This program are made available under the terms of the Apache License, Version 2.0
  75657. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75658. ;// CONCATENATED MODULE: ./src/common/online/OnlineResources.js
  75659. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75660. * This program are made available under the terms of the Apache License, Version 2.0
  75661. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75662. /**
  75663. * @enum ServiceStatus
  75664. * @category BaseTypes Constant
  75665. * @description 服务发布状态。
  75666. * @usage
  75667. * ```
  75668. * // 浏览器
  75669. * <script type="text/javascript" src="{cdn}"></script>
  75670. * <script>
  75671. * const result = {namespace}.ServiceStatus.DOES_NOT_INVOLVE;
  75672. *
  75673. * </script>
  75674. * // ES6 Import
  75675. * import { ServiceStatus } from '{npm}';
  75676. *
  75677. * const result = ServiceStatus.DOES_NOT_INVOLVE;
  75678. * ```
  75679. */
  75680. var ServiceStatus = {
  75681. /** 不涉及,不可发布。 */
  75682. DOES_NOT_INVOLVE: "DOES_NOT_INVOLVE",
  75683. /** 发布失败。 */
  75684. PUBLISH_FAILED: "PUBLISH_FAILED",
  75685. /** 已发布。 */
  75686. PUBLISHED: "PUBLISHED",
  75687. /** 正在发布。 */
  75688. PUBLISHING: "PUBLISHING",
  75689. /** 未发布。 */
  75690. UNPUBLISHED: "UNPUBLISHED",
  75691. /** 取消服务失败。 */
  75692. UNPUBLISHED_FAILED: "UNPUBLISHED_FAILED"
  75693. };
  75694. /**
  75695. * @enum DataItemOrderBy
  75696. * @category BaseTypes Constant
  75697. * @description 数据排序字段。
  75698. * @usage
  75699. * ```
  75700. * // 浏览器
  75701. * <script type="text/javascript" src="{cdn}"></script>
  75702. * <script>
  75703. * const result = {namespace}.DataItemOrderBy.FILENAME;
  75704. *
  75705. * </script>
  75706. * // ES6 Import
  75707. * import { DataItemOrderBy } from '{npm}';
  75708. *
  75709. * const result = DataItemOrderBy.FILENAME;
  75710. * ```
  75711. */
  75712. var DataItemOrderBy = {
  75713. /** 文件名。 */
  75714. FILENAME: "FILENAME",
  75715. /** ID。 */
  75716. ID: "ID",
  75717. /** 最后修改时间。 */
  75718. LASTMODIFIEDTIME: "LASTMODIFIEDTIME",
  75719. /** 作者昵称。 */
  75720. NICKNAME: "NICKNAME",
  75721. /** SERVICESTATUS。 */
  75722. SERVICESTATUS: "SERVICESTATUS",
  75723. /** 大小。 */
  75724. SIZE: "SIZE",
  75725. /** 状态。 */
  75726. STATUS: "STATUS",
  75727. /** 类型。 */
  75728. TYPE: "TYPE",
  75729. /** 更新时间。 */
  75730. UPDATETIME: "UPDATETIME",
  75731. /** 作者名。 */
  75732. USERNAME: "USERNAME"
  75733. };
  75734. /**
  75735. * @enum FilterField {number}
  75736. * @category BaseTypes Constant
  75737. * @description 关键字查询时的过滤字段。
  75738. * @usage
  75739. * ```
  75740. * // 浏览器
  75741. * <script type="text/javascript" src="{cdn}"></script>
  75742. * <script>
  75743. * const result = {namespace}.FilterField.LINKPAGE;
  75744. *
  75745. * </script>
  75746. * // ES6 Import
  75747. * import { FilterField } from '{npm}';
  75748. *
  75749. * const result = FilterField.LINKPAGE;
  75750. * ```
  75751. */
  75752. var FilterField = {
  75753. /** 服务地址。 */
  75754. LINKPAGE: "LINKPAGE",
  75755. /** 服务中包含的地图的名称。 */
  75756. MAPTITLE: "MAPTITLE",
  75757. /** 服务创建者昵称。 */
  75758. NICKNAME: "NICKNAME",
  75759. /** 服务名称。 */
  75760. RESTITLE: "RESTITLE",
  75761. /** 服务创建者用户名。 */
  75762. USERNAME: "USERNAME"
  75763. };
  75764. ;// CONCATENATED MODULE: ./src/common/online/OnlineServiceBase.js
  75765. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75766. * This program are made available under the terms of the Apache License, Version 2.0
  75767. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75768. /**
  75769. * @class OnlineServiceBase
  75770. * @deprecatedclass SuperMap.OnlineServiceBase
  75771. * @classdesc Online 服务基类(使用 key 作为权限限制的类需要实现此类)。
  75772. * @category iPortal/Online Core
  75773. * @param {Object} options - 可选参数。
  75774. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  75775. * @param {Object} [options.headers] - 请求头。
  75776. * @usage
  75777. */
  75778. class OnlineServiceBase {
  75779. constructor(options) {
  75780. options = options || {};
  75781. Util_Util.extend(this, options);
  75782. this.CLASS_NAME = "SuperMap.OnlineServiceBase";
  75783. }
  75784. /**
  75785. * @function OnlineServiceBase.prototype.request
  75786. * @description 请求 online 服务
  75787. * @param {string} [method='GET'] - 请求方式, 'GET', 'PUT', 'POST', 'DELETE'。
  75788. * @param {string} url - 服务地址。
  75789. * @param {Object} param - URL 查询参数。
  75790. * @param {Object} [requestOptions] - http 请求参数, 比如请求头,超时时间等。
  75791. * @returns {Promise} 包含请求结果的 Promise 对象。
  75792. */
  75793. request(method, url, param, requestOptions = {}) {
  75794. url = SecurityManager.appendCredential(url);
  75795. requestOptions['crossOrigin'] = this.options.crossOrigin;
  75796. requestOptions['headers'] = this.options.headers;
  75797. return FetchRequest.commit(method, url, param, requestOptions).then(function(response) {
  75798. return response.json();
  75799. });
  75800. }
  75801. }
  75802. ;// CONCATENATED MODULE: ./src/common/online/OnlineData.js
  75803. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75804. * This program are made available under the terms of the Apache License, Version 2.0
  75805. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75806. /**
  75807. * @class OnlineData
  75808. * @deprecatedclass SuperMap.OnlineData
  75809. * @classdesc Online myData 服务。
  75810. * @category iPortal/Online Resources Data
  75811. * @param {string} serviceRootUrl - 服务地址。
  75812. * @param {Object} options - 可选参数。
  75813. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  75814. * @param {Object} [options.headers] - 请求头。
  75815. * @usage
  75816. * @extends OnlineServiceBase
  75817. */
  75818. class OnlineData extends OnlineServiceBase {
  75819. //TODO 目前并没有对接服务支持的所有操作,日后需要补充完整
  75820. constructor(serviceRootUrl, options) {
  75821. super(serviceRootUrl);
  75822. options = options || {};
  75823. //MD5
  75824. this.MD5 = null;
  75825. //文件类型。
  75826. this.type = null;
  75827. //数据上传者名称。
  75828. this.userName = null;
  75829. //文件名称。
  75830. this.fileName = null;
  75831. //文件大小,单位为 B 。
  75832. this.size = null;
  75833. //服务发布状态。
  75834. this.serviceStatus = null;
  75835. //服务 id 。
  75836. this.serviceId = null;
  75837. //数据项 id 。
  75838. this.id = null;
  75839. //最后修改时间。
  75840. this.lastModfiedTime = null;
  75841. //文件状态。
  75842. this.status = null;
  75843. //数据文件存储 id 。
  75844. this.storageId = null;
  75845. //数据的发布信息。
  75846. this.publishInfo = null;
  75847. //数据的权限信息。
  75848. this.authorizeSetting = null;
  75849. //用户的昵称。
  75850. this.nickname = null;
  75851. //数据的标签。
  75852. this.tags = [];
  75853. //数据的描述信息。
  75854. this.description = null;
  75855. //数据发布的服务信息集合。
  75856. this.dataItemServices = null;
  75857. //数据坐标类型。
  75858. this.coordType = null;
  75859. //数据审核信息
  75860. this.dataCheckResult = null;
  75861. //数据元数据信息
  75862. this.dataMetaInfo = null;
  75863. //数据的缩略图路径。
  75864. this.thumbnail = null;
  75865. Util_Util.extend(this, options);
  75866. if (this.id) {
  75867. this.serviceUrl = serviceRootUrl + "/" + this.id;
  75868. }
  75869. this.CLASS_NAME = "SuperMap.OnlineData";
  75870. }
  75871. /**
  75872. * @function OnlineData.prototype.load
  75873. * @description 通过 URL 请求获取该服务完整信息。
  75874. * @returns {Promise} 不包含请求结果的 Promise 对象,请求返回结果自动填充到该类属性中。
  75875. */
  75876. load() {
  75877. if (!this.serviceUrl) {
  75878. return;
  75879. }
  75880. var me = this;
  75881. return me.request("GET", this.serviceUrl).then(function (result) {
  75882. Util_Util.extend(me, result);
  75883. });
  75884. }
  75885. /**
  75886. * @function OnlineData.prototype.getPublishedServices
  75887. * @description 获取数据发布的所有服务。
  75888. * @returns {Object} 数据发布的所有服务。
  75889. */
  75890. getPublishedServices() {
  75891. return this.dataItemServices;
  75892. }
  75893. /**
  75894. * @function OnlineData.prototype.getAuthorizeSetting
  75895. * @description 获取数据的权限信息。
  75896. * @returns {Object} 权限信息。
  75897. */
  75898. getAuthorizeSetting() {
  75899. return this.authorizeSetting;
  75900. }
  75901. }
  75902. ;// CONCATENATED MODULE: ./src/common/online/Online.js
  75903. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75904. * This program are made available under the terms of the Apache License, Version 2.0
  75905. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75906. /**
  75907. * @class Online
  75908. * @deprecatedclass SuperMap.Online
  75909. * @classdesc 对接 SuperMap Online 所有基础服务。
  75910. * @category iPortal/Online Resources
  75911. * @modulecategory Services
  75912. * @example
  75913. * var online=new Online();
  75914. * var services = online.queryDatas(param);
  75915. * service.then(function(services){
  75916. * var service= services[0];
  75917. * service.updateDataInfo();
  75918. * })
  75919. * @usage
  75920. */
  75921. class Online {
  75922. //TODO 目前并没有对接Online的所有操作,需要补充完整
  75923. //所有查询返回的是一个Promise,在外部使用的时候通过Promise的then方法获取异步结果
  75924. constructor() {
  75925. this.rootUrl = "https://www.supermapol.com";
  75926. this.webUrl = this.rootUrl + "/web";
  75927. var mContentUrl = this.webUrl + "/mycontent";
  75928. this.mDatasUrl = mContentUrl + "/datas";
  75929. this.CLASS_NAME = "SuperMap.Online";
  75930. }
  75931. /**
  75932. * @function Online.prototype.load
  75933. * @description 加载 online,验证 online 是否可用。
  75934. * @returns {Promise} 包含网络请求结果的 Promise 对象。
  75935. */
  75936. load() {
  75937. return FetchRequest.get(this.rootUrl).then(function (response) {
  75938. return response;
  75939. });
  75940. }
  75941. /**
  75942. * @function Online.prototype.login
  75943. * @description 登录Online
  75944. */
  75945. login() {
  75946. SecurityManager.loginOnline(this.rootUrl, true);
  75947. }
  75948. /**
  75949. * @function Online.prototype.queryDatas
  75950. * @description 查询 Online “我的内容” 下 “我的数据” 服务(需要登录状态获取),并返回可操作的服务对象。
  75951. * @param {OnlineQueryDatasParameter} parameter - myDatas 服务资源查询参数。
  75952. * @returns {Promise} 包含所有数据服务信息的 Promise 对象。
  75953. */
  75954. queryDatas(parameter) {
  75955. var me = this, url = me.mDatasUrl;
  75956. if (parameter) {
  75957. parameter = parameter.toJSON();
  75958. }
  75959. return FetchRequest.get(url, parameter).then(function (json) {
  75960. if (!json || !json.content || json.content.length < 1) {
  75961. return;
  75962. }
  75963. var services = [], contents = json.content, len = contents.length;
  75964. for (var i = 0; i < len; i++) {
  75965. var content = contents[i];
  75966. var service = new OnlineData(me.mDatasUrl, content);
  75967. services.push(service);
  75968. }
  75969. return services;
  75970. });
  75971. }
  75972. }
  75973. ;// CONCATENATED MODULE: ./src/common/online/OnlineQueryDatasParameter.js
  75974. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75975. * This program are made available under the terms of the Apache License, Version 2.0
  75976. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75977. /**
  75978. * @class OnlineQueryDatasParameter
  75979. * @deprecatedclass SuperMap.OnlineQueryDatasParameter
  75980. * @classdesc myDatas 服务资源查询参数。
  75981. * @category iPortal/Online Resources Data
  75982. * @param {Object} options - 参数。
  75983. * @usage
  75984. */
  75985. class OnlineQueryDatasParameter {
  75986. constructor(options) {
  75987. options = options || {};
  75988. /**
  75989. * @member {Array.<string>} OnlineQueryDatasParameter.prototype.userNames
  75990. * @description 数据作者名。可以根据数据作者名查询,默认查询全部。
  75991. */
  75992. this.userNames = null;
  75993. /**
  75994. * @member {Array.<Object>} OnlineQueryDatasParameter.prototype.types
  75995. * @description 数据类型。
  75996. */
  75997. this.types = null;
  75998. /**
  75999. * @member {string} OnlineQueryDatasParameter.prototype.fileName
  76000. * @description 文件名称。
  76001. */
  76002. this.fileName = null;
  76003. /**
  76004. * @member {string} OnlineQueryDatasParameter.prototype.serviceStatuses
  76005. * @description 服务发布状态。
  76006. */
  76007. this.serviceStatuses = null;
  76008. /**
  76009. * @member {string} OnlineQueryDatasParameter.prototype.serviceId
  76010. * @description 服务 ID。
  76011. */
  76012. this.serviceId = null;
  76013. /**
  76014. * @member {Array.<number>} OnlineQueryDatasParameter.prototype.ids
  76015. * @description 由数据项 ID 组成的整型数组。
  76016. */
  76017. this.ids = null;
  76018. /**
  76019. * @member {Array.<string>} OnlineQueryDatasParameter.prototype.keywords
  76020. * @description 关键字。
  76021. */
  76022. this.keywords = null;
  76023. /**
  76024. * @member {string} OnlineQueryDatasParameter.prototype.orderBy
  76025. * @description 排序字段。
  76026. */
  76027. this.orderBy = null;
  76028. /**
  76029. * @member {Array.<string>} OnlineQueryDatasParameter.prototype.tags
  76030. * @description 数据的标签。
  76031. */
  76032. this.tags = null;
  76033. /**
  76034. * @member {Array.<string>} OnlineQueryDatasParameter.prototype.filterFields
  76035. * @description 用于关键字查询时的过滤字段。
  76036. */
  76037. this.filterFields = null;
  76038. Util_Util.extend(this, options)
  76039. this.CLASS_NAME = "SuperMap.OnlineQueryDatasParameter";
  76040. }
  76041. /**
  76042. * @function OnlineQueryDatasParameter.prototype.toJSON
  76043. * @description 返回对应的 JSON 对象。
  76044. * @returns {Object} 对应的 JSON 对象。
  76045. */
  76046. toJSON() {
  76047. var me = this;
  76048. var jsonObj = {
  76049. "types": me.types,
  76050. "fileName": me.fileName,
  76051. "serviceStatuses": me.serviceStatuses,
  76052. "serviceId": me.serviceId,
  76053. "ids": me.ids,
  76054. "keywords": me.keywords,
  76055. "orderBy": me.orderBy,
  76056. "tags": me.tags,
  76057. "filterFields": me.filterFields
  76058. };
  76059. for (var key in jsonObj) {
  76060. if (jsonObj[key] == null) {
  76061. delete jsonObj[key]
  76062. }
  76063. }
  76064. return jsonObj;
  76065. }
  76066. }
  76067. ;// CONCATENATED MODULE: ./src/common/online/index.js
  76068. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76069. * This program are made available under the terms of the Apache License, Version 2.0
  76070. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76071. ;// CONCATENATED MODULE: ./src/common/security/KeyServiceParameter.js
  76072. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76073. * This program are made available under the terms of the Apache License, Version 2.0
  76074. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76075. /**
  76076. * @class KeyServiceParameter
  76077. * @deprecatedclass SuperMap.KeyServiceParameter
  76078. * @classdesc key申请参数
  76079. * @category Security
  76080. * @param {Object} options - 参数。
  76081. * @param {string} options.name - 申请服务名称。
  76082. * @param {number} options.serviceIds - 服务 ID。
  76083. * @param {ClientType} [options.clientType=ClientType.SERVER] - 服务端类型。
  76084. * @param {number} options.limitation - 有效期
  76085. * @usage
  76086. */
  76087. class KeyServiceParameter {
  76088. constructor(options) {
  76089. this.name = null;
  76090. this.serviceIds = null;
  76091. this.clientType = ClientType.SERVER;
  76092. this.limitation = null;
  76093. Util_Util.extend(this, options);
  76094. this.CLASS_NAME = "SuperMap.KeyServiceParameter";
  76095. }
  76096. /**
  76097. * @function KeyServiceParameter.prototype.toJSON
  76098. * @description 转换成 JSON 对象
  76099. * @returns {Object} 参数的 JSON 对象
  76100. */
  76101. toJSON() {
  76102. return {
  76103. name: this.name,
  76104. serviceIds: this.serviceIds,
  76105. clientType: this.clientType,
  76106. limitation: this.limitation
  76107. }
  76108. }
  76109. }
  76110. ;// CONCATENATED MODULE: ./src/common/security/ServerInfo.js
  76111. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76112. * This program are made available under the terms of the Apache License, Version 2.0
  76113. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76114. /**
  76115. * @class ServerInfo
  76116. * @deprecatedclass SuperMap.ServerInfo
  76117. * @classdesc 服务器信息(安全相关),包含服务器类型,服务地址,token服务地址等。
  76118. * @category Security
  76119. * @param {string} type - 服务器类型。
  76120. * @param {Object} options - 参数。
  76121. * @param {string} options.server - 服务器地址,如:http://supermapiserver:8090/iserver。
  76122. * @param {string} [options.tokenServiceUrl] - 如:http://supermapiserver:8090/iserver/services/security/tokens.json。
  76123. * @param {string} [options.keyServiceUrl] - 如:http://supermapiserver:8092/web/mycontent/keys/register.json。
  76124. * @usage
  76125. */
  76126. class ServerInfo {
  76127. constructor(type, options) {
  76128. /**
  76129. * @member {ServerType} ServerInfo.prototype.type
  76130. * @description 服务器类型。
  76131. */
  76132. this.type = type;
  76133. /**
  76134. * @member {string} ServerInfo.prototype.server
  76135. * @description 服务器地址。
  76136. */
  76137. this.server = null;
  76138. /**
  76139. * @member {string} [ServerInfo.prototype.tokenServiceUrl]
  76140. * @description 如:http://supermapiserver:8090/iserver/services/security/tokens.json。
  76141. */
  76142. this.tokenServiceUrl = null;
  76143. /**
  76144. * @member {string} [ServerInfo.prototype.keyServiceUrl]
  76145. * @description 如:http://supermapiserver:8092/web/mycontent/keys/register.json。
  76146. */
  76147. this.keyServiceUrl = null;
  76148. Util_Util.extend(this, options);
  76149. this.CLASS_NAME = "SuperMap.ServerInfo";
  76150. this.type = this.type || ServerType.ISERVER;
  76151. if (!this.server) {
  76152. console.error('server url require is not undefined')
  76153. }
  76154. // var patten = /http:\/\/([^\/]+)/i;
  76155. //this.server = this.server.match(patten)[0];
  76156. var tokenServiceSuffix = "/services/security/tokens";
  76157. if (this.type === ServerType.ISERVER && this.server.indexOf("iserver") < 0) {
  76158. tokenServiceSuffix = "/iserver" + tokenServiceSuffix;
  76159. }
  76160. if (!this.tokenServiceUrl) {
  76161. this.tokenServiceUrl = Util_Util.urlPathAppend(this.server, tokenServiceSuffix);
  76162. }
  76163. if (!this.keyServiceUrl) {
  76164. if (this.type === ServerType.IPORTAL) {
  76165. this.keyServiceUrl = Util_Util.urlPathAppend(this.server, "/web/mycontent/keys/register");
  76166. } else if (this.type === ServerType.ONLINE) {
  76167. this.keyServiceUrl = Util_Util.urlPathAppend(this.server, "/web/mycontent/keys");
  76168. }
  76169. }
  76170. }
  76171. }
  76172. ;// CONCATENATED MODULE: ./src/common/security/TokenServiceParameter.js
  76173. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76174. * This program are made available under the terms of the Apache License, Version 2.0
  76175. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76176. /**
  76177. * @class TokenServiceParameter
  76178. * @deprecatedclass SuperMap.TokenServiceParameter
  76179. * @classdesc token 申请参数。
  76180. * @category Security
  76181. * @param {Object} options - 参数。
  76182. * @param {string} options.username - 用户名。
  76183. * @param {string} options.password - 密码。
  76184. * @param {ClientType} [options.clientType='ClientType.NONE'] - token 申请的客户端标识类型。
  76185. * @param {string} [options.ip] - clientType=IP 时,此为必选参数。
  76186. * @param {string} [options.referer] -clientType=Referer 时,此为必选参数。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
  76187. * @param {number} [options.expiration=60] - 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
  76188. * @usage
  76189. *
  76190. */
  76191. class TokenServiceParameter {
  76192. constructor(options) {
  76193. /**
  76194. * @member {string} TokenServiceParameter.prototype.userName
  76195. * @description 用户名。
  76196. */
  76197. this.userName = null;
  76198. /**
  76199. * @member {string} TokenServiceParameter.prototype.password
  76200. * @description 密码。
  76201. */
  76202. this.password = null;
  76203. /**
  76204. * @member {ClientType} TokenServiceParameter.prototype.clientType
  76205. * @description token 申请的客户端标识类型。
  76206. */
  76207. this.clientType = ClientType.NONE;
  76208. /**
  76209. * @member {string} [TokenServiceParameter.prototype.ip]
  76210. * @description clientType=IP 时,此为必选参数。
  76211. */
  76212. this.ip = null;
  76213. /**
  76214. * @member {string} [TokenServiceParameter.prototype.referer]
  76215. * @description clientType=Referer 时,此为必选参数。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
  76216. */
  76217. this.referer = null;
  76218. /**
  76219. * @member {number} TokenServiceParameter.prototype.expiration
  76220. * @description 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
  76221. */
  76222. this.expiration = 60;
  76223. Util_Util.extend(this, options);
  76224. this.CLASS_NAME = "SuperMap.TokenServiceParameter";
  76225. }
  76226. /**
  76227. * @function TokenServiceParameter.prototype.toJSON
  76228. * @description 将所有信息转成 JSON 字符串。
  76229. * @returns {string} 参数的 JSON 字符串。
  76230. */
  76231. toJSON() {
  76232. return {
  76233. userName: this.userName,
  76234. password: this.password,
  76235. clientType: this.clientType,
  76236. ip: this.ip,
  76237. referer: this.referer,
  76238. expiration: this.expiration
  76239. }
  76240. }
  76241. }
  76242. ;// CONCATENATED MODULE: ./src/common/security/index.js
  76243. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76244. * This program are made available under the terms of the Apache License, Version 2.0
  76245. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76246. ;// CONCATENATED MODULE: external "function(){try{return elasticsearch}catch(e){return {}}}()"
  76247. const external_function_try_return_elasticsearch_catch_e_return_namespaceObject = function(){try{return elasticsearch}catch(e){return {}}}();
  76248. var external_function_try_return_elasticsearch_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_elasticsearch_catch_e_return_namespaceObject);
  76249. ;// CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/ElasticSearch.js
  76250. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76251. * This program are made available under the terms of the Apache License, Version 2.0
  76252. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76253. /**
  76254. * @class ElasticSearch
  76255. * @deprecatedclass SuperMap.ElasticSearch
  76256. * @classdesc ElasticSearch服务类。
  76257. * @category ElasticSearch
  76258. * @modulecategory Services
  76259. * @param {string} url - ElasticSearch服务地址。
  76260. * @param {Object} options - 参数。
  76261. * @param {function} [options.change] - 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  76262. * @param {boolean} [options.openGeoFence=false] - 是否开启地理围栏验证,默认为不开启。
  76263. * @param {function} [options.outOfGeoFence] - 数据超出地理围栏后执行的函数。
  76264. * @param {Object} [options.geoFence] - 地理围栏。
  76265. * @description
  76266. * <h3 style="font-size: 20px;margin-top: 20px;margin-bottom: 10px;">11.1.0</h3>
  76267. * 该功能依赖<a href="https://github.com/elastic/elasticsearch">@elastic/elasticsearch</a>, webpack5或其他不包含Node.js Polyfills的打包工具,需要加入相关配置,以webpack为例:<br/>
  76268. <p style="margin-top:10px;">首先安装相关Polyfills</p><pre><code>npm i stream-http https-browserify stream-browserify tty-browserify browserify-zlib os-browserify buffer url assert process -D</code></pre>
  76269. 然后配置webpack<pre><code>module.exports: {
  76270. resolve: {
  76271. alias: {
  76272. process: 'process/browser',
  76273. },
  76274. mainFields: ['browser', 'main'],
  76275. fallback: {
  76276. fs: false,
  76277. http: require.resolve('stream-http'),
  76278. https: require.resolve('https-browserify'),
  76279. os: require.resolve('os-browserify/browser'),
  76280. stream: require.resolve('stream-browserify'),
  76281. tty: require.resolve('tty-browserify'),
  76282. zlib: require.resolve('browserify-zlib')
  76283. }
  76284. }
  76285. plugins: [
  76286. new webpack.ProvidePlugin({
  76287. process: 'process/browser',
  76288. Buffer: ['buffer', 'Buffer']
  76289. }),
  76290. ]
  76291. }</code></pre>
  76292. * @usage
  76293. */
  76294. class ElasticSearch {
  76295. constructor(url, options) {
  76296. options = options || {};
  76297. /**
  76298. * @member {string} ElasticSearch.prototype.url
  76299. * @description ElasticSearch服务地址。
  76300. */
  76301. this.url = url;
  76302. /**
  76303. * @member {Object} ElasticSearch.prototype.client
  76304. * @description client ES客户端。
  76305. */
  76306. try {
  76307. // 老版本
  76308. this.client = new (external_function_try_return_elasticsearch_catch_e_return_default()).Client({
  76309. host: this.url
  76310. });
  76311. } catch (e) {
  76312. // 新版本
  76313. this.client = new (external_function_try_return_elasticsearch_catch_e_return_default()).Client({
  76314. node: {
  76315. url: new URL(this.url)
  76316. }
  76317. });
  76318. }
  76319. /**
  76320. * @deprecated
  76321. * @member {function} [ElasticSearch.prototype.change]
  76322. * @description 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  76323. */
  76324. this.change = null;
  76325. /**
  76326. * @member {boolean} [ElasticSearch.prototype.openGeoFence=false]
  76327. * @description 是否开启地理围栏验证,默认为不开启。
  76328. */
  76329. this.openGeoFence = false;
  76330. /**
  76331. * @member {function} [ElasticSearch.prototype.outOfGeoFence]
  76332. * @description 数据超出地理围栏后执行的函数。
  76333. */
  76334. this.outOfGeoFence = null;
  76335. /**
  76336. * @member {Object} [ElasticSearch.prototype.geoFence]
  76337. * @description 地理围栏。
  76338. * @example {
  76339. * radius: 1000,//单位是m
  76340. * center: [104.40, 30.43],
  76341. * unit: 'meter|degree'
  76342. * }
  76343. */
  76344. this.geoFence = null;
  76345. /*
  76346. * Constant: EVENT_TYPES
  76347. * {Array.<String>}
  76348. * 此类支持的事件类型。
  76349. *
  76350. */
  76351. this.EVENT_TYPES = ['change', 'error', 'outOfGeoFence'];
  76352. /**
  76353. * @member {Events} ElasticSearch.prototype.events
  76354. * @description 事件。
  76355. */
  76356. this.events = new Events(this, null, this.EVENT_TYPES);
  76357. /**
  76358. * @member {Object} ElasticSearch.prototype.eventListeners
  76359. * @description 监听器对象,在构造函数中设置此参数(可选),对 MapService 支持的两个事件 processCompleted 、processFailed 进行监听,
  76360. * 相当于调用 Events.on(eventListeners)。
  76361. */
  76362. this.eventListeners = null;
  76363. Util_Util.extend(this, options);
  76364. if (this.eventListeners instanceof Object) {
  76365. this.events.on(this.eventListeners);
  76366. }
  76367. }
  76368. /**
  76369. * @function ElasticSearch.prototype.setGeoFence
  76370. * @description 设置地理围栏,openGeoFence参数为true的时候,设置的地理围栏才生效。
  76371. * @param {Geometry} geoFence - 地理围栏。
  76372. */
  76373. setGeoFence(geoFence) {
  76374. this.geoFence = geoFence;
  76375. }
  76376. /**
  76377. * @function ElasticSearch.prototype.bulk
  76378. * @description 批量操作API,允许执行多个索引/删除操作。
  76379. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-bulk}</br>
  76380. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html}</br>
  76381. * @param {Object} params - 参数。
  76382. * @param {function} callback - 回调函数。
  76383. */
  76384. bulk(params, callback) {
  76385. return this.client.bulk(params, this._handleCallback(callback));
  76386. }
  76387. /**
  76388. * @function ElasticSearch.prototype.clearScroll
  76389. * @description 通过指定scroll参数进行查询来清除已经创建的scroll请求。
  76390. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-clearscroll}</br>
  76391. *更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  76392. * @param {Object} params - 参数。
  76393. * @param {function} callback - 回调函数。
  76394. */
  76395. clearScroll(params, callback) {
  76396. return this.client.clearScroll(params, this._handleCallback(callback));
  76397. }
  76398. /**
  76399. * @function ElasticSearch.prototype.count
  76400. * @description 获取集群、索引、类型或查询的文档个数。
  76401. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-count}</br>
  76402. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html}</br>
  76403. * @param {Object} params - 参数。
  76404. * @param {function} callback - 回调函数。
  76405. */
  76406. count(params, callback) {
  76407. return this.client.count(params, this._handleCallback(callback));
  76408. }
  76409. /**
  76410. * @function ElasticSearch.prototype.create
  76411. * @description 在特定索引中添加一个类型化的JSON文档,使其可搜索。如果具有相同index,type且ID已经存在的文档将发生错误。</br>
  76412. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-create}
  76413. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}
  76414. * @param {Object} params - 参数。
  76415. * @param {function} callback - 回调函数。
  76416. */
  76417. create(params, callback) {
  76418. return this.client.create(params, this._handleCallback(callback));
  76419. }
  76420. /**
  76421. * @function ElasticSearch.prototype.delete
  76422. * @description 根据其ID从特定索引中删除键入的JSON文档。
  76423. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-delete}</br>
  76424. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html}</br>
  76425. * @param {Object} params - 参数。
  76426. * @param {function} callback - 回调函数。
  76427. */
  76428. delete(params, callback) {
  76429. return this.client.delete(params, this._handleCallback(callback));
  76430. }
  76431. /**
  76432. * @function ElasticSearch.prototype.deleteByQuery
  76433. * @description 根据其ID从特定索引中删除键入的JSON文档。
  76434. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletebyquery}</br>
  76435. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html}</br>
  76436. * @param {Object} params - 参数。
  76437. * @param {function} callback - 回调函数。
  76438. */
  76439. deleteByQuery(params, callback) {
  76440. return this.client.deleteByQuery(params, this._handleCallback(callback));
  76441. }
  76442. /**
  76443. * @function ElasticSearch.prototype.deleteScript
  76444. * @description 根据其ID删除脚本。</br>
  76445. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletescript}</br>
  76446. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  76447. * @param {Object} params - 参数。
  76448. * @param {function} callback - 回调函数。
  76449. */
  76450. deleteScript(params, callback) {
  76451. return this.client.deleteScript(params, this._handleCallback(callback));
  76452. }
  76453. /**
  76454. * @function ElasticSearch.prototype.deleteTemplate
  76455. * @description 根据其ID删除模板。</br>
  76456. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletetemplate}</br>
  76457. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  76458. * @param {Object} params - 参数。
  76459. * @param {function} callback - 回调函数。
  76460. */
  76461. deleteTemplate(params, callback) {
  76462. return this.client.deleteTemplate(params, this._handleCallback(callback));
  76463. }
  76464. /**
  76465. * @function ElasticSearch.prototype.exists
  76466. * @description 检查给定文档是否存在。</br>
  76467. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-exists}</br>
  76468. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  76469. * @param {Object} params - 参数。
  76470. * @param {function} callback - 回调函数。
  76471. */
  76472. exists(params, callback) {
  76473. return this.client.exists(params, this._handleCallback(callback));
  76474. }
  76475. /**
  76476. * @function ElasticSearch.prototype.existsSource
  76477. * @description 检查资源是否存在。</br>
  76478. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-existssource}</br>
  76479. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  76480. * @param {Object} params - 参数。
  76481. * @param {function} callback - 回调函数。
  76482. */
  76483. existsSource(params, callback) {
  76484. return this.client.existsSource(params, this._handleCallback(callback));
  76485. }
  76486. /**
  76487. * @function ElasticSearch.prototype.explain
  76488. * @description 提供与特定查询相关的特定文档分数的详细信息。它还会告诉您文档是否与指定的查询匹配。</br>
  76489. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-explain}</br>
  76490. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html}</br>
  76491. * @param {Object} params - 参数。
  76492. * @param {function} callback - 回调函数。
  76493. */
  76494. explain(params, callback) {
  76495. return this.client.explain(params, this._handleCallback(callback));
  76496. }
  76497. /**
  76498. * @function ElasticSearch.prototype.fieldCaps
  76499. * @description 允许检索多个索引之间的字段的功能。(实验性API,可能会在未来版本中删除)</br>
  76500. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-fieldcaps}</br>
  76501. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html}</br>
  76502. * @param {Object} params - 参数。
  76503. * @param {function} callback - 回调函数。
  76504. */
  76505. fieldCaps(params, callback) {
  76506. return this.client.fieldCaps(params, this._handleCallback(callback));
  76507. }
  76508. /**
  76509. * @function ElasticSearch.prototype.get
  76510. * @description 从索引获取一个基于其ID的类型的JSON文档。</br>
  76511. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-get}</br>
  76512. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  76513. * @param {Object} params - 参数。
  76514. * @param {function} callback - 回调函数。
  76515. */
  76516. get(params, callback) {
  76517. return this.client.get(params, this._handleCallback(callback));
  76518. }
  76519. /**
  76520. * @function ElasticSearch.prototype.getScript
  76521. * @description 获取脚本。</br>
  76522. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getscript}</br>
  76523. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  76524. * @param {Object} params - 参数。
  76525. * @param {function} callback - 回调函数。
  76526. */
  76527. getScript(params, callback) {
  76528. return this.client.getScript(params, this._handleCallback(callback));
  76529. }
  76530. /**
  76531. * @function ElasticSearch.prototype.getSource
  76532. * @description 通过索引,类型和ID获取文档的源。</br>
  76533. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getsource}</br>
  76534. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  76535. * @param {Object} params - 参数。
  76536. * @param {function} callback - 回调函数。
  76537. */
  76538. getSource(params, callback) {
  76539. return this.client.getSource(params, this._handleCallback(callback));
  76540. }
  76541. /**
  76542. * @function ElasticSearch.prototype.getTemplate
  76543. * @description 获取模板。</br>
  76544. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-gettemplate}</br>
  76545. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  76546. * @param {Object} params - 参数。
  76547. * @param {function} callback - 回调函数。
  76548. */
  76549. getTemplate(params, callback) {
  76550. return this.client.getTemplate(params, this._handleCallback(callback));
  76551. }
  76552. /**
  76553. * @function ElasticSearch.prototype.index
  76554. * @description 在索引中存储一个键入的JSON文档,使其可搜索。</br>
  76555. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-index}</br>
  76556. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}</br>
  76557. * @param {Object} params - 参数。
  76558. * @param {function} callback - 回调函数。
  76559. */
  76560. index(params, callback) {
  76561. return this.client.index(params, this._handleCallback(callback));
  76562. }
  76563. /**
  76564. * @function ElasticSearch.prototype.info
  76565. * @description 从当前集群获取基本信息。</br>
  76566. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-info}</br>
  76567. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  76568. * @param {Object} params - 参数。
  76569. * @param {function} callback - 回调函数。
  76570. */
  76571. info(params, callback) {
  76572. return this.client.info(params, this._handleCallback(callback));
  76573. }
  76574. /**
  76575. * @function ElasticSearch.prototype.mget
  76576. * @description 根据索引,类型(可选)和ids来获取多个文档。mget所需的主体可以采用两种形式:文档位置数组或文档ID数组。</br>
  76577. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mget}</br>
  76578. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html}</br>
  76579. * @param {Object} params - 参数。
  76580. * @param {function} callback - 回调函数。
  76581. */
  76582. mget(params, callback) {
  76583. return this.client.mget(params, this._handleCallback(callback));
  76584. }
  76585. /**
  76586. * @function ElasticSearch.prototype.msearch
  76587. * @description 在同一请求中执行多个搜索请求。</br>
  76588. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearch}</br>
  76589. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html}</br>
  76590. * @param {Object} params - 参数。
  76591. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  76592. * 回调参数:error,response,结果存储在response.responses中。
  76593. */
  76594. msearch(params, callback) {
  76595. let me = this;
  76596. return me.client.msearch(params)
  76597. .then(function (resp) {
  76598. resp = resp.body || resp;
  76599. me._update(resp.responses, callback);
  76600. return resp;
  76601. }, function (err) {
  76602. callback(err);
  76603. me.events.triggerEvent('error', {error: err});
  76604. return err;
  76605. });
  76606. }
  76607. /**
  76608. * @function ElasticSearch.prototype.msearchTemplate
  76609. * @description 在同一请求中执行多个搜索模板请求。</br>
  76610. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearchtemplate}</br>
  76611. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  76612. * @param {Object} params - 参数。
  76613. * @param {function} callback - 回调函数。
  76614. */
  76615. msearchTemplate(params, callback) {
  76616. return this.client.msearchTemplate(params, this._handleCallback(callback));
  76617. }
  76618. /**
  76619. * @function ElasticSearch.prototype.mtermvectors
  76620. * @description 多termvectors API允许一次获得多个termvectors。</br>
  76621. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mtermvectors}</br>
  76622. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html}</br>
  76623. * @param {Object} params - 参数。
  76624. * @param {function} callback - 回调函数。
  76625. */
  76626. mtermvectors(params, callback) {
  76627. return this.client.mtermvectors(params, this._handleCallback(callback));
  76628. }
  76629. /**
  76630. * @function ElasticSearch.prototype.ping
  76631. * @description 测试连接。</br>
  76632. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-ping}</br>
  76633. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  76634. * @param {Object} params - 参数。
  76635. * @param {function} callback - 回调函数。
  76636. */
  76637. ping(params, callback) {
  76638. return this.client.ping(params, this._handleCallback(callback));
  76639. }
  76640. /**
  76641. * @function ElasticSearch.prototype.putScript
  76642. * @description 添加脚本。</br>
  76643. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-putscript}</br>
  76644. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  76645. * @param {Object} params - 参数。
  76646. * @param {function} callback - 回调函数。
  76647. */
  76648. putScript(params, callback) {
  76649. return this.client.putScript(params, this._handleCallback(callback));
  76650. }
  76651. /**
  76652. * @function ElasticSearch.prototype.putTemplate
  76653. * @description 添加模板。</br>
  76654. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-puttemplate}</br>
  76655. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  76656. * @param {Object} params - 参数。
  76657. * @param {function} callback - 回调函数。
  76658. */
  76659. putTemplate(params, callback) {
  76660. return this.client.putTemplate(params, this._handleCallback(callback));
  76661. }
  76662. /**
  76663. * @function ElasticSearch.prototype.reindex
  76664. * @description 重新索引。</br>
  76665. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindex}</br>
  76666. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  76667. * @param {Object} params - 参数。
  76668. * @param {function} callback - 回调函数。
  76669. */
  76670. reindex(params, callback) {
  76671. return this.client.reindex(params, this._handleCallback(callback));
  76672. }
  76673. /**
  76674. * @function ElasticSearch.prototype.reindexRessrottle
  76675. * @description 重新索引。</br>
  76676. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindexrethrottle}</br>
  76677. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  76678. * @param {Object} params - 参数。
  76679. * @param {function} callback - 回调函数。
  76680. */
  76681. reindexRessrottle(params, callback) {
  76682. return this.client.reindexRessrottle(params, this._handleCallback(callback));
  76683. }
  76684. /**
  76685. * @function ElasticSearch.prototype.renderSearchTemplate
  76686. * @description 搜索模板。</br>
  76687. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-rendersearchtemplate}</br>
  76688. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  76689. * @param {Object} params - 参数。
  76690. * @param {function} callback - 回调函数。
  76691. */
  76692. renderSearchTemplate(params, callback) {
  76693. return this.client.renderSearchTemplate(params, this._handleCallback(callback));
  76694. }
  76695. /**
  76696. * @function ElasticSearch.prototype.scroll
  76697. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。</br>
  76698. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-scroll}</br>
  76699. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  76700. * @param {Object} params - 参数。
  76701. * @param {function} callback - 回调函数。
  76702. */
  76703. scroll(params, callback) {
  76704. return this.client.scroll(params, this._handleCallback(callback));
  76705. }
  76706. /**
  76707. * @function ElasticSearch.prototype.search
  76708. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。
  76709. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search}</br>
  76710. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html}</br>
  76711. * @param {Object} params - 参数。
  76712. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  76713. * 回调参数:error,response,结果存储在response.responses中。
  76714. */
  76715. search(params, callback) {
  76716. let me = this;
  76717. return me.client.search(params)
  76718. .then(function (resp) {
  76719. resp = resp.body || resp;
  76720. me._update(resp, callback);
  76721. return resp;
  76722. }, function (err) {
  76723. callback && callback(err);
  76724. me.events.triggerEvent('error', {error: err});
  76725. return err;
  76726. });
  76727. }
  76728. /**
  76729. * @function ElasticSearch.prototype.searchShards
  76730. * @description 返回要执行搜索请求的索引和分片。
  76731. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchshards}</br>
  76732. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html}</br>
  76733. * @param {Object} params - 参数。
  76734. * @param {function} callback - 回调函数。
  76735. */
  76736. searchShards(params, callback) {
  76737. return this.client.searchShards(params, this._handleCallback(callback));
  76738. }
  76739. /**
  76740. * @function ElasticSearch.prototype.searchTemplate
  76741. * @description 搜索模板。
  76742. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchtemplate}</br>
  76743. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  76744. * @param {Object} params - 参数。
  76745. * @param {function} callback - 回调函数。
  76746. */
  76747. searchTemplate(params, callback) {
  76748. return this.client.searchTemplate(params, this._handleCallback(callback));
  76749. }
  76750. /**
  76751. * @function ElasticSearch.prototype.suggest
  76752. * @description 该建议功能通过使用特定的建议者,基于所提供的文本来建议类似的术语。
  76753. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-suggest}</br>
  76754. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  76755. * @param {Object} params - 参数。
  76756. * @param {function} callback - 回调函数。
  76757. */
  76758. suggest(params, callback) {
  76759. return this.client.suggest(params, this._handleCallback(callback));
  76760. }
  76761. /**
  76762. * @function ElasticSearch.prototype.termvectors
  76763. * @description 返回有关特定文档字段中的术语的信息和统计信息。
  76764. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-termvectors}</br>
  76765. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html}</br>
  76766. * @param {Object} params - 参数。
  76767. * @param {function} callback - 回调函数。
  76768. */
  76769. termvectors(params, callback) {
  76770. return this.client.termvectors(params, this._handleCallback(callback));
  76771. }
  76772. /**
  76773. * @function ElasticSearch.prototype.update
  76774. * @description 更新文档的部分。
  76775. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-update}</br>
  76776. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html}</br>
  76777. * @param {Object} params - 参数。
  76778. * @param {function} callback - 回调函数。
  76779. */
  76780. update(params, callback) {
  76781. return this.client.update(params, this._handleCallback(callback));
  76782. }
  76783. /**
  76784. * @function ElasticSearch.prototype.updateByQuery
  76785. * @description 通过查询API来更新文档。
  76786. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-updatebyquery}</br>
  76787. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html}</br>
  76788. * @param {Object} params - 参数。
  76789. * @param {function} callback - 回调函数。
  76790. */
  76791. updateByQuery(params, callback) {
  76792. return this.client.updateByQuery(params, this._handleCallback(callback));
  76793. }
  76794. /**
  76795. * @function ElasticSearch.prototype._handleCallback
  76796. * @description 处理ElasticSearch 16.x和5.x的callback兼容。 5.x的回调参数多包了一层body
  76797. * @param {function} callback - 回调函数。
  76798. * @private
  76799. */
  76800. _handleCallback(callback) {
  76801. return function () {
  76802. let args = Array.from(arguments);
  76803. const error = args.shift();
  76804. let resp = args.shift();
  76805. const body = resp && resp.body;
  76806. if (body) {
  76807. const { statusCode, headers } = resp;
  76808. args = [statusCode, headers];
  76809. resp = body;
  76810. }
  76811. callback.call(this, error, resp, ...args);
  76812. };
  76813. }
  76814. _update(data, callback) {
  76815. let me = this;
  76816. if (!data) {
  76817. return;
  76818. }
  76819. me.data = data;
  76820. if (me.openGeoFence && me.geoFence) {
  76821. me._validateDatas(data);
  76822. }
  76823. me.events.triggerEvent('change', {data: me.data});
  76824. //change方法已废弃,不建议使用。建议使用search方法的第二个参数传入请求成功的回调
  76825. if (me.change) {
  76826. me.change && me.change(data);
  76827. } else {
  76828. //加responses是为了保持跟原来es自身的数据结构一致
  76829. callback && callback(undefined, {responses: data});
  76830. }
  76831. }
  76832. _validateDatas(datas) {
  76833. if (!datas) {
  76834. return;
  76835. }
  76836. if (!(datas instanceof Array)) {
  76837. datas = [datas];
  76838. }
  76839. var i, len = datas.length;
  76840. for (i = 0; i < len; i++) {
  76841. this._validateData(datas[i]);
  76842. }
  76843. }
  76844. _validateData(data) {
  76845. let me = this;
  76846. data.hits.hits.map(function (source) {
  76847. let content = source._source;
  76848. let meterUnit = me._getMeterPerMapUnit(me.geoFence.unit);
  76849. let geoFenceCX = me.geoFence.center[0] * meterUnit;
  76850. let geoFenceCY = me.geoFence.center[1] * meterUnit;
  76851. let contentX = content.x * meterUnit;
  76852. let contentY = content.y * meterUnit;
  76853. let distance = me._distance(contentX, contentY, geoFenceCX, geoFenceCY);
  76854. let radius = me.geoFence.radius;
  76855. if (distance > radius) {
  76856. me.outOfGeoFence && me.outOfGeoFence(data);
  76857. me.events.triggerEvent('outOfGeoFence', {data: data});
  76858. }
  76859. return source;
  76860. });
  76861. }
  76862. _distance(x1, y1, x2, y2) {
  76863. return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  76864. }
  76865. _getMeterPerMapUnit(mapUnit) {
  76866. let earchRadiusInMeters = 6378137;
  76867. let meterPerMapUnit;
  76868. if (mapUnit === 'meter') {
  76869. meterPerMapUnit = 1;
  76870. } else if (mapUnit === 'degree') {
  76871. // 每度表示多少米。
  76872. meterPerMapUnit = Math.PI * 2 * earchRadiusInMeters / 360;
  76873. }
  76874. return meterPerMapUnit;
  76875. }
  76876. }
  76877. ;// CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/index.js
  76878. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76879. * This program are made available under the terms of the Apache License, Version 2.0
  76880. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76881. ;// CONCATENATED MODULE: ./src/common/thirdparty/index.js
  76882. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76883. * This program are made available under the terms of the Apache License, Version 2.0
  76884. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76885. ;// CONCATENATED MODULE: ./src/common/util/ColorsPickerUtil.js
  76886. var ColorRender = new Color();
  76887. // let "http://www.qzu.zj.cn": "#bd10e0"
  76888. // "www.qzct.net": "#7ed321" = new LevelRenderer.Tool.Color();
  76889. /**
  76890. * @name ColorsPickerUtil
  76891. * @namespace
  76892. * @category BaseTypes Util
  76893. * @classdesc 色带选择器工具类。用于1、创建canvas对象,2、从几种颜色中获取一定数量的渐变色。
  76894. * @usage
  76895. * ```
  76896. * // 浏览器
  76897. * <script type="text/javascript" src="{cdn}"></script>
  76898. * <script>
  76899. * const result = {namespace}.ColorsPickerUtil.createCanvas();
  76900. *
  76901. * // 弃用的写法
  76902. * const result = SuperMap.ColorsPickerUtil.createCanvas();
  76903. *
  76904. * </script>
  76905. *
  76906. * // ES6 Import
  76907. * import { ColorsPickerUtil } from '{npm}';
  76908. *
  76909. * const result = ColorsPickerUtil.createCanvas();
  76910. * ```
  76911. */
  76912. class ColorsPickerUtil {
  76913. /**
  76914. * @function ColorsPickerUtil.createCanvas
  76915. * @description 创建DOM canvas。
  76916. * @param {number} height - canvas 高度。
  76917. * @param {number} width - canvas 宽度。
  76918. */
  76919. static createCanvas (height, width){
  76920. var canvas = document.createElement("canvas");
  76921. canvas.height = height;
  76922. canvas.width = width;
  76923. return canvas.getContext("2d");
  76924. }
  76925. /**
  76926. * @function ColorsPickerUtil.getLinearGradient
  76927. * @description 线性渐变。
  76928. * @param {number} x0 - 渐变起点 x 坐标。
  76929. * @param {number} y0 - 渐变起点 y 坐标。
  76930. * @param {number} x1 - 渐变终点 x 坐标。
  76931. * @param {number} y1 - 渐变终点 y 坐标。
  76932. * @param {Array} colorList 颜色列表。
  76933. * @returns {CanvasGradient} Cavans 渐变颜色。
  76934. */
  76935. static getLinearGradient (x0, y0, x1, y1, colorList){
  76936. if (!this._ctx) {
  76937. this._ctx = this.getContext();
  76938. }
  76939. var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
  76940. var leng = colorList.length;
  76941. var add = 1/(leng -1);
  76942. var offset = 0;
  76943. for (var i = 0; i < leng; i++) {
  76944. gradient.addColorStop(offset, colorList[i]);
  76945. offset += add;
  76946. }
  76947. gradient.__nonRecursion = true;
  76948. return gradient;
  76949. }
  76950. /**
  76951. * @function ColorsPickerUtil.getContext
  76952. * @description 获取 Cavans 上下文。
  76953. * @returns {Object} Cavans 上下文。
  76954. */
  76955. static getContext () {
  76956. if (!this._ctx) {
  76957. this._ctx = document.createElement('canvas').getContext('2d');
  76958. }
  76959. return this._ctx;
  76960. }
  76961. /**
  76962. * @function ColorsPickerUtil.getStepColors
  76963. * @description 获取两种颜色之间渐变颜色数组。
  76964. * @param {string} start - 起始颜色。
  76965. * @param {string} end - 结束颜色。
  76966. * @param {number} step - 渐变级数。
  76967. * @returns {Array} 颜色数组。
  76968. */
  76969. static getStepColors (start, end, step){
  76970. start = ColorRender.toRGBA(start);
  76971. end = ColorRender.toRGBA(end);
  76972. start = ColorRender.getData(start);
  76973. end = ColorRender.getData(end);
  76974. var colors = [];
  76975. var stepR = (end[0] - start[0]) / step;
  76976. var stepG = (end[1] - start[1]) / step;
  76977. var stepB = (end[2] - start[2]) / step;
  76978. var stepA = (end[3] - start[3]) / step;
  76979. // 生成颜色集合
  76980. // fix by linfeng 颜色堆积
  76981. for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
  76982. colors[i] = ColorRender.toColor([
  76983. ColorRender.adjust(Math.floor(r), [ 0, 255 ]),
  76984. ColorRender.adjust(Math.floor(g), [ 0, 255 ]),
  76985. ColorRender.adjust(Math.floor(b), [ 0, 255 ]),
  76986. a.toFixed(4) - 0
  76987. ],'hex');
  76988. r += stepR;
  76989. g += stepG;
  76990. b += stepB;
  76991. a += stepA;
  76992. }
  76993. r = end[0];
  76994. g = end[1];
  76995. b = end[2];
  76996. a = end[3];
  76997. colors[i] = ColorRender.toColor([r, g, b, a], 'hex');
  76998. return colors;
  76999. }
  77000. /**
  77001. * @function ColorsPickerUtil.getGradientColors
  77002. * @description 获取指定级数的渐变颜色数组。
  77003. * @param {Array.<string>} colors - 颜色组。
  77004. * @param {number} total - 颜色总数。
  77005. * @param {string} themeType - 专题类型。
  77006. * @returns {Array.<string>} 颜色数组。
  77007. */
  77008. static getGradientColors (colors, total, themeType){
  77009. var ret = [], step;
  77010. var i, n, len = colors.length;
  77011. if (total === undefined) {
  77012. return;
  77013. }
  77014. if(len >= total){
  77015. if(themeType === 'RANGE'){
  77016. for(i = 0; i<total; i++){
  77017. ret.push(colors[i]);
  77018. }
  77019. }else {
  77020. //1/2前后取色
  77021. for(i = 0; i<total; i++){
  77022. let ii = Math.floor(i/2);
  77023. if(i%2 === 0){
  77024. ret.push(colors[ii]);
  77025. }else {
  77026. let index = colors.length -1 - ii;
  77027. ret.push(colors[index]);
  77028. }
  77029. }
  77030. }
  77031. } else {
  77032. step = Math.ceil(total/(len-1));
  77033. for (i = 0, n = len - 1; i < n; i++) {
  77034. var steps = this.getStepColors(colors[i], colors[i + 1], step);
  77035. if (i < n - 1) {
  77036. steps.pop();
  77037. }
  77038. ret = ret.concat(steps);
  77039. }
  77040. //删除多余元素
  77041. var nouse = ret.length - total;
  77042. for(var j = 0, index = 0; j< nouse; j++){
  77043. ret.splice(index+2,1);
  77044. }
  77045. }
  77046. return ret;
  77047. }
  77048. }
  77049. ;// CONCATENATED MODULE: ./src/common/util/ArrayStatistic.js
  77050. /**
  77051. * @name ArrayStatistic
  77052. * @namespace
  77053. * @category BaseTypes Util
  77054. * @classdesc 处理数组。
  77055. * @usage
  77056. * ```
  77057. * // 浏览器
  77058. * <script type="text/javascript" src="{cdn}"></script>
  77059. * <script>
  77060. * const result = {namespace}.ArrayStatistic.newInstance();
  77061. *
  77062. * // 弃用的写法
  77063. * const result = SuperMap.ArrayStatistic.newInstance();
  77064. *
  77065. * </script>
  77066. *
  77067. * // ES6 Import
  77068. * import { ArrayStatistic } from '{npm}';
  77069. *
  77070. * const result = ArrayStatistic.newInstance();
  77071. * ```
  77072. */
  77073. class ArrayStatistic {
  77074. // geostatsInstance: null,
  77075. /**
  77076. * @function ArrayStatistic.newInstance
  77077. * @description 初始化插件实例。
  77078. */
  77079. static newInstance() {
  77080. // if(!this.geostatsInstance) {
  77081. // // this.geostatsInstance = new geostats();
  77082. // // }
  77083. // window.dataList = [];
  77084. if(!this.geostatsInstance) {
  77085. this.geostatsInstance = new window.geostats();
  77086. }
  77087. return this.geostatsInstance;
  77088. }
  77089. /**
  77090. * @function ArrayStatistic.getInstance
  77091. * @description 设置需要被处理的数组。
  77092. * @param {Array} array - 数组。
  77093. */
  77094. static getInstance(array) {
  77095. let instance = this.newInstance();
  77096. instance.setSerie(array);
  77097. return instance;
  77098. }
  77099. /**
  77100. * @function ArrayStatistic.getArrayStatistic
  77101. * @description 获取数组统计的值。
  77102. * @param {Array.<number>} array - 需要统计的数组。
  77103. * @param {string} type - 统计方法。
  77104. */
  77105. static getArrayStatistic(array, type){
  77106. if(!array.length) {
  77107. return 0;
  77108. }
  77109. if(type === "Sum" || type === "求和"){
  77110. return this.getSum(array);
  77111. } else if(type === "Maximum" || type === "最大值"){
  77112. return this.getMax(array);
  77113. } else if(type === "Minimum" || type === "最小值"){
  77114. return this.getMin(array);
  77115. } else if(type === "Average" || type === "平均值"){
  77116. return this.getMean(array);
  77117. } else if(type === "Median" || type === "中位数"){
  77118. return this.getMedian(array);
  77119. } else if(type === "times" || type === "计数"){
  77120. return this.getTimes(array);
  77121. }
  77122. }
  77123. /**
  77124. * @function ArrayStatistic.getArraySegments
  77125. * @description 获取数组分段后的数值。
  77126. * @param {Array.<number>} array - 需要分段的数组。
  77127. * @param {string} type - 分段方法。
  77128. * @param {number} segNum - 分段个数。
  77129. */
  77130. static getArraySegments(array, type, segNum) {
  77131. if(type === "offset") {
  77132. return this.getEqInterval(array, segNum);
  77133. } else if(type === "jenks") {
  77134. return this.getJenks(array, segNum);
  77135. } else if(type === "square") {
  77136. // 数据都必须 >= 0
  77137. let minValue = this.getMin(array);
  77138. if(minValue >= 0){
  77139. return this.getSqrtInterval(array, segNum);
  77140. }else {
  77141. //console.log('数据都必须 >= 0');
  77142. // Util.showMessage(Language.hasNegValue + Language.noSupportRange, 'ERROR');
  77143. return false;
  77144. }
  77145. } else if(type === "logarithm") {
  77146. // 数据都必须 > 0
  77147. let minValue = this.getMin(array);
  77148. if(minValue > 0){
  77149. return this.getGeometricProgression(array, segNum);
  77150. }else {
  77151. //console.log('数据都必须 > 0');
  77152. // Util.showMessage(Language.hasZeroNegValue + Language.noSupportRange, 'ERROR');
  77153. return false;
  77154. }
  77155. }
  77156. }
  77157. /**
  77158. * @function ArrayStatistic.getSum
  77159. * @description 求和。
  77160. * @param {Array.<number>} array 需要求和的参数。
  77161. * @returns {number} 返回求和结果。
  77162. */
  77163. static getSum(array){
  77164. return this.getInstance(array).sum();
  77165. }
  77166. /**
  77167. * @function ArrayStatistic.getMax
  77168. * @description 最大值。
  77169. * @param {Array.<number>} array 需要求最大值的参数。
  77170. * @returns {number} 返回最大值。
  77171. */
  77172. static getMax(array){
  77173. return this.getInstance(array).max();
  77174. }
  77175. /**
  77176. * @function ArrayStatistic.getMin
  77177. * @description 最小值。
  77178. * @param {Array.<number>} array 需要求最小值的参数。
  77179. * @returns {number} 返回最小值。
  77180. */
  77181. static getMin(array){
  77182. return this.getInstance(array).min();
  77183. }
  77184. /**
  77185. * @function ArrayStatistic.getMean
  77186. * @description 求平均数。
  77187. * @param {Array.<number>} array 需要求平均数的参数。
  77188. * @returns {number} 返回平均数。
  77189. */
  77190. static getMean(array){
  77191. return this.getInstance(array).mean();
  77192. }
  77193. /**
  77194. * @function ArrayStatistic.getMedian
  77195. * @description 求中位数。
  77196. * @param {Array.<number>} array 需要求中位数的参数。
  77197. * @returns {number} 返回中位数。
  77198. */
  77199. static getMedian(array) {
  77200. return this.getInstance(array).median();
  77201. }
  77202. /**
  77203. * @function ArrayStatistic.getTimes
  77204. * @description 计数。
  77205. * @param {Array.<number>} array 需要计数的参数。
  77206. * @returns {number} 返回计数结果。
  77207. */
  77208. static getTimes(array) {
  77209. return array.length;
  77210. }
  77211. /**
  77212. * @function ArrayStatistic.getEqInterval
  77213. * @description 等距分段法。
  77214. * @param {Array} array 需要进行等距分段的数组。
  77215. * @param {number} segNum 分段个数。
  77216. */
  77217. static getEqInterval(array, segNum) {
  77218. return this.getInstance(array).getClassEqInterval(segNum);
  77219. }
  77220. /**
  77221. * @function ArrayStatistic.getJenks
  77222. * @description 自然断裂法。
  77223. * @param {Array} array 需要进行自然断裂的参数。
  77224. * @param {number} segNum 分段个数。
  77225. */
  77226. static getJenks(array, segNum) {
  77227. return this.getInstance(array).getClassJenks(segNum);
  77228. }
  77229. /**
  77230. * @function ArrayStatistic.getSqrtInterval
  77231. * @description 平方根分段法。
  77232. * @param {Array} array 需要进行平方根分段的参数。
  77233. * @param {number} segNum 分段个数。
  77234. */
  77235. static getSqrtInterval(array, segNum) {
  77236. array = array.map(function(value) {
  77237. return Math.sqrt(value);
  77238. });
  77239. let breaks = this.getInstance(array).getClassEqInterval(segNum);
  77240. return (
  77241. breaks.map(function(value) {
  77242. return value * value;
  77243. })
  77244. )
  77245. }
  77246. /**
  77247. * @function ArrayStatistic.getGeometricProgression
  77248. * @description 对数分段法。
  77249. * @param {Array} array 需要进行对数分段的参数。
  77250. * @param {number} segNum 分段个数。
  77251. */
  77252. static getGeometricProgression(array, segNum) {
  77253. return this.getInstance(array).getClassGeometricProgression(segNum);
  77254. }
  77255. }
  77256. ;// CONCATENATED MODULE: ./src/common/util/index.js
  77257. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  77258. * This program are made available under the terms of the Apache License, Version 2.0
  77259. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77260. function toSuperMapGeometry(geoJSON) {
  77261. if (geoJSON && geoJSON.type) {
  77262. var format = new GeoJSONFormat();
  77263. var result = format.read(geoJSON, "FeatureCollection");
  77264. return result[0].geometry;
  77265. }
  77266. }
  77267. function toSuperMapPolygon(lnglatBounds) {
  77268. const west = lnglatBounds.getWest();
  77269. const east = lnglatBounds.getEast();
  77270. const sourth = lnglatBounds.getSouth();
  77271. const north = lnglatBounds.getNorth();
  77272. return new Polygon([
  77273. new LinearRing([
  77274. new GeometryPoint(west, sourth),
  77275. new GeometryPoint(east, sourth),
  77276. new GeometryPoint(east, north),
  77277. new GeometryPoint(west, north)
  77278. ])
  77279. ]);
  77280. }
  77281. /**
  77282. * @function Util.extend
  77283. * @description 对象拷贝赋值。
  77284. * @param {Object} dest - 目标对象。
  77285. * @param {Object} arguments - 待拷贝的对象。
  77286. * @returns {Object} 赋值后的目标对象。
  77287. */
  77288. function extend(dest) {
  77289. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  77290. var arg = Object.getOwnPropertyNames(arguments)[index];
  77291. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  77292. continue;
  77293. }
  77294. var obj = arguments[arg];
  77295. if (obj) {
  77296. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  77297. var key = Object.getOwnPropertyNames(obj)[j];
  77298. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  77299. continue;
  77300. }
  77301. dest[key] = obj[key];
  77302. }
  77303. }
  77304. }
  77305. return dest;
  77306. }
  77307. // EXTERNAL MODULE: ./node_modules/lodash.topairs/index.js
  77308. var lodash_topairs = __webpack_require__(52);
  77309. var lodash_topairs_default = /*#__PURE__*/__webpack_require__.n(lodash_topairs);
  77310. ;// CONCATENATED MODULE: ./src/common/style/CartoCSS.js
  77311. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  77312. * This program are made available under the terms of the Apache License, Version 2.0
  77313. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77314. /**
  77315. * @class CartoCSS
  77316. * @deprecatedclass SuperMap.CartoCSS
  77317. * @classdesc CartoCSS 解析类,其主要功能为将 CartoCSS 字符串解析为 CartoCSS 的 shader 属性风格对象。
  77318. * @category BaseTypes Style
  77319. * @param {string} cartoStr - 样式表字符串。
  77320. * @example
  77321. * var cartocss = "@provinceLineColor:#ddd;
  77322. * #China_Provinces_L___China400{
  77323. * line-dasharray:10,10;
  77324. * line-color:@provinceLineColor;
  77325. * line-width:1;
  77326. * }";
  77327. * new CartoCSS(cartocss);
  77328. * @usage
  77329. */
  77330. /*eslint no-useless-escape: "off"*/
  77331. class CartoCSS {
  77332. constructor(cartoStr) {
  77333. this.env = null;
  77334. /**
  77335. * @member CartoCSS.prototype.parser
  77336. * @description 解析器。
  77337. */
  77338. this.parser = null;
  77339. /**
  77340. * @member CartoCSS.prototype.ruleSet
  77341. * @description CartoCSS 规则对象。
  77342. */
  77343. this.ruleSet = null;
  77344. /**
  77345. * @member CartoCSS.prototype.cartoStr
  77346. * @description CartoCSS 样式表字符串。
  77347. */
  77348. this.cartoStr = "";
  77349. /**
  77350. * @member CartoCSS.prototype.shaders
  77351. * @description Carto 着色器集。
  77352. */
  77353. this.shaders = null;
  77354. if (typeof cartoStr === "string") {
  77355. this.cartoStr = cartoStr;
  77356. this.env = {
  77357. frames: [],
  77358. errors: [],
  77359. error: function (obj) {
  77360. this.errors.push(obj);
  77361. }
  77362. };
  77363. this.parser = this.getParser(this.env);
  77364. this.parse(cartoStr);
  77365. this.shaders = this.toShaders();
  77366. }
  77367. }
  77368. /**
  77369. * @function CartoCSS.prototype.getParser
  77370. * @description 获取 CartoCSS 解析器。
  77371. */
  77372. getParser(env) {
  77373. var input, // LeSS input string
  77374. i, // current index in `input`
  77375. j, // current chunk
  77376. temp, // temporarily holds a chunk's state, for backtracking
  77377. memo, // temporarily holds `i`, when backtracking
  77378. furthest, // furthest index the parser has gone to
  77379. chunks, // chunkified input
  77380. current, // index of current chunk, in `input`
  77381. parser;
  77382. var that = this;
  77383. // This function is called after all files
  77384. // have been imported through `@import`.
  77385. var finish = function () {//NOSONAR
  77386. //所有文件导入完成之后调用
  77387. };
  77388. function save() {
  77389. temp = chunks[j];
  77390. memo = i;
  77391. current = i;
  77392. }
  77393. function restore() {
  77394. chunks[j] = temp;
  77395. i = memo;
  77396. current = i;
  77397. }
  77398. function sync() {
  77399. if (i > current) {
  77400. chunks[j] = chunks[j].slice(i - current);
  77401. current = i;
  77402. }
  77403. }
  77404. //
  77405. // Parse from a token, regexp or string, and move forward if match
  77406. //
  77407. function _match(tok) {
  77408. var match, length, c, endIndex;
  77409. // Non-terminal
  77410. if (tok instanceof Function) {
  77411. return tok.call(parser.parsers);
  77412. // Terminal
  77413. // Either match a single character in the input,
  77414. // or match a regexp in the current chunk (chunk[j]).
  77415. } else if (typeof(tok) === 'string') {
  77416. match = input.charAt(i) === tok ? tok : null;
  77417. length = 1;
  77418. sync();
  77419. } else {
  77420. sync();
  77421. match = tok.exec(chunks[j]);
  77422. if (match) {
  77423. length = match[0].length;
  77424. } else {
  77425. return null;
  77426. }
  77427. }
  77428. // The match is confirmed, add the match length to `i`,
  77429. // and consume any extra white-space characters (' ' || '\n')
  77430. // which come after that. The reason for this is that LeSS's
  77431. // grammar is mostly white-space insensitive.
  77432. if (match) {
  77433. var mem = i += length;
  77434. endIndex = i + chunks[j].length - length;
  77435. while (i < endIndex) {
  77436. c = input.charCodeAt(i);
  77437. if (!(c === 32 || c === 10 || c === 9)) {
  77438. break;
  77439. }
  77440. i++;
  77441. }
  77442. chunks[j] = chunks[j].slice(length + (i - mem));
  77443. current = i;
  77444. if (chunks[j].length === 0 && j < chunks.length - 1) {
  77445. j++;
  77446. }
  77447. if (typeof(match) === 'string') {
  77448. return match;
  77449. } else {
  77450. return match.length === 1 ? match[0] : match;
  77451. }
  77452. }
  77453. }
  77454. // Same as _match(), but don't change the state of the parser,
  77455. // just return the match.
  77456. function peek(tok) {
  77457. if (typeof(tok) === 'string') {
  77458. return input.charAt(i) === tok;
  77459. } else {
  77460. return !!tok.test(chunks[j]);
  77461. }
  77462. }
  77463. // Make an error object from a passed set of properties.
  77464. // Accepted properties:
  77465. // - `message`: Text of the error message.
  77466. // - `filename`: Filename where the error occurred.
  77467. // - `index`: Char. index where the error occurred.
  77468. function makeError(err) {
  77469. var einput;
  77470. var defautls = {
  77471. index: furthest,
  77472. filename: env.filename,
  77473. message: 'Parse error.',
  77474. line: 0,
  77475. column: -1
  77476. };
  77477. for (var prop in defautls) {
  77478. if (err[prop] === 0) {
  77479. err[prop] = defautls[prop];
  77480. }
  77481. }
  77482. if (err.filename && that.env.inputs && that.env.inputs[err.filename]) {
  77483. einput = that.env.inputs[err.filename];
  77484. } else {
  77485. einput = input;
  77486. }
  77487. err.line = (einput.slice(0, err.index).match(/\n/g) || '').length + 1;
  77488. for (var n = err.index; n >= 0 && einput.charAt(n) !== '\n'; n--) {
  77489. err.column++;
  77490. }
  77491. return new Error([err.filename, err.line, err.column, err.message].join(";"));
  77492. }
  77493. this.env = env = env || {};
  77494. this.env.filename = this.env.filename || null;
  77495. this.env.inputs = this.env.inputs || {};
  77496. // The Parser
  77497. parser = {
  77498. // Parse an input string into an abstract syntax tree.
  77499. // Throws an error on parse errors.
  77500. parse: function (str) {
  77501. var root, error = null;
  77502. i = j = current = furthest = 0;
  77503. chunks = [];
  77504. input = str.replace(/\r\n/g, '\n');
  77505. if (env.filename) {
  77506. that.env.inputs[env.filename] = input;
  77507. }
  77508. // Split the input into chunks.
  77509. chunks = (function (chunks) {
  77510. var j = 0,
  77511. skip = /(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,
  77512. comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,
  77513. string = /"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,
  77514. level = 0,
  77515. match,
  77516. chunk = chunks[0],
  77517. inParam;
  77518. for (var i = 0, c, cc; i < input.length;) {
  77519. skip.lastIndex = i;
  77520. if (match = skip.exec(input)) {
  77521. if (match.index === i) {
  77522. i += match[0].length;
  77523. chunk.push(match[0]);
  77524. }
  77525. }
  77526. c = input.charAt(i);
  77527. comment.lastIndex = string.lastIndex = i;
  77528. if (match = string.exec(input)) {
  77529. if (match.index === i) {
  77530. i += match[0].length;
  77531. chunk.push(match[0]);
  77532. continue;
  77533. }
  77534. }
  77535. if (!inParam && c === '/') {
  77536. cc = input.charAt(i + 1);
  77537. if (cc === '/' || cc === '*') {
  77538. if (match = comment.exec(input)) {
  77539. if (match.index === i) {
  77540. i += match[0].length;
  77541. chunk.push(match[0]);
  77542. continue;
  77543. }
  77544. }
  77545. }
  77546. }
  77547. switch (c) {
  77548. case '{'://NOSONAR
  77549. if (!inParam) {
  77550. level++;
  77551. chunk.push(c);
  77552. break;
  77553. }
  77554. case '}'://NOSONAR
  77555. if (!inParam) {
  77556. level--;
  77557. chunk.push(c);
  77558. chunks[++j] = chunk = [];
  77559. break;
  77560. }
  77561. case '('://NOSONAR
  77562. if (!inParam) {
  77563. inParam = true;
  77564. chunk.push(c);
  77565. break;
  77566. }
  77567. case ')'://NOSONAR
  77568. if (inParam) {
  77569. inParam = false;
  77570. chunk.push(c);
  77571. break;
  77572. }
  77573. default:
  77574. chunk.push(c);
  77575. break;
  77576. }
  77577. i++;
  77578. }
  77579. if (level !== 0) {
  77580. error = {
  77581. index: i - 1,
  77582. type: 'Parse',
  77583. message: (level > 0) ? "missing closing `}`" : "missing opening `{`"
  77584. };
  77585. }
  77586. return chunks.map(function (c) {
  77587. return c.join('');
  77588. });
  77589. })([[]]);
  77590. if (error) {
  77591. throw makeError(error);
  77592. }
  77593. // Sort rules by specificity: this function expects selectors to be
  77594. // split already.
  77595. //
  77596. // Written to be used as a .sort(Function);
  77597. // argument.
  77598. //
  77599. // [1, 0, 0, 467] > [0, 0, 1, 520]
  77600. var specificitySort = function (a, b) {
  77601. var as = a.specificity;
  77602. var bs = b.specificity;
  77603. if (as[0] != bs[0]) {return bs[0] - as[0];}
  77604. if (as[1] != bs[1]) {return bs[1] - as[1];}
  77605. if (as[2] != bs[2]) {return bs[2] - as[2];}
  77606. return bs[3] - as[3];
  77607. };
  77608. // Start with the primary rule.
  77609. // The whole syntax tree is held under a Ruleset node,
  77610. // with the `root` property set to true, so no `{}` are
  77611. // output.
  77612. root = new CartoCSS.Tree.Ruleset([], _match(this.parsers.primary));
  77613. root.root = true;
  77614. // Get an array of Ruleset objects, flattened
  77615. // and sorted according to specificitySort
  77616. root.toList = (function () {
  77617. return function (env) {
  77618. env.error = function (e) {
  77619. if (!env.errors) {env.errors = new Error('');}
  77620. if (env.errors.message) {
  77621. env.errors.message += '\n' + makeError(e).message;
  77622. } else {
  77623. env.errors.message = makeError(e).message;
  77624. }
  77625. };
  77626. env.frames = env.frames || [];
  77627. // call populates Invalid-caused errors
  77628. var definitions = this.flatten([], [], env);
  77629. definitions.sort(specificitySort);
  77630. return definitions;
  77631. };
  77632. })();
  77633. return root;
  77634. },
  77635. // Here in, the parsing rules/functions
  77636. //
  77637. // The basic structure of the syntax tree generated is as follows:
  77638. //
  77639. // Ruleset -> Rule -> Value -> Expression -> Entity
  77640. //
  77641. // In general, most rules will try to parse a token with the `_match()` function, and if the return
  77642. // value is truly, will return a new node, of the relevant type. Sometimes, we need to check
  77643. // first, before parsing, that's when we use `peek()`.
  77644. parsers: {
  77645. // The `primary` rule is the *entry* and *exit* point of the parser.
  77646. // The rules here can appear at any level of the parse tree.
  77647. //
  77648. // The recursive nature of the grammar is an interplay between the `block`
  77649. // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule,
  77650. // as represented by this simplified grammar:
  77651. //
  77652. // primary → (ruleset | rule)+
  77653. // ruleset → selector+ block
  77654. // block → '{' primary '}'
  77655. //
  77656. // Only at one point is the primary rule not called from the
  77657. // block rule: at the root level.
  77658. primary: function () {
  77659. var node, root = [];
  77660. while ((node = _match(this.rule) || _match(this.ruleset) ||
  77661. _match(this.comment)) ||
  77662. _match(/^[\s\n]+/) || (node = _match(this.invalid))) {
  77663. if (node) {root.push(node);}
  77664. }
  77665. return root;
  77666. },
  77667. invalid: function () {
  77668. var chunk = _match(/^[^;\n]*[;\n]/);
  77669. // To fail gracefully, match everything until a semicolon or linebreak.
  77670. if (chunk) {
  77671. return new CartoCSS.Tree.Invalid(chunk, memo);
  77672. }
  77673. },
  77674. // We create a Comment node for CSS comments `/* */`,
  77675. // but keep the LeSS comments `//` silent, by just skipping
  77676. // over them.
  77677. comment: function () {
  77678. var comment;
  77679. if (input.charAt(i) !== '/') {return;}
  77680. if (input.charAt(i + 1) === '/') {
  77681. return new CartoCSS.Tree.Comment(_match(/^\/\/.*/), true);
  77682. } else if (comment = _match(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/)) {
  77683. return new CartoCSS.Tree.Comment(comment);
  77684. }
  77685. },
  77686. // Entities are tokens which can be found inside an Expression
  77687. entities: {
  77688. // A string, which supports escaping " and ' "milky way" 'he\'s the one!'
  77689. quoted: function () {
  77690. if (input.charAt(i) !== '"' && input.charAt(i) !== "'") {return;}
  77691. var str = _match(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);
  77692. if (str) {
  77693. return new CartoCSS.Tree.Quoted(str[1] || str[2]);
  77694. }
  77695. },
  77696. // A reference to a Mapnik field, like [NAME]
  77697. // Behind the scenes, this has the same representation, but Carto
  77698. // needs to be careful to warn when unsupported operations are used.
  77699. field: function () {
  77700. var l = '[', r = ']';
  77701. if (!_match(l)) {return;}
  77702. var field_name = _match(/(^[^\]]+)/);
  77703. if (!_match(r)) {return;}
  77704. if (field_name) {return new CartoCSS.Tree.Field(field_name[1]);}
  77705. },
  77706. // This is a comparison operator
  77707. comparison: function () {
  77708. var str = _match(/^=~|=|!=|<=|>=|<|>/);
  77709. if (str) {
  77710. return str;
  77711. }
  77712. },
  77713. // A catch-all word, such as: hard-light
  77714. // These can start with either a letter or a dash (-),
  77715. // and then contain numbers, underscores, and letters.
  77716. keyword: function () {
  77717. var k = _match(/^[A-Za-z\u4e00-\u9fa5-]+[A-Za-z-0-9\u4e00-\u9fa5_]*/);
  77718. if (k) {
  77719. return new CartoCSS.Tree.Keyword(k);
  77720. }
  77721. },
  77722. // A function call like rgb(255, 0, 255)
  77723. // The arguments are parsed with the `entities.arguments` parser.
  77724. call: function () {
  77725. var name, args;
  77726. if (!(name = /^([\w\-]+|%)\(/.exec(chunks[j]))) {return;}
  77727. name = name[1];
  77728. if (name === 'url') {
  77729. // url() is handled by the url parser instead
  77730. return null;
  77731. } else {
  77732. i += name.length;
  77733. }
  77734. var l = '(', r = ')';
  77735. _match(l); // Parse the '(' and consume whitespace.
  77736. args = _match(this.entities['arguments']);
  77737. if (!_match(r)) {return;}
  77738. if (name) {
  77739. return new CartoCSS.Tree.Call(name, args, i);
  77740. }
  77741. },
  77742. // Arguments are comma-separated expressions
  77743. 'arguments': function () {
  77744. var args = [], arg;
  77745. while (arg = _match(this.expression)) {
  77746. args.push(arg);
  77747. var q = ',';
  77748. if (!_match(q)) {
  77749. break;
  77750. }
  77751. }
  77752. return args;
  77753. },
  77754. literal: function () {
  77755. return _match(this.entities.dimension) ||
  77756. _match(this.entities.keywordcolor) ||
  77757. _match(this.entities.hexcolor) ||
  77758. _match(this.entities.quoted);
  77759. },
  77760. // Parse url() tokens
  77761. //
  77762. // We use a specific rule for urls, because they don't really behave like
  77763. // standard function calls. The difference is that the argument doesn't have
  77764. // to be enclosed within a string, so it can't be parsed as an Expression.
  77765. url: function () {
  77766. var value;
  77767. if (input.charAt(i) !== 'u' || !_match(/^url\(/)) {return;}
  77768. value = _match(this.entities.quoted) || _match(this.entities.variable) ||
  77769. _match(/^[\-\w%@_match\/.&=:;#+?~]+/) || '';
  77770. var r = ')';
  77771. if (!_match(r)) {
  77772. return new CartoCSS.Tree.Invalid(value, memo, 'Missing closing ) in URL.');
  77773. } else {
  77774. return new CartoCSS.Tree.URL((typeof value.value !== 'undefined' ||
  77775. value instanceof CartoCSS.Tree.Variable) ?
  77776. value : new CartoCSS.Tree.Quoted(value));
  77777. }
  77778. },
  77779. // A Variable entity, such as `@fink`, in
  77780. //
  77781. // width: @fink + 2px
  77782. //
  77783. // We use a different parser for variable definitions,
  77784. // see `parsers.variable`.
  77785. variable: function () {
  77786. var name, index = i;
  77787. if (input.charAt(i) === '@' && (name = _match(/^@[\w-]+/))) {
  77788. return new CartoCSS.Tree.Variable(name, index, env.filename);
  77789. }
  77790. },
  77791. hexcolor: function () {
  77792. var rgb;
  77793. if (input.charAt(i) === '#' && (rgb = _match(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/))) {
  77794. return new CartoCSS.Tree.Color(rgb[1]);
  77795. }
  77796. },
  77797. keywordcolor: function () {
  77798. var rgb = chunks[j].match(/^[a-z]+/);
  77799. if (rgb && rgb[0] in CartoCSS.Tree.Reference.data.colors) {
  77800. return new CartoCSS.Tree.Color(CartoCSS.Tree.Reference.data.colors[_match(/^[a-z]+/)]);
  77801. }
  77802. },
  77803. // A Dimension, that is, a number and a unit. The only
  77804. // unit that has an effect is %
  77805. dimension: function () {
  77806. var c = input.charCodeAt(i);
  77807. if ((c > 57 || c < 45) || c === 47) {return;}
  77808. var value = _match(/^(-?\d*\.?\d+(?:[eE][-+]?\d+)?)(\%|\w+)?/);
  77809. if (value) {
  77810. return new CartoCSS.Tree.Dimension(value[1], value[2], memo);
  77811. }
  77812. }
  77813. },
  77814. // The variable part of a variable definition.
  77815. // Used in the `rule` parser. Like @fink:
  77816. variable: function () {
  77817. var name;
  77818. if (input.charAt(i) === '@' && (name = _match(/^(@[\w-]+)\s*:/))) {
  77819. return name[1];
  77820. }
  77821. },
  77822. // Entities are the smallest recognized token,
  77823. // and can be found inside a rule's value.
  77824. entity: function () {
  77825. var property1 = _match(this.entities.call) || _match(this.entities.literal);
  77826. var property2 = _match(this.entities.field) || _match(this.entities.variable);
  77827. var property3 = _match(this.entities.url) || _match(this.entities.keyword);
  77828. return property1 || property2 || property3;
  77829. },
  77830. // A Rule terminator. Note that we use `peek()` to check for '}',
  77831. // because the `block` rule will be expecting it, but we still need to make sure
  77832. // it's there, if ';' was ommitted.
  77833. end: function () {
  77834. var q = ';';
  77835. return _match(q) || peek('}');
  77836. },
  77837. // Elements are the building blocks for Selectors. They consist of
  77838. // an element name, such as a tag a class, or `*`.
  77839. //增加对中文的支持,[\u4e00-\u9fa5]
  77840. element: function () {
  77841. var e = _match(/^(?:[.#][\w\u4e00-\u9fa5\-]+|\*|Map)/);
  77842. if (e) {return new CartoCSS.Tree.Element(e);}
  77843. },
  77844. // Attachments allow adding multiple lines, polygons etc. to an
  77845. // object. There can only be one attachment per selector.
  77846. attachment: function () {
  77847. var s = _match(/^::([\w\-]+(?:\/[\w\-]+)*)/);
  77848. if (s) {return s[1];}
  77849. },
  77850. // Selectors are made out of one or more Elements, see above.
  77851. selector: function () {
  77852. var a, attachment,
  77853. e, elements = [],
  77854. f, filters = new CartoCSS.Tree.Filterset(),
  77855. z, zooms = [],
  77856. segments = 0, conditions = 0;
  77857. while (
  77858. (e = _match(this.element)) ||
  77859. (z = _match(this.zoom)) ||
  77860. (f = _match(this.filter)) ||
  77861. (a = _match(this.attachment))
  77862. ) {
  77863. segments++;
  77864. if (e) {
  77865. elements.push(e);
  77866. } else if (z) {
  77867. zooms.push(z);
  77868. conditions++;
  77869. } else if (f) {
  77870. var err = filters.add(f);
  77871. if (err) {
  77872. throw makeError({
  77873. message: err,
  77874. index: i - 1
  77875. });
  77876. }
  77877. conditions++;
  77878. } else if (attachment) {
  77879. throw makeError({
  77880. message: 'Encountered second attachment name.',
  77881. index: i - 1
  77882. });
  77883. } else {
  77884. attachment = a;
  77885. }
  77886. var c = input.charAt(i);
  77887. if (c === '{' || c === '}' || c === ';' || c === ',') {
  77888. break;
  77889. }
  77890. }
  77891. if (segments) {
  77892. return new CartoCSS.Tree.Selector(filters, zooms, elements, attachment, conditions, memo);
  77893. }
  77894. },
  77895. filter: function () {
  77896. save();
  77897. var key, op, val, l = '[', r = ']';
  77898. if (!_match(l)) {return;}
  77899. if (key = _match(/^[a-zA-Z0-9\-_]+/) ||
  77900. _match(this.entities.quoted) ||
  77901. _match(this.entities.variable) ||
  77902. _match(this.entities.keyword) ||
  77903. _match(this.entities.field)) {
  77904. if (key instanceof CartoCSS.Tree.Quoted) {
  77905. key = new CartoCSS.Tree.Field(key.toString());
  77906. }
  77907. if ((op = _match(this.entities.comparison)) &&
  77908. (val = _match(this.entities.quoted) ||
  77909. _match(this.entities.variable) ||
  77910. _match(this.entities.dimension) ||
  77911. _match(this.entities.keyword) ||
  77912. _match(this.entities.field))) {
  77913. if (!_match(r)) {
  77914. throw makeError({
  77915. message: 'Missing closing ] of filter.',
  77916. index: memo - 1
  77917. });
  77918. }
  77919. if (!key.is) {key = new CartoCSS.Tree.Field(key);}
  77920. return new CartoCSS.Tree.Filter(key, op, val, memo, env.filename);
  77921. }
  77922. }
  77923. },
  77924. zoom: function () {
  77925. save();
  77926. var op, val, r = ']';
  77927. if (_match(/^\[\s*zoom/g) &&
  77928. (op = _match(this.entities.comparison)) &&
  77929. (val = _match(this.entities.variable) || _match(this.entities.dimension)) && _match(r)) {
  77930. return new CartoCSS.Tree.Zoom(op, val, memo);
  77931. } else {
  77932. // backtrack
  77933. restore();
  77934. }
  77935. },
  77936. // The `block` rule is used by `ruleset`
  77937. // It's a wrapper around the `primary` rule, with added `{}`.
  77938. block: function () {
  77939. var content, l = '{', r = '}';
  77940. if (_match(l) && (content = _match(this.primary)) && _match(r)) {
  77941. return content;
  77942. }
  77943. },
  77944. // div, .class, body > p {...}
  77945. ruleset: function () {
  77946. var selectors = [], s, rules, q = ',';
  77947. save();
  77948. while (s = _match(this.selector)) {
  77949. selectors.push(s);
  77950. while (_match(this.comment)) {//NOSONAR
  77951. }
  77952. if (!_match(q)) {
  77953. break;
  77954. }
  77955. while (_match(this.comment)) {//NOSONAR
  77956. }
  77957. }
  77958. if (s) {
  77959. while (_match(this.comment)) {//NOSONAR
  77960. }
  77961. }
  77962. if (selectors.length > 0 && (rules = _match(this.block))) {
  77963. if (selectors.length === 1 &&
  77964. selectors[0].elements.length &&
  77965. selectors[0].elements[0].value === 'Map') {
  77966. var rs = new CartoCSS.Tree.Ruleset(selectors, rules);
  77967. rs.isMap = true;
  77968. return rs;
  77969. }
  77970. return new CartoCSS.Tree.Ruleset(selectors, rules);
  77971. } else {
  77972. // Backtrack
  77973. restore();
  77974. }
  77975. },
  77976. rule: function () {
  77977. var name, value, c = input.charAt(i);
  77978. save();
  77979. if (c === '.' || c === '#') {
  77980. return;
  77981. }
  77982. if (name = _match(this.variable) || _match(this.property)) {
  77983. value = _match(this.value);
  77984. if (value && _match(this.end)) {
  77985. return new CartoCSS.Tree.Rule(name, value, memo, env.filename);
  77986. } else {
  77987. furthest = i;
  77988. restore();
  77989. }
  77990. }
  77991. },
  77992. font: function () {
  77993. var value = [], expression = [], e, q = ',';
  77994. while (e = _match(this.entity)) {
  77995. expression.push(e);
  77996. }
  77997. value.push(new CartoCSS.Tree.Expression(expression));
  77998. if (_match(q)) {
  77999. while (e = _match(this.expression)) {
  78000. value.push(e);
  78001. if (!_match(q)) {
  78002. break;
  78003. }
  78004. }
  78005. }
  78006. return new CartoCSS.Tree.Value(value);
  78007. },
  78008. // A Value is a comma-delimited list of Expressions
  78009. // In a Rule, a Value represents everything after the `:`,
  78010. // and before the `;`.
  78011. value: function () {
  78012. var e, expressions = [], q = ',';
  78013. while (e = _match(this.expression)) {
  78014. expressions.push(e);
  78015. if (!_match(q)) {
  78016. break;
  78017. }
  78018. }
  78019. if (expressions.length > 1) {
  78020. return new CartoCSS.Tree.Value(expressions.map(function (e) {
  78021. return e.value[0];
  78022. }));
  78023. } else if (expressions.length === 1) {
  78024. return new CartoCSS.Tree.Value(expressions);
  78025. }
  78026. },
  78027. // A sub-expression, contained by parenthensis
  78028. sub: function () {
  78029. var e, l = '(', r = ")";
  78030. if (_match(l) && (e = _match(this.expression)) && _match(r)) {
  78031. return e;
  78032. }
  78033. },
  78034. // This is a misnomer because it actually handles multiplication
  78035. // and division.
  78036. multiplication: function () {
  78037. var m, a, op, operation, q = '/';
  78038. if (m = _match(this.operand)) {
  78039. while ((op = (_match(q) || _match('*') || _match('%'))) && (a = _match(this.operand))) {
  78040. operation = new CartoCSS.Tree.Operation(op, [operation || m, a], memo);
  78041. }
  78042. return operation || m;
  78043. }
  78044. },
  78045. addition: function () {
  78046. var m, a, op, operation, plus = '+';
  78047. if (m = _match(this.multiplication)) {
  78048. while ((op = _match(/^[-+]\s+/) || (input.charAt(i - 1) != ' ' && (_match(plus) || _match('-')))) &&
  78049. (a = _match(this.multiplication))) {
  78050. operation = new CartoCSS.Tree.Operation(op, [operation || m, a], memo);
  78051. }
  78052. return operation || m;
  78053. }
  78054. },
  78055. // An operand is anything that can be part of an operation,
  78056. // such as a Color, or a Variable
  78057. operand: function () {
  78058. return _match(this.sub) || _match(this.entity);
  78059. },
  78060. // Expressions either represent mathematical operations,
  78061. // or white-space delimited Entities. @var * 2
  78062. expression: function () {
  78063. var e, entities = [];
  78064. while (e = _match(this.addition) || _match(this.entity)) {
  78065. entities.push(e);
  78066. }
  78067. if (entities.length > 0) {
  78068. return new CartoCSS.Tree.Expression(entities);
  78069. }
  78070. },
  78071. property: function () {
  78072. var name = _match(/^(([a-z][-a-z_0-9]*\/)?\*?-?[-a-z_0-9]+)\s*:/);
  78073. if (name) {return name[1];}
  78074. }
  78075. }
  78076. };
  78077. return parser;
  78078. }
  78079. /**
  78080. * @function CartoCSS.prototype.parse
  78081. * @description 利用CartoCSS解析器里面的parse方法,将CartoCSS样式表字符串转化为CartoCSS规则集。
  78082. * @returns {Object} CartoCSS规则集。
  78083. */
  78084. parse(str) {
  78085. var parser = this.parser;
  78086. var ruleSet = this.ruleSet = parser.parse(str);
  78087. return ruleSet;
  78088. }
  78089. /**
  78090. * @function CartoCSS.prototype.toShaders
  78091. * @description 将CartoCSS规则集转化为着色器。
  78092. * @returns {Array} CartoCSS着色器集。
  78093. */
  78094. toShaders() {
  78095. if (this.ruleSet) {
  78096. var ruleset = this.ruleSet;
  78097. if (ruleset) {
  78098. var defs = ruleset.toList(this.env);
  78099. defs.reverse();
  78100. var shaders = {};
  78101. var keys = [];
  78102. this._toShaders(shaders,keys,defs);
  78103. var ordered_shaders = [];
  78104. var done = {};
  78105. for (var i = 0, len0 = defs.length; i < len0; ++i) {
  78106. var def = defs[i];
  78107. var k = def.attachment;
  78108. var shader = shaders[keys[i]];
  78109. var shaderArray = [];
  78110. if (!done[k]) {
  78111. var j = 0;
  78112. for (var prop in shader) {
  78113. if (prop !== 'zoom' && prop !== 'frames' && prop !== "attachment" && prop != "elements") {
  78114. //对layer-index作特殊处理以实现图层的控制
  78115. if (prop === "layer-index") {
  78116. /*var getLayerIndex = Function("attributes", "zoom", "var _value = null;" + shader[prop].join('\n') + "; return _value; ");*/
  78117. var getLayerIndex = function (attributes, zoom) {//NOSONAR
  78118. var _value = null;
  78119. shader[prop].join('\n');
  78120. return _value;
  78121. };
  78122. var layerIndex = getLayerIndex();
  78123. Object.defineProperty(shaderArray, "layerIndex", {
  78124. configurable: true,
  78125. enumerable: false,
  78126. value: layerIndex
  78127. });
  78128. } else {
  78129. shaderArray[j++] = function (ops, shaderArray) {//NOSONAR
  78130. if (!Array.isArray(ops)) {
  78131. return ops;
  78132. }
  78133. var body = ops.join('\n');
  78134. var myKeyword = 'attributes["FEATUREID"]&&attributes["FEATUREID"]';
  78135. var index = body.indexOf(myKeyword);
  78136. if (index >= 0) {
  78137. //对featureID作一些特殊处理,以将featureID提取出来
  78138. if (!shaderArray.featureFilter) {
  78139. var featureFilterStart = index + myKeyword.length;
  78140. var featureFilterEnd = body.indexOf(")", featureFilterStart + 1);
  78141. var featureFilterStr = "featureId&&(featureId" + body.substring(featureFilterStart, featureFilterEnd) + ")";
  78142. /*var featureFilter = Function("featureId", "if(" + featureFilterStr + "){return true;}return false;");*/
  78143. var featureFilter = function (featureId) {
  78144. if (featureFilterStr) {
  78145. return true;
  78146. }
  78147. return false;
  78148. }
  78149. Object.defineProperty(shaderArray, "featureFilter", {
  78150. configurable: true,
  78151. enumerable: false,
  78152. value: featureFilter
  78153. });
  78154. }
  78155. return {
  78156. "property": prop,
  78157. "getValue": Function("attributes", "zoom", "seftFilter", "var _value = null; var isExcute=typeof seftFilter=='function'?sefgFilter():seftFilter;if(isExcute){" + body + ";} return _value; ")//NOSONAR
  78158. };
  78159. } else {
  78160. return {
  78161. "property": prop,
  78162. "getValue": Function("attributes", "zoom", "var _value = null;" + body + "; return _value; ")//NOSONAR
  78163. };
  78164. }
  78165. }(shader[prop], shaderArray);
  78166. }
  78167. }
  78168. }
  78169. Object.defineProperty(shaderArray, "attachment", {
  78170. configurable: true,
  78171. enumerable: false,
  78172. value: k
  78173. });
  78174. Object.defineProperty(shaderArray, "elements", {
  78175. configurable: true,
  78176. enumerable: false,
  78177. value: def.elements
  78178. });
  78179. ordered_shaders.push(shaderArray);
  78180. done[keys[i]] = true;
  78181. }
  78182. Object.defineProperty(shaderArray, "zoom", {
  78183. configurable: true,
  78184. enumerable: false,
  78185. value: def.zoom
  78186. });
  78187. //shader.frames.push(def.frame_offset);
  78188. }
  78189. return ordered_shaders;
  78190. }
  78191. }
  78192. return null;
  78193. }
  78194. _toShaders(shaders, keys,defs) {
  78195. for (let i = 0, len0 = defs.length; i < len0; ++i) {
  78196. let def = defs[i];
  78197. let element_str = [];
  78198. for (let j = 0, len1 = def.elements.length; j < len1; j++) {
  78199. element_str.push(def.elements[j]);
  78200. }
  78201. let filters = def.filters.filters;
  78202. let filterStr = [];
  78203. for (let attr in filters) {
  78204. filterStr.push(filters[attr].id);
  78205. }
  78206. let key = element_str.join("/") + "::" + def.attachment + "_" + filterStr.join("_");
  78207. keys.push(key);
  78208. let shader = shaders[key] = (shaders[key] || {});
  78209. //shader.frames = [];
  78210. shader.zoom = CartoCSS.Tree.Zoom.all;
  78211. let props = def.toJS(this.env);
  78212. for (let v in props) {
  78213. (shader[v] = (shader[v] || [])).push(props[v].join('\n'))
  78214. }
  78215. }
  78216. }
  78217. /**
  78218. * @function CartoCSS.prototype.getShaders
  78219. * @description 获取CartoCSS着色器。
  78220. * @returns {Array} 着色器集。
  78221. * @example
  78222. * //shaders的结构大概如下:
  78223. * var shaders=[
  78224. * {
  78225. * attachment:"one",
  78226. * elements:[],
  78227. * zoom:23,
  78228. * length:2,
  78229. * 0:{property:"line-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
  78230. * 1:{preoperty:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
  78231. * },
  78232. * {
  78233. * attachment:"two",
  78234. * elements:[],
  78235. * zoom:23,
  78236. * length:2,
  78237. * 0:{property:"polygon-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
  78238. * 1:{property:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
  78239. * }
  78240. * ];
  78241. */
  78242. getShaders() {
  78243. return this.shaders;
  78244. }
  78245. /**
  78246. * @function CartoCSS.prototype.destroy
  78247. * @description CartoCSS解析对象的析构函数,用于销毁CartoCSS解析对象。
  78248. */
  78249. destroy() {
  78250. this.cartoStr = null;
  78251. this.env = null;
  78252. this.ruleSet = null;
  78253. this.parser = null;
  78254. this.shaders = null;
  78255. }
  78256. }
  78257. var _mapnik_reference_latest = {
  78258. "version": "2.1.1",
  78259. "style": {
  78260. "filter-mode": {
  78261. "type": [
  78262. "all",
  78263. "first"
  78264. ],
  78265. "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)",
  78266. "default-value": "all",
  78267. "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."
  78268. },
  78269. "image-filters": {
  78270. "css": "image-filters",
  78271. "default-value": "none",
  78272. "default-meaning": "no filters",
  78273. "type": "functions",
  78274. "functions": [
  78275. ["agg-stack-blur", 2],
  78276. ["emboss", 0],
  78277. ["blur", 0],
  78278. ["gray", 0],
  78279. ["sobel", 0],
  78280. ["edge-detect", 0],
  78281. ["x-gradient", 0],
  78282. ["y-gradient", 0],
  78283. ["invert", 0],
  78284. ["sharpen", 0]
  78285. ],
  78286. "doc": "A list of image filters."
  78287. },
  78288. "comp-op": {
  78289. "css": "comp-op",
  78290. "default-value": "src-over",
  78291. "default-meaning": "add the current layer on top of other layers",
  78292. "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
  78293. "type": ["clear",
  78294. "src",
  78295. "dst",
  78296. "src-over",
  78297. "dst-over",
  78298. "src-in",
  78299. "dst-in",
  78300. "src-out",
  78301. "dst-out",
  78302. "src-atop",
  78303. "dst-atop",
  78304. "xor",
  78305. "plus",
  78306. "minus",
  78307. "multiply",
  78308. "screen",
  78309. "overlay",
  78310. "darken",
  78311. "lighten",
  78312. "color-dodge",
  78313. "color-burn",
  78314. "hard-light",
  78315. "soft-light",
  78316. "difference",
  78317. "exclusion",
  78318. "contrast",
  78319. "invert",
  78320. "invert-rgb",
  78321. "grain-merge",
  78322. "grain-extract",
  78323. "hue",
  78324. "saturation",
  78325. "color",
  78326. "value"
  78327. ]
  78328. },
  78329. "opacity": {
  78330. "css": "opacity",
  78331. "type": "float",
  78332. "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)",
  78333. "default-value": 1,
  78334. "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
  78335. }
  78336. },
  78337. "layer": {
  78338. "name": {
  78339. "default-value": "",
  78340. "type": "string",
  78341. "required": true,
  78342. "default-meaning": "No layer name has been provided",
  78343. "doc": "The name of a layer. Can be anything you wish and is not strictly validated, but ideally unique in the map"
  78344. },
  78345. "srs": {
  78346. "default-value": "",
  78347. "type": "string",
  78348. "default-meaning": "No srs value is provided and the value will be inherited from the Map's srs",
  78349. "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'"
  78350. },
  78351. "status": {
  78352. "default-value": true,
  78353. "type": "boolean",
  78354. "default-meaning": "This layer will be marked as active and available for processing",
  78355. "doc": "A property that can be set to false to disable this layer from being processed"
  78356. },
  78357. "minzoom": {
  78358. "default-value": "0",
  78359. "type": "float",
  78360. "default-meaning": "The layer will be visible at the minimum possible scale",
  78361. "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"
  78362. },
  78363. "maxzoom": {
  78364. "default-value": "1.79769e+308",
  78365. "type": "float",
  78366. "default-meaning": "The layer will be visible at the maximum possible scale",
  78367. "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"
  78368. },
  78369. "queryable": {
  78370. "default-value": false,
  78371. "type": "boolean",
  78372. "default-meaning": "The layer will not be available for the direct querying of data values",
  78373. "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"
  78374. },
  78375. "clear-label-cache": {
  78376. "default-value": false,
  78377. "type": "boolean",
  78378. "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",
  78379. "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"
  78380. },
  78381. "group-by": {
  78382. "default-value": "",
  78383. "type": "string",
  78384. "default-meaning": "No special layer grouping will be used during rendering",
  78385. "doc": "https://github.com/mapnik/mapnik/wiki/Grouped-rendering"
  78386. },
  78387. "buffer-size": {
  78388. "default-value": "0",
  78389. "type": "float",
  78390. "default-meaning": "No buffer will be used",
  78391. "doc": "Extra tolerance around the Layer extent (in pixels) used to when querying and (potentially) clipping the layer data during rendering"
  78392. },
  78393. "maximum-extent": {
  78394. "default-value": "none",
  78395. "type": "bbox",
  78396. "default-meaning": "No clipping extent will be used",
  78397. "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."
  78398. }
  78399. },
  78400. "symbolizers": {
  78401. "*": {
  78402. "image-filters": {
  78403. "css": "image-filters",
  78404. "default-value": "none",
  78405. "default-meaning": "no filters",
  78406. "type": "functions",
  78407. "functions": [
  78408. ["agg-stack-blur", 2],
  78409. ["emboss", 0],
  78410. ["blur", 0],
  78411. ["gray", 0],
  78412. ["sobel", 0],
  78413. ["edge-detect", 0],
  78414. ["x-gradient", 0],
  78415. ["y-gradient", 0],
  78416. ["invert", 0],
  78417. ["sharpen", 0]
  78418. ],
  78419. "doc": "A list of image filters."
  78420. },
  78421. "comp-op": {
  78422. "css": "comp-op",
  78423. "default-value": "src-over",
  78424. "default-meaning": "add the current layer on top of other layers",
  78425. "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
  78426. "type": ["clear",
  78427. "src",
  78428. "dst",
  78429. "src-over",
  78430. "dst-over",
  78431. "src-in",
  78432. "dst-in",
  78433. "src-out",
  78434. "dst-out",
  78435. "src-atop",
  78436. "dst-atop",
  78437. "xor",
  78438. "plus",
  78439. "minus",
  78440. "multiply",
  78441. "screen",
  78442. "overlay",
  78443. "darken",
  78444. "lighten",
  78445. "color-dodge",
  78446. "color-burn",
  78447. "hard-light",
  78448. "soft-light",
  78449. "difference",
  78450. "exclusion",
  78451. "contrast",
  78452. "invert",
  78453. "invert-rgb",
  78454. "grain-merge",
  78455. "grain-extract",
  78456. "hue",
  78457. "saturation",
  78458. "color",
  78459. "value"
  78460. ]
  78461. },
  78462. "opacity": {
  78463. "css": "opacity",
  78464. "type": "float",
  78465. "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)",
  78466. "default-value": 1,
  78467. "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
  78468. }
  78469. },
  78470. "map": {
  78471. "background-color": {
  78472. "css": "background-color",
  78473. "default-value": "none",
  78474. "default-meaning": "transparent",
  78475. "type": "color",
  78476. "doc": "Map Background color"
  78477. },
  78478. "background-image": {
  78479. "css": "background-image",
  78480. "type": "uri",
  78481. "default-value": "",
  78482. "default-meaning": "transparent",
  78483. "doc": "An image that is repeated below all features on a map as a background.",
  78484. "description": "Map Background image"
  78485. },
  78486. "srs": {
  78487. "css": "srs",
  78488. "type": "string",
  78489. "default-value": "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",
  78490. "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",
  78491. "doc": "Map spatial reference (proj4 string)"
  78492. },
  78493. "buffer-size": {
  78494. "css": "buffer-size",
  78495. "default-value": "0",
  78496. "type": "float",
  78497. "default-meaning": "No buffer will be used",
  78498. "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\"."
  78499. },
  78500. "maximum-extent": {
  78501. "css": "",
  78502. "default-value": "none",
  78503. "type": "bbox",
  78504. "default-meaning": "No clipping extent will be used",
  78505. "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."
  78506. },
  78507. "base": {
  78508. "css": "base",
  78509. "default-value": "",
  78510. "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.",
  78511. "type": "string",
  78512. "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."
  78513. },
  78514. "paths-from-xml": {
  78515. "css": "",
  78516. "default-value": true,
  78517. "default-meaning": "Paths read from XML will be interpreted from the location of the XML",
  78518. "type": "boolean",
  78519. "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()"
  78520. },
  78521. "minimum-version": {
  78522. "css": "",
  78523. "default-value": "none",
  78524. "default-meaning": "Mapnik version will not be detected and no error will be thrown about compatibility",
  78525. "type": "string",
  78526. "doc": "The minumum Mapnik version (e.g. 0.7.2) needed to use certain functionality in the stylesheet"
  78527. },
  78528. "font-directory": {
  78529. "css": "font-directory",
  78530. "type": "uri",
  78531. "default-value": "none",
  78532. "default-meaning": "No map-specific fonts will be registered",
  78533. "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)."
  78534. }
  78535. },
  78536. "polygon": {
  78537. "fill": {
  78538. "css": "polygon-fill",
  78539. "type": "color",
  78540. "default-value": "rgba(128,128,128,1)",
  78541. "default-meaning": "gray and fully opaque (alpha = 1), same as rgb(128,128,128)",
  78542. "doc": "Fill color to assign to a polygon"
  78543. },
  78544. "fill-opacity": {
  78545. "css": "polygon-opacity",
  78546. "type": "float",
  78547. "doc": "The opacity of the polygon",
  78548. "default-value": 1,
  78549. "default-meaning": "opaque"
  78550. },
  78551. "gamma": {
  78552. "css": "polygon-gamma",
  78553. "type": "float",
  78554. "default-value": 1,
  78555. "default-meaning": "fully antialiased",
  78556. "range": "0-1",
  78557. "doc": "Level of antialiasing of polygon edges"
  78558. },
  78559. "gamma-method": {
  78560. "css": "polygon-gamma-method",
  78561. "type": [
  78562. "power",
  78563. "linear",
  78564. "none",
  78565. "threshold",
  78566. "multiply"
  78567. ],
  78568. "default-value": "power",
  78569. "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",
  78570. "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"
  78571. },
  78572. "clip": {
  78573. "css": "polygon-clip",
  78574. "type": "boolean",
  78575. "default-value": true,
  78576. "default-meaning": "geometry will be clipped to map bounds before rendering",
  78577. "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."
  78578. },
  78579. "smooth": {
  78580. "css": "polygon-smooth",
  78581. "type": "float",
  78582. "default-value": 0,
  78583. "default-meaning": "no smoothing",
  78584. "range": "0-1",
  78585. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  78586. },
  78587. "geometry-transform": {
  78588. "css": "polygon-geometry-transform",
  78589. "type": "functions",
  78590. "default-value": "none",
  78591. "default-meaning": "geometry will not be transformed",
  78592. "doc": "Allows transformation functions to be applied to the geometry.",
  78593. "functions": [
  78594. ["matrix", 6],
  78595. ["translate", 2],
  78596. ["scale", 2],
  78597. ["rotate", 3],
  78598. ["skewX", 1],
  78599. ["skewY", 1]
  78600. ]
  78601. },
  78602. "comp-op": {
  78603. "css": "polygon-comp-op",
  78604. "default-value": "src-over",
  78605. "default-meaning": "add the current symbolizer on top of other symbolizer",
  78606. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  78607. "type": ["clear",
  78608. "src",
  78609. "dst",
  78610. "src-over",
  78611. "dst-over",
  78612. "src-in",
  78613. "dst-in",
  78614. "src-out",
  78615. "dst-out",
  78616. "src-atop",
  78617. "dst-atop",
  78618. "xor",
  78619. "plus",
  78620. "minus",
  78621. "multiply",
  78622. "screen",
  78623. "overlay",
  78624. "darken",
  78625. "lighten",
  78626. "color-dodge",
  78627. "color-burn",
  78628. "hard-light",
  78629. "soft-light",
  78630. "difference",
  78631. "exclusion",
  78632. "contrast",
  78633. "invert",
  78634. "invert-rgb",
  78635. "grain-merge",
  78636. "grain-extract",
  78637. "hue",
  78638. "saturation",
  78639. "color",
  78640. "value"
  78641. ]
  78642. }
  78643. },
  78644. "line": {
  78645. "stroke": {
  78646. "css": "line-color",
  78647. "default-value": "rgba(0,0,0,1)",
  78648. "type": "color",
  78649. "default-meaning": "black and fully opaque (alpha = 1), same as rgb(0,0,0)",
  78650. "doc": "The color of a drawn line"
  78651. },
  78652. "stroke-width": {
  78653. "css": "line-width",
  78654. "default-value": 1,
  78655. "type": "float",
  78656. "doc": "The width of a line in pixels"
  78657. },
  78658. "stroke-opacity": {
  78659. "css": "line-opacity",
  78660. "default-value": 1,
  78661. "type": "float",
  78662. "default-meaning": "opaque",
  78663. "doc": "The opacity of a line"
  78664. },
  78665. "stroke-linejoin": {
  78666. "css": "line-join",
  78667. "default-value": "miter",
  78668. "type": [
  78669. "miter",
  78670. "round",
  78671. "bevel"
  78672. ],
  78673. "doc": "The behavior of lines when joining"
  78674. },
  78675. "stroke-linecap": {
  78676. "css": "line-cap",
  78677. "default-value": "butt",
  78678. "type": [
  78679. "butt",
  78680. "round",
  78681. "square"
  78682. ],
  78683. "doc": "The display of line endings"
  78684. },
  78685. "stroke-gamma": {
  78686. "css": "line-gamma",
  78687. "type": "float",
  78688. "default-value": 1,
  78689. "default-meaning": "fully antialiased",
  78690. "range": "0-1",
  78691. "doc": "Level of antialiasing of stroke line"
  78692. },
  78693. "stroke-gamma-method": {
  78694. "css": "line-gamma-method",
  78695. "type": [
  78696. "power",
  78697. "linear",
  78698. "none",
  78699. "threshold",
  78700. "multiply"
  78701. ],
  78702. "default-value": "power",
  78703. "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",
  78704. "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"
  78705. },
  78706. "stroke-dasharray": {
  78707. "css": "line-dasharray",
  78708. "type": "numbers",
  78709. "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.",
  78710. "default-value": "none",
  78711. "default-meaning": "solid line"
  78712. },
  78713. "stroke-dashoffset": {
  78714. "css": "line-dash-offset",
  78715. "type": "numbers",
  78716. "doc": "valid parameter but not currently used in renderers (only exists for experimental svg support in Mapnik which is not yet enabled)",
  78717. "default-value": "none",
  78718. "default-meaning": "solid line"
  78719. },
  78720. "stroke-miterlimit": {
  78721. "css": "line-miterlimit",
  78722. "type": "float",
  78723. "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.",
  78724. "default-value": 4.0,
  78725. "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 )'"
  78726. },
  78727. "clip": {
  78728. "css": "line-clip",
  78729. "type": "boolean",
  78730. "default-value": true,
  78731. "default-meaning": "geometry will be clipped to map bounds before rendering",
  78732. "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."
  78733. },
  78734. "smooth": {
  78735. "css": "line-smooth",
  78736. "type": "float",
  78737. "default-value": 0,
  78738. "default-meaning": "no smoothing",
  78739. "range": "0-1",
  78740. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  78741. },
  78742. "offset": {
  78743. "css": "line-offset",
  78744. "type": "float",
  78745. "default-value": 0,
  78746. "default-meaning": "no offset",
  78747. "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)."
  78748. },
  78749. "rasterizer": {
  78750. "css": "line-rasterizer",
  78751. "type": [
  78752. "full",
  78753. "fast"
  78754. ],
  78755. "default-value": "full",
  78756. "doc": "Exposes an alternate AGG rendering method that sacrifices some accuracy for speed."
  78757. },
  78758. "geometry-transform": {
  78759. "css": "line-geometry-transform",
  78760. "type": "functions",
  78761. "default-value": "none",
  78762. "default-meaning": "geometry will not be transformed",
  78763. "doc": "Allows transformation functions to be applied to the geometry.",
  78764. "functions": [
  78765. ["matrix", 6],
  78766. ["translate", 2],
  78767. ["scale", 2],
  78768. ["rotate", 3],
  78769. ["skewX", 1],
  78770. ["skewY", 1]
  78771. ]
  78772. },
  78773. "comp-op": {
  78774. "css": "line-comp-op",
  78775. "default-value": "src-over",
  78776. "default-meaning": "add the current symbolizer on top of other symbolizer",
  78777. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  78778. "type": ["clear",
  78779. "src",
  78780. "dst",
  78781. "src-over",
  78782. "dst-over",
  78783. "src-in",
  78784. "dst-in",
  78785. "src-out",
  78786. "dst-out",
  78787. "src-atop",
  78788. "dst-atop",
  78789. "xor",
  78790. "plus",
  78791. "minus",
  78792. "multiply",
  78793. "screen",
  78794. "overlay",
  78795. "darken",
  78796. "lighten",
  78797. "color-dodge",
  78798. "color-burn",
  78799. "hard-light",
  78800. "soft-light",
  78801. "difference",
  78802. "exclusion",
  78803. "contrast",
  78804. "invert",
  78805. "invert-rgb",
  78806. "grain-merge",
  78807. "grain-extract",
  78808. "hue",
  78809. "saturation",
  78810. "color",
  78811. "value"
  78812. ]
  78813. }
  78814. },
  78815. "markers": {
  78816. "file": {
  78817. "css": "marker-file",
  78818. "doc": "An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.",
  78819. "default-value": "",
  78820. "default-meaning": "An ellipse or circle, if width equals height",
  78821. "type": "uri"
  78822. },
  78823. "opacity": {
  78824. "css": "marker-opacity",
  78825. "doc": "The overall opacity of the marker, if set, overrides both the opacity of both the fill and stroke",
  78826. "default-value": 1,
  78827. "default-meaning": "The stroke-opacity and fill-opacity will be used",
  78828. "type": "float"
  78829. },
  78830. "fill-opacity": {
  78831. "css": "marker-fill-opacity",
  78832. "doc": "The fill opacity of the marker",
  78833. "default-value": 1,
  78834. "default-meaning": "opaque",
  78835. "type": "float"
  78836. },
  78837. "stroke": {
  78838. "css": "marker-line-color",
  78839. "doc": "The color of the stroke around a marker shape.",
  78840. "default-value": "black",
  78841. "type": "color"
  78842. },
  78843. "stroke-width": {
  78844. "css": "marker-line-width",
  78845. "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.",
  78846. "type": "float"
  78847. },
  78848. "stroke-opacity": {
  78849. "css": "marker-line-opacity",
  78850. "default-value": 1,
  78851. "default-meaning": "opaque",
  78852. "doc": "The opacity of a line",
  78853. "type": "float"
  78854. },
  78855. "placement": {
  78856. "css": "marker-placement",
  78857. "type": [
  78858. "point",
  78859. "line",
  78860. "interior"
  78861. ],
  78862. "default-value": "point",
  78863. "default-meaning": "Place markers at the center point (centroid) of the geometry",
  78864. "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"
  78865. },
  78866. "multi-policy": {
  78867. "css": "marker-multi-policy",
  78868. "type": [
  78869. "each",
  78870. "whole",
  78871. "largest"
  78872. ],
  78873. "default-value": "each",
  78874. "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",
  78875. "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)."
  78876. },
  78877. "marker-type": {
  78878. "css": "marker-type",
  78879. "type": [
  78880. "arrow",
  78881. "ellipse"
  78882. ],
  78883. "default-value": "ellipse",
  78884. "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)"
  78885. },
  78886. "width": {
  78887. "css": "marker-width",
  78888. "default-value": 10,
  78889. "doc": "The width of the marker, if using one of the default types.",
  78890. "type": "expression"
  78891. },
  78892. "height": {
  78893. "css": "marker-height",
  78894. "default-value": 10,
  78895. "doc": "The height of the marker, if using one of the default types.",
  78896. "type": "expression"
  78897. },
  78898. "fill": {
  78899. "css": "marker-fill",
  78900. "default-value": "blue",
  78901. "doc": "The color of the area of the marker.",
  78902. "type": "color"
  78903. },
  78904. "allow-overlap": {
  78905. "css": "marker-allow-overlap",
  78906. "type": "boolean",
  78907. "default-value": false,
  78908. "doc": "Control whether overlapping markers are shown or hidden.",
  78909. "default-meaning": "Do not allow makers to overlap with each other - overlapping markers will not be shown."
  78910. },
  78911. "ignore-placement": {
  78912. "css": "marker-ignore-placement",
  78913. "type": "boolean",
  78914. "default-value": false,
  78915. "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
  78916. "doc": "value to control whether the placement of the feature will prevent the placement of other features"
  78917. },
  78918. "spacing": {
  78919. "css": "marker-spacing",
  78920. "doc": "Space between repeated labels",
  78921. "default-value": 100,
  78922. "type": "float"
  78923. },
  78924. "max-error": {
  78925. "css": "marker-max-error",
  78926. "type": "float",
  78927. "default-value": 0.2,
  78928. "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."
  78929. },
  78930. "transform": {
  78931. "css": "marker-transform",
  78932. "type": "functions",
  78933. "functions": [
  78934. ["matrix", 6],
  78935. ["translate", 2],
  78936. ["scale", 2],
  78937. ["rotate", 3],
  78938. ["skewX", 1],
  78939. ["skewY", 1]
  78940. ],
  78941. "default-value": "",
  78942. "default-meaning": "No transformation",
  78943. "doc": "SVG transformation definition"
  78944. },
  78945. "clip": {
  78946. "css": "marker-clip",
  78947. "type": "boolean",
  78948. "default-value": true,
  78949. "default-meaning": "geometry will be clipped to map bounds before rendering",
  78950. "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."
  78951. },
  78952. "smooth": {
  78953. "css": "marker-smooth",
  78954. "type": "float",
  78955. "default-value": 0,
  78956. "default-meaning": "no smoothing",
  78957. "range": "0-1",
  78958. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  78959. },
  78960. "geometry-transform": {
  78961. "css": "marker-geometry-transform",
  78962. "type": "functions",
  78963. "default-value": "none",
  78964. "default-meaning": "geometry will not be transformed",
  78965. "doc": "Allows transformation functions to be applied to the geometry.",
  78966. "functions": [
  78967. ["matrix", 6],
  78968. ["translate", 2],
  78969. ["scale", 2],
  78970. ["rotate", 3],
  78971. ["skewX", 1],
  78972. ["skewY", 1]
  78973. ]
  78974. },
  78975. "comp-op": {
  78976. "css": "marker-comp-op",
  78977. "default-value": "src-over",
  78978. "default-meaning": "add the current symbolizer on top of other symbolizer",
  78979. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  78980. "type": ["clear",
  78981. "src",
  78982. "dst",
  78983. "src-over",
  78984. "dst-over",
  78985. "src-in",
  78986. "dst-in",
  78987. "src-out",
  78988. "dst-out",
  78989. "src-atop",
  78990. "dst-atop",
  78991. "xor",
  78992. "plus",
  78993. "minus",
  78994. "multiply",
  78995. "screen",
  78996. "overlay",
  78997. "darken",
  78998. "lighten",
  78999. "color-dodge",
  79000. "color-burn",
  79001. "hard-light",
  79002. "soft-light",
  79003. "difference",
  79004. "exclusion",
  79005. "contrast",
  79006. "invert",
  79007. "invert-rgb",
  79008. "grain-merge",
  79009. "grain-extract",
  79010. "hue",
  79011. "saturation",
  79012. "color",
  79013. "value"
  79014. ]
  79015. }
  79016. },
  79017. "shield": {
  79018. "name": {
  79019. "css": "shield-name",
  79020. "type": "expression",
  79021. "serialization": "content",
  79022. "doc": "Value to use for a shield\"s text label. Data columns are specified using brackets like [column_name]"
  79023. },
  79024. "file": {
  79025. "css": "shield-file",
  79026. "required": true,
  79027. "type": "uri",
  79028. "default-value": "none",
  79029. "doc": "Image file to render behind the shield text"
  79030. },
  79031. "face-name": {
  79032. "css": "shield-face-name",
  79033. "type": "string",
  79034. "validate": "font",
  79035. "doc": "Font name and style to use for the shield text",
  79036. "default-value": "",
  79037. "required": true
  79038. },
  79039. "unlock-image": {
  79040. "css": "shield-unlock-image",
  79041. "type": "boolean",
  79042. "doc": "This parameter should be set to true if you are trying to position text beside rather than on top of the shield image",
  79043. "default-value": false,
  79044. "default-meaning": "text alignment relative to the shield image uses the center of the image as the anchor for text positioning."
  79045. },
  79046. "size": {
  79047. "css": "shield-size",
  79048. "type": "float",
  79049. "doc": "The size of the shield text in pixels"
  79050. },
  79051. "fill": {
  79052. "css": "shield-fill",
  79053. "type": "color",
  79054. "doc": "The color of the shield text"
  79055. },
  79056. "placement": {
  79057. "css": "shield-placement",
  79058. "type": [
  79059. "point",
  79060. "line",
  79061. "vertex",
  79062. "interior"
  79063. ],
  79064. "default-value": "point",
  79065. "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."
  79066. },
  79067. "avoid-edges": {
  79068. "css": "shield-avoid-edges",
  79069. "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
  79070. "type": "boolean",
  79071. "default-value": false
  79072. },
  79073. "allow-overlap": {
  79074. "css": "shield-allow-overlap",
  79075. "type": "boolean",
  79076. "default-value": false,
  79077. "doc": "Control whether overlapping shields are shown or hidden.",
  79078. "default-meaning": "Do not allow shields to overlap with other map elements already placed."
  79079. },
  79080. "minimum-distance": {
  79081. "css": "shield-min-distance",
  79082. "type": "float",
  79083. "default-value": 0,
  79084. "doc": "Minimum distance to the next shield symbol, not necessarily the same shield."
  79085. },
  79086. "spacing": {
  79087. "css": "shield-spacing",
  79088. "type": "float",
  79089. "default-value": 0,
  79090. "doc": "The spacing between repeated occurrences of the same shield on a line"
  79091. },
  79092. "minimum-padding": {
  79093. "css": "shield-min-padding",
  79094. "default-value": 0,
  79095. "doc": "Determines the minimum amount of padding that a shield gets relative to other shields",
  79096. "type": "float"
  79097. },
  79098. "wrap-width": {
  79099. "css": "shield-wrap-width",
  79100. "type": "unsigned",
  79101. "default-value": 0,
  79102. "doc": "Length of a chunk of text in characters before wrapping text"
  79103. },
  79104. "wrap-before": {
  79105. "css": "shield-wrap-before",
  79106. "type": "boolean",
  79107. "default-value": false,
  79108. "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
  79109. },
  79110. "wrap-character": {
  79111. "css": "shield-wrap-character",
  79112. "type": "string",
  79113. "default-value": " ",
  79114. "doc": "Use this character instead of a space to wrap long names."
  79115. },
  79116. "halo-fill": {
  79117. "css": "shield-halo-fill",
  79118. "type": "color",
  79119. "default-value": "#FFFFFF",
  79120. "default-meaning": "white",
  79121. "doc": "Specifies the color of the halo around the text."
  79122. },
  79123. "halo-radius": {
  79124. "css": "shield-halo-radius",
  79125. "doc": "Specify the radius of the halo in pixels",
  79126. "default-value": 0,
  79127. "default-meaning": "no halo",
  79128. "type": "float"
  79129. },
  79130. "character-spacing": {
  79131. "css": "shield-character-spacing",
  79132. "type": "unsigned",
  79133. "default-value": 0,
  79134. "doc": "Horizontal spacing between characters (in pixels). Currently works for point placement only, not line placement."
  79135. },
  79136. "line-spacing": {
  79137. "css": "shield-line-spacing",
  79138. "doc": "Vertical spacing between lines of multiline labels (in pixels)",
  79139. "type": "unsigned"
  79140. },
  79141. "dx": {
  79142. "css": "shield-text-dx",
  79143. "type": "float",
  79144. "doc": "Displace text within shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  79145. "default-value": 0
  79146. },
  79147. "dy": {
  79148. "css": "shield-text-dy",
  79149. "type": "float",
  79150. "doc": "Displace text within shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  79151. "default-value": 0
  79152. },
  79153. "shield-dx": {
  79154. "css": "shield-dx",
  79155. "type": "float",
  79156. "doc": "Displace shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  79157. "default-value": 0
  79158. },
  79159. "shield-dy": {
  79160. "css": "shield-dy",
  79161. "type": "float",
  79162. "doc": "Displace shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  79163. "default-value": 0
  79164. },
  79165. "opacity": {
  79166. "css": "shield-opacity",
  79167. "type": "float",
  79168. "doc": "(Default 1.0) - opacity of the image used for the shield",
  79169. "default-value": 1
  79170. },
  79171. "text-opacity": {
  79172. "css": "shield-text-opacity",
  79173. "type": "float",
  79174. "doc": "(Default 1.0) - opacity of the text placed on top of the shield",
  79175. "default-value": 1
  79176. },
  79177. "horizontal-alignment": {
  79178. "css": "shield-horizontal-alignment",
  79179. "type": [
  79180. "left",
  79181. "middle",
  79182. "right",
  79183. "auto"
  79184. ],
  79185. "doc": "The shield's horizontal alignment from its centerpoint",
  79186. "default-value": "auto"
  79187. },
  79188. "vertical-alignment": {
  79189. "css": "shield-vertical-alignment",
  79190. "type": [
  79191. "top",
  79192. "middle",
  79193. "bottom",
  79194. "auto"
  79195. ],
  79196. "doc": "The shield's vertical alignment from its centerpoint",
  79197. "default-value": "middle"
  79198. },
  79199. "text-transform": {
  79200. "css": "shield-text-transform",
  79201. "type": [
  79202. "none",
  79203. "uppercase",
  79204. "lowercase",
  79205. "capitalize"
  79206. ],
  79207. "doc": "Transform the case of the characters",
  79208. "default-value": "none"
  79209. },
  79210. "justify-alignment": {
  79211. "css": "shield-justify-alignment",
  79212. "type": [
  79213. "left",
  79214. "center",
  79215. "right",
  79216. "auto"
  79217. ],
  79218. "doc": "Define how text in a shield's label is justified",
  79219. "default-value": "auto"
  79220. },
  79221. "clip": {
  79222. "css": "shield-clip",
  79223. "type": "boolean",
  79224. "default-value": true,
  79225. "default-meaning": "geometry will be clipped to map bounds before rendering",
  79226. "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."
  79227. },
  79228. "comp-op": {
  79229. "css": "shield-comp-op",
  79230. "default-value": "src-over",
  79231. "default-meaning": "add the current symbolizer on top of other symbolizer",
  79232. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  79233. "type": ["clear",
  79234. "src",
  79235. "dst",
  79236. "src-over",
  79237. "dst-over",
  79238. "src-in",
  79239. "dst-in",
  79240. "src-out",
  79241. "dst-out",
  79242. "src-atop",
  79243. "dst-atop",
  79244. "xor",
  79245. "plus",
  79246. "minus",
  79247. "multiply",
  79248. "screen",
  79249. "overlay",
  79250. "darken",
  79251. "lighten",
  79252. "color-dodge",
  79253. "color-burn",
  79254. "hard-light",
  79255. "soft-light",
  79256. "difference",
  79257. "exclusion",
  79258. "contrast",
  79259. "invert",
  79260. "invert-rgb",
  79261. "grain-merge",
  79262. "grain-extract",
  79263. "hue",
  79264. "saturation",
  79265. "color",
  79266. "value"
  79267. ]
  79268. }
  79269. },
  79270. "line-pattern": {
  79271. "file": {
  79272. "css": "line-pattern-file",
  79273. "type": "uri",
  79274. "default-value": "none",
  79275. "required": true,
  79276. "doc": "An image file to be repeated and warped along a line"
  79277. },
  79278. "clip": {
  79279. "css": "line-pattern-clip",
  79280. "type": "boolean",
  79281. "default-value": true,
  79282. "default-meaning": "geometry will be clipped to map bounds before rendering",
  79283. "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."
  79284. },
  79285. "smooth": {
  79286. "css": "line-pattern-smooth",
  79287. "type": "float",
  79288. "default-value": 0,
  79289. "default-meaning": "no smoothing",
  79290. "range": "0-1",
  79291. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  79292. },
  79293. "geometry-transform": {
  79294. "css": "line-pattern-geometry-transform",
  79295. "type": "functions",
  79296. "default-value": "none",
  79297. "default-meaning": "geometry will not be transformed",
  79298. "doc": "Allows transformation functions to be applied to the geometry.",
  79299. "functions": [
  79300. ["matrix", 6],
  79301. ["translate", 2],
  79302. ["scale", 2],
  79303. ["rotate", 3],
  79304. ["skewX", 1],
  79305. ["skewY", 1]
  79306. ]
  79307. },
  79308. "comp-op": {
  79309. "css": "line-pattern-comp-op",
  79310. "default-value": "src-over",
  79311. "default-meaning": "add the current symbolizer on top of other symbolizer",
  79312. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  79313. "type": ["clear",
  79314. "src",
  79315. "dst",
  79316. "src-over",
  79317. "dst-over",
  79318. "src-in",
  79319. "dst-in",
  79320. "src-out",
  79321. "dst-out",
  79322. "src-atop",
  79323. "dst-atop",
  79324. "xor",
  79325. "plus",
  79326. "minus",
  79327. "multiply",
  79328. "screen",
  79329. "overlay",
  79330. "darken",
  79331. "lighten",
  79332. "color-dodge",
  79333. "color-burn",
  79334. "hard-light",
  79335. "soft-light",
  79336. "difference",
  79337. "exclusion",
  79338. "contrast",
  79339. "invert",
  79340. "invert-rgb",
  79341. "grain-merge",
  79342. "grain-extract",
  79343. "hue",
  79344. "saturation",
  79345. "color",
  79346. "value"
  79347. ]
  79348. }
  79349. },
  79350. "polygon-pattern": {
  79351. "file": {
  79352. "css": "polygon-pattern-file",
  79353. "type": "uri",
  79354. "default-value": "none",
  79355. "required": true,
  79356. "doc": "Image to use as a repeated pattern fill within a polygon"
  79357. },
  79358. "alignment": {
  79359. "css": "polygon-pattern-alignment",
  79360. "type": [
  79361. "local",
  79362. "global"
  79363. ],
  79364. "default-value": "local",
  79365. "doc": "Specify whether to align pattern fills to the layer or to the map."
  79366. },
  79367. "gamma": {
  79368. "css": "polygon-pattern-gamma",
  79369. "type": "float",
  79370. "default-value": 1,
  79371. "default-meaning": "fully antialiased",
  79372. "range": "0-1",
  79373. "doc": "Level of antialiasing of polygon pattern edges"
  79374. },
  79375. "opacity": {
  79376. "css": "polygon-pattern-opacity",
  79377. "type": "float",
  79378. "doc": "(Default 1.0) - Apply an opacity level to the image used for the pattern",
  79379. "default-value": 1,
  79380. "default-meaning": "The image is rendered without modifications"
  79381. },
  79382. "clip": {
  79383. "css": "polygon-pattern-clip",
  79384. "type": "boolean",
  79385. "default-value": true,
  79386. "default-meaning": "geometry will be clipped to map bounds before rendering",
  79387. "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."
  79388. },
  79389. "smooth": {
  79390. "css": "polygon-pattern-smooth",
  79391. "type": "float",
  79392. "default-value": 0,
  79393. "default-meaning": "no smoothing",
  79394. "range": "0-1",
  79395. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  79396. },
  79397. "geometry-transform": {
  79398. "css": "polygon-pattern-geometry-transform",
  79399. "type": "functions",
  79400. "default-value": "none",
  79401. "default-meaning": "geometry will not be transformed",
  79402. "doc": "Allows transformation functions to be applied to the geometry.",
  79403. "functions": [
  79404. ["matrix", 6],
  79405. ["translate", 2],
  79406. ["scale", 2],
  79407. ["rotate", 3],
  79408. ["skewX", 1],
  79409. ["skewY", 1]
  79410. ]
  79411. },
  79412. "comp-op": {
  79413. "css": "polygon-pattern-comp-op",
  79414. "default-value": "src-over",
  79415. "default-meaning": "add the current symbolizer on top of other symbolizer",
  79416. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  79417. "type": ["clear",
  79418. "src",
  79419. "dst",
  79420. "src-over",
  79421. "dst-over",
  79422. "src-in",
  79423. "dst-in",
  79424. "src-out",
  79425. "dst-out",
  79426. "src-atop",
  79427. "dst-atop",
  79428. "xor",
  79429. "plus",
  79430. "minus",
  79431. "multiply",
  79432. "screen",
  79433. "overlay",
  79434. "darken",
  79435. "lighten",
  79436. "color-dodge",
  79437. "color-burn",
  79438. "hard-light",
  79439. "soft-light",
  79440. "difference",
  79441. "exclusion",
  79442. "contrast",
  79443. "invert",
  79444. "invert-rgb",
  79445. "grain-merge",
  79446. "grain-extract",
  79447. "hue",
  79448. "saturation",
  79449. "color",
  79450. "value"
  79451. ]
  79452. }
  79453. },
  79454. "raster": {
  79455. "opacity": {
  79456. "css": "raster-opacity",
  79457. "default-value": 1,
  79458. "default-meaning": "opaque",
  79459. "type": "float",
  79460. "doc": "The opacity of the raster symbolizer on top of other symbolizers."
  79461. },
  79462. "filter-factor": {
  79463. "css": "raster-filter-factor",
  79464. "default-value": -1,
  79465. "default-meaning": "Allow the datasource to choose appropriate downscaling.",
  79466. "type": "float",
  79467. "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."
  79468. },
  79469. "scaling": {
  79470. "css": "raster-scaling",
  79471. "type": [
  79472. "near",
  79473. "fast",
  79474. "bilinear",
  79475. "bilinear8",
  79476. "bicubic",
  79477. "spline16",
  79478. "spline36",
  79479. "hanning",
  79480. "hamming",
  79481. "hermite",
  79482. "kaiser",
  79483. "quadric",
  79484. "catrom",
  79485. "gaussian",
  79486. "bessel",
  79487. "mitchell",
  79488. "sinc",
  79489. "lanczos",
  79490. "blackman"
  79491. ],
  79492. "default-value": "near",
  79493. "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."
  79494. },
  79495. "mesh-size": {
  79496. "css": "raster-mesh-size",
  79497. "default-value": 16,
  79498. "default-meaning": "Reprojection mesh will be 1/16 of the resolution of the source image",
  79499. "type": "unsigned",
  79500. "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."
  79501. },
  79502. "comp-op": {
  79503. "css": "raster-comp-op",
  79504. "default-value": "src-over",
  79505. "default-meaning": "add the current symbolizer on top of other symbolizer",
  79506. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  79507. "type": ["clear",
  79508. "src",
  79509. "dst",
  79510. "src-over",
  79511. "dst-over",
  79512. "src-in",
  79513. "dst-in",
  79514. "src-out",
  79515. "dst-out",
  79516. "src-atop",
  79517. "dst-atop",
  79518. "xor",
  79519. "plus",
  79520. "minus",
  79521. "multiply",
  79522. "screen",
  79523. "overlay",
  79524. "darken",
  79525. "lighten",
  79526. "color-dodge",
  79527. "color-burn",
  79528. "hard-light",
  79529. "soft-light",
  79530. "difference",
  79531. "exclusion",
  79532. "contrast",
  79533. "invert",
  79534. "invert-rgb",
  79535. "grain-merge",
  79536. "grain-extract",
  79537. "hue",
  79538. "saturation",
  79539. "color",
  79540. "value"
  79541. ]
  79542. }
  79543. },
  79544. "point": {
  79545. "file": {
  79546. "css": "point-file",
  79547. "type": "uri",
  79548. "required": false,
  79549. "default-value": "none",
  79550. "doc": "Image file to represent a point"
  79551. },
  79552. "allow-overlap": {
  79553. "css": "point-allow-overlap",
  79554. "type": "boolean",
  79555. "default-value": false,
  79556. "doc": "Control whether overlapping points are shown or hidden.",
  79557. "default-meaning": "Do not allow points to overlap with each other - overlapping markers will not be shown."
  79558. },
  79559. "ignore-placement": {
  79560. "css": "point-ignore-placement",
  79561. "type": "boolean",
  79562. "default-value": false,
  79563. "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
  79564. "doc": "value to control whether the placement of the feature will prevent the placement of other features"
  79565. },
  79566. "opacity": {
  79567. "css": "point-opacity",
  79568. "type": "float",
  79569. "default-value": 1.0,
  79570. "default-meaning": "Fully opaque",
  79571. "doc": "A value from 0 to 1 to control the opacity of the point"
  79572. },
  79573. "placement": {
  79574. "css": "point-placement",
  79575. "type": [
  79576. "centroid",
  79577. "interior"
  79578. ],
  79579. "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.",
  79580. "default-value": "centroid"
  79581. },
  79582. "transform": {
  79583. "css": "point-transform",
  79584. "type": "functions",
  79585. "functions": [
  79586. ["matrix", 6],
  79587. ["translate", 2],
  79588. ["scale", 2],
  79589. ["rotate", 3],
  79590. ["skewX", 1],
  79591. ["skewY", 1]
  79592. ],
  79593. "default-value": "",
  79594. "default-meaning": "No transformation",
  79595. "doc": "SVG transformation definition"
  79596. },
  79597. "comp-op": {
  79598. "css": "point-comp-op",
  79599. "default-value": "src-over",
  79600. "default-meaning": "add the current symbolizer on top of other symbolizer",
  79601. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  79602. "type": ["clear",
  79603. "src",
  79604. "dst",
  79605. "src-over",
  79606. "dst-over",
  79607. "src-in",
  79608. "dst-in",
  79609. "src-out",
  79610. "dst-out",
  79611. "src-atop",
  79612. "dst-atop",
  79613. "xor",
  79614. "plus",
  79615. "minus",
  79616. "multiply",
  79617. "screen",
  79618. "overlay",
  79619. "darken",
  79620. "lighten",
  79621. "color-dodge",
  79622. "color-burn",
  79623. "hard-light",
  79624. "soft-light",
  79625. "difference",
  79626. "exclusion",
  79627. "contrast",
  79628. "invert",
  79629. "invert-rgb",
  79630. "grain-merge",
  79631. "grain-extract",
  79632. "hue",
  79633. "saturation",
  79634. "color",
  79635. "value"
  79636. ]
  79637. }
  79638. },
  79639. "text": {
  79640. "name": {
  79641. "css": "text-name",
  79642. "type": "expression",
  79643. "required": true,
  79644. "default-value": "",
  79645. "serialization": "content",
  79646. "doc": "Value to use for a text label. Data columns are specified using brackets like [column_name]"
  79647. },
  79648. "face-name": {
  79649. "css": "text-face-name",
  79650. "type": "string",
  79651. "validate": "font",
  79652. "doc": "Font name and style to render a label in",
  79653. "required": true
  79654. },
  79655. "size": {
  79656. "css": "text-size",
  79657. "type": "float",
  79658. "default-value": 10,
  79659. "doc": "Text size in pixels"
  79660. },
  79661. "text-ratio": {
  79662. "css": "text-ratio",
  79663. "doc": "Define the amount of text (of the total) present on successive lines when wrapping occurs",
  79664. "default-value": 0,
  79665. "type": "unsigned"
  79666. },
  79667. "wrap-width": {
  79668. "css": "text-wrap-width",
  79669. "doc": "Length of a chunk of text in characters before wrapping text",
  79670. "default-value": 0,
  79671. "type": "unsigned"
  79672. },
  79673. "wrap-before": {
  79674. "css": "text-wrap-before",
  79675. "type": "boolean",
  79676. "default-value": false,
  79677. "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
  79678. },
  79679. "wrap-character": {
  79680. "css": "text-wrap-character",
  79681. "type": "string",
  79682. "default-value": " ",
  79683. "doc": "Use this character instead of a space to wrap long text."
  79684. },
  79685. "spacing": {
  79686. "css": "text-spacing",
  79687. "type": "unsigned",
  79688. "doc": "Distance between repeated text labels on a line (aka. label-spacing)"
  79689. },
  79690. "character-spacing": {
  79691. "css": "text-character-spacing",
  79692. "type": "float",
  79693. "default-value": 0,
  79694. "doc": "Horizontal spacing adjustment between characters in pixels"
  79695. },
  79696. "line-spacing": {
  79697. "css": "text-line-spacing",
  79698. "default-value": 0,
  79699. "type": "unsigned",
  79700. "doc": "Vertical spacing adjustment between lines in pixels"
  79701. },
  79702. "label-position-tolerance": {
  79703. "css": "text-label-position-tolerance",
  79704. "default-value": 0,
  79705. "type": "unsigned",
  79706. "doc": "Allows the label to be displaced from its ideal position by a number of pixels (only works with placement:line)"
  79707. },
  79708. "max-char-angle-delta": {
  79709. "css": "text-max-char-angle-delta",
  79710. "type": "float",
  79711. "default-value": "22.5",
  79712. "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."
  79713. },
  79714. "fill": {
  79715. "css": "text-fill",
  79716. "doc": "Specifies the color for the text",
  79717. "default-value": "#000000",
  79718. "type": "color"
  79719. },
  79720. "opacity": {
  79721. "css": "text-opacity",
  79722. "doc": "A number from 0 to 1 specifying the opacity for the text",
  79723. "default-value": 1.0,
  79724. "default-meaning": "Fully opaque",
  79725. "type": "float"
  79726. },
  79727. "halo-fill": {
  79728. "css": "text-halo-fill",
  79729. "type": "color",
  79730. "default-value": "#FFFFFF",
  79731. "default-meaning": "white",
  79732. "doc": "Specifies the color of the halo around the text."
  79733. },
  79734. "halo-radius": {
  79735. "css": "text-halo-radius",
  79736. "doc": "Specify the radius of the halo in pixels",
  79737. "default-value": 0,
  79738. "default-meaning": "no halo",
  79739. "type": "float"
  79740. },
  79741. "dx": {
  79742. "css": "text-dx",
  79743. "type": "float",
  79744. "doc": "Displace text by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  79745. "default-value": 0
  79746. },
  79747. "dy": {
  79748. "css": "text-dy",
  79749. "type": "float",
  79750. "doc": "Displace text by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  79751. "default-value": 0
  79752. },
  79753. "vertical-alignment": {
  79754. "css": "text-vertical-alignment",
  79755. "type": [
  79756. "top",
  79757. "middle",
  79758. "bottom",
  79759. "auto"
  79760. ],
  79761. "doc": "Position of label relative to point position.",
  79762. "default-value": "auto",
  79763. "default-meaning": "Default affected by value of dy; \"bottom\" for dy>0, \"top\" for dy<0."
  79764. },
  79765. "avoid-edges": {
  79766. "css": "text-avoid-edges",
  79767. "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
  79768. "default-value": false,
  79769. "type": "boolean"
  79770. },
  79771. "minimum-distance": {
  79772. "css": "text-min-distance",
  79773. "doc": "Minimum permitted distance to the next text symbolizer.",
  79774. "type": "float"
  79775. },
  79776. "minimum-padding": {
  79777. "css": "text-min-padding",
  79778. "doc": "Determines the minimum amount of padding that a text symbolizer gets relative to other text",
  79779. "type": "float"
  79780. },
  79781. "minimum-path-length": {
  79782. "css": "text-min-path-length",
  79783. "type": "float",
  79784. "default-value": 0,
  79785. "default-meaning": "place labels on all paths",
  79786. "doc": "Place labels only on paths longer than this value."
  79787. },
  79788. "allow-overlap": {
  79789. "css": "text-allow-overlap",
  79790. "type": "boolean",
  79791. "default-value": false,
  79792. "doc": "Control whether overlapping text is shown or hidden.",
  79793. "default-meaning": "Do not allow text to overlap with other text - overlapping markers will not be shown."
  79794. },
  79795. "orientation": {
  79796. "css": "text-orientation",
  79797. "type": "expression",
  79798. "doc": "Rotate the text."
  79799. },
  79800. "placement": {
  79801. "css": "text-placement",
  79802. "type": [
  79803. "point",
  79804. "line",
  79805. "vertex",
  79806. "interior"
  79807. ],
  79808. "default-value": "point",
  79809. "doc": "Control the style of placement of a point versus the geometry it is attached to."
  79810. },
  79811. "placement-type": {
  79812. "css": "text-placement-type",
  79813. "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.",
  79814. "type": [
  79815. "dummy",
  79816. "simple"
  79817. ],
  79818. "default-value": "dummy"
  79819. },
  79820. "placements": {
  79821. "css": "text-placements",
  79822. "type": "string",
  79823. "default-value": "",
  79824. "doc": "If \"placement-type\" is set to \"simple\", use this \"POSITIONS,[SIZES]\" string. An example is `text-placements: \"E,NE,SE,W,NW,SW\";` "
  79825. },
  79826. "text-transform": {
  79827. "css": "text-transform",
  79828. "type": [
  79829. "none",
  79830. "uppercase",
  79831. "lowercase",
  79832. "capitalize"
  79833. ],
  79834. "doc": "Transform the case of the characters",
  79835. "default-value": "none"
  79836. },
  79837. "horizontal-alignment": {
  79838. "css": "text-horizontal-alignment",
  79839. "type": [
  79840. "left",
  79841. "middle",
  79842. "right",
  79843. "auto"
  79844. ],
  79845. "doc": "The text's horizontal alignment from its centerpoint",
  79846. "default-value": "auto"
  79847. },
  79848. "justify-alignment": {
  79849. "css": "text-align",
  79850. "type": [
  79851. "left",
  79852. "right",
  79853. "center",
  79854. "auto"
  79855. ],
  79856. "doc": "Define how text is justified",
  79857. "default-value": "auto",
  79858. "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"
  79859. },
  79860. "clip": {
  79861. "css": "text-clip",
  79862. "type": "boolean",
  79863. "default-value": true,
  79864. "default-meaning": "geometry will be clipped to map bounds before rendering",
  79865. "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."
  79866. },
  79867. "comp-op": {
  79868. "css": "text-comp-op",
  79869. "default-value": "src-over",
  79870. "default-meaning": "add the current symbolizer on top of other symbolizer",
  79871. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  79872. "type": ["clear",
  79873. "src",
  79874. "dst",
  79875. "src-over",
  79876. "dst-over",
  79877. "src-in",
  79878. "dst-in",
  79879. "src-out",
  79880. "dst-out",
  79881. "src-atop",
  79882. "dst-atop",
  79883. "xor",
  79884. "plus",
  79885. "minus",
  79886. "multiply",
  79887. "screen",
  79888. "overlay",
  79889. "darken",
  79890. "lighten",
  79891. "color-dodge",
  79892. "color-burn",
  79893. "hard-light",
  79894. "soft-light",
  79895. "difference",
  79896. "exclusion",
  79897. "contrast",
  79898. "invert",
  79899. "invert-rgb",
  79900. "grain-merge",
  79901. "grain-extract",
  79902. "hue",
  79903. "saturation",
  79904. "color",
  79905. "value"
  79906. ]
  79907. }
  79908. },
  79909. "building": {
  79910. "fill": {
  79911. "css": "building-fill",
  79912. "default-value": "#FFFFFF",
  79913. "doc": "The color of the buildings walls.",
  79914. "type": "color"
  79915. },
  79916. "fill-opacity": {
  79917. "css": "building-fill-opacity",
  79918. "type": "float",
  79919. "doc": "The opacity of the building as a whole, including all walls.",
  79920. "default-value": 1
  79921. },
  79922. "height": {
  79923. "css": "building-height",
  79924. "doc": "The height of the building in pixels.",
  79925. "type": "expression",
  79926. "default-value": "0"
  79927. }
  79928. }
  79929. },
  79930. "colors": {
  79931. "aliceblue": [240, 248, 255],
  79932. "antiquewhite": [250, 235, 215],
  79933. "aqua": [0, 255, 255],
  79934. "aquamarine": [127, 255, 212],
  79935. "azure": [240, 255, 255],
  79936. "beige": [245, 245, 220],
  79937. "bisque": [255, 228, 196],
  79938. "black": [0, 0, 0],
  79939. "blanchedalmond": [255, 235, 205],
  79940. "blue": [0, 0, 255],
  79941. "blueviolet": [138, 43, 226],
  79942. "brown": [165, 42, 42],
  79943. "burlywood": [222, 184, 135],
  79944. "cadetblue": [95, 158, 160],
  79945. "chartreuse": [127, 255, 0],
  79946. "chocolate": [210, 105, 30],
  79947. "coral": [255, 127, 80],
  79948. "cornflowerblue": [100, 149, 237],
  79949. "cornsilk": [255, 248, 220],
  79950. "crimson": [220, 20, 60],
  79951. "cyan": [0, 255, 255],
  79952. "darkblue": [0, 0, 139],
  79953. "darkcyan": [0, 139, 139],
  79954. "darkgoldenrod": [184, 134, 11],
  79955. "darkgray": [169, 169, 169],
  79956. "darkgreen": [0, 100, 0],
  79957. "darkgrey": [169, 169, 169],
  79958. "darkkhaki": [189, 183, 107],
  79959. "darkmagenta": [139, 0, 139],
  79960. "darkolivegreen": [85, 107, 47],
  79961. "darkorange": [255, 140, 0],
  79962. "darkorchid": [153, 50, 204],
  79963. "darkred": [139, 0, 0],
  79964. "darksalmon": [233, 150, 122],
  79965. "darkseagreen": [143, 188, 143],
  79966. "darkslateblue": [72, 61, 139],
  79967. "darkslategrey": [47, 79, 79],
  79968. "darkturquoise": [0, 206, 209],
  79969. "darkviolet": [148, 0, 211],
  79970. "deeppink": [255, 20, 147],
  79971. "deepskyblue": [0, 191, 255],
  79972. "dimgray": [105, 105, 105],
  79973. "dimgrey": [105, 105, 105],
  79974. "dodgerblue": [30, 144, 255],
  79975. "firebrick": [178, 34, 34],
  79976. "floralwhite": [255, 250, 240],
  79977. "forestgreen": [34, 139, 34],
  79978. "fuchsia": [255, 0, 255],
  79979. "gainsboro": [220, 220, 220],
  79980. "ghostwhite": [248, 248, 255],
  79981. "gold": [255, 215, 0],
  79982. "goldenrod": [218, 165, 32],
  79983. "gray": [128, 128, 128],
  79984. "grey": [128, 128, 128],
  79985. "green": [0, 128, 0],
  79986. "greenyellow": [173, 255, 47],
  79987. "honeydew": [240, 255, 240],
  79988. "hotpink": [255, 105, 180],
  79989. "indianred": [205, 92, 92],
  79990. "indigo": [75, 0, 130],
  79991. "ivory": [255, 255, 240],
  79992. "khaki": [240, 230, 140],
  79993. "lavender": [230, 230, 250],
  79994. "lavenderblush": [255, 240, 245],
  79995. "lawngreen": [124, 252, 0],
  79996. "lemonchiffon": [255, 250, 205],
  79997. "lightblue": [173, 216, 230],
  79998. "lightcoral": [240, 128, 128],
  79999. "lightcyan": [224, 255, 255],
  80000. "lightgoldenrodyellow": [250, 250, 210],
  80001. "lightgray": [211, 211, 211],
  80002. "lightgreen": [144, 238, 144],
  80003. "lightgrey": [211, 211, 211],
  80004. "lightpink": [255, 182, 193],
  80005. "lightsalmon": [255, 160, 122],
  80006. "lightseagreen": [32, 178, 170],
  80007. "lightskyblue": [135, 206, 250],
  80008. "lightslategray": [119, 136, 153],
  80009. "lightslategrey": [119, 136, 153],
  80010. "lightsteelblue": [176, 196, 222],
  80011. "lightyellow": [255, 255, 224],
  80012. "lime": [0, 255, 0],
  80013. "limegreen": [50, 205, 50],
  80014. "linen": [250, 240, 230],
  80015. "magenta": [255, 0, 255],
  80016. "maroon": [128, 0, 0],
  80017. "mediumaquamarine": [102, 205, 170],
  80018. "mediumblue": [0, 0, 205],
  80019. "mediumorchid": [186, 85, 211],
  80020. "mediumpurple": [147, 112, 219],
  80021. "mediumseagreen": [60, 179, 113],
  80022. "mediumslateblue": [123, 104, 238],
  80023. "mediumspringgreen": [0, 250, 154],
  80024. "mediumturquoise": [72, 209, 204],
  80025. "mediumvioletred": [199, 21, 133],
  80026. "midnightblue": [25, 25, 112],
  80027. "mintcream": [245, 255, 250],
  80028. "mistyrose": [255, 228, 225],
  80029. "moccasin": [255, 228, 181],
  80030. "navajowhite": [255, 222, 173],
  80031. "navy": [0, 0, 128],
  80032. "oldlace": [253, 245, 230],
  80033. "olive": [128, 128, 0],
  80034. "olivedrab": [107, 142, 35],
  80035. "orange": [255, 165, 0],
  80036. "orangered": [255, 69, 0],
  80037. "orchid": [218, 112, 214],
  80038. "palegoldenrod": [238, 232, 170],
  80039. "palegreen": [152, 251, 152],
  80040. "paleturquoise": [175, 238, 238],
  80041. "palevioletred": [219, 112, 147],
  80042. "papayawhip": [255, 239, 213],
  80043. "peachpuff": [255, 218, 185],
  80044. "peru": [205, 133, 63],
  80045. "pink": [255, 192, 203],
  80046. "plum": [221, 160, 221],
  80047. "powderblue": [176, 224, 230],
  80048. "purple": [128, 0, 128],
  80049. "red": [255, 0, 0],
  80050. "rosybrown": [188, 143, 143],
  80051. "royalblue": [65, 105, 225],
  80052. "saddlebrown": [139, 69, 19],
  80053. "salmon": [250, 128, 114],
  80054. "sandybrown": [244, 164, 96],
  80055. "seagreen": [46, 139, 87],
  80056. "seashell": [255, 245, 238],
  80057. "sienna": [160, 82, 45],
  80058. "silver": [192, 192, 192],
  80059. "skyblue": [135, 206, 235],
  80060. "slateblue": [106, 90, 205],
  80061. "slategray": [112, 128, 144],
  80062. "slategrey": [112, 128, 144],
  80063. "snow": [255, 250, 250],
  80064. "springgreen": [0, 255, 127],
  80065. "steelblue": [70, 130, 180],
  80066. "tan": [210, 180, 140],
  80067. "teal": [0, 128, 128],
  80068. "thistle": [216, 191, 216],
  80069. "tomato": [255, 99, 71],
  80070. "turquoise": [64, 224, 208],
  80071. "violet": [238, 130, 238],
  80072. "wheat": [245, 222, 179],
  80073. "white": [255, 255, 255],
  80074. "whitesmoke": [245, 245, 245],
  80075. "yellow": [255, 255, 0],
  80076. "yellowgreen": [154, 205, 50],
  80077. "transparent": [0, 0, 0, 0]
  80078. },
  80079. "filter": {
  80080. "value": [
  80081. "true",
  80082. "false",
  80083. "null",
  80084. "point",
  80085. "linestring",
  80086. "polygon",
  80087. "collection"
  80088. ]
  80089. }
  80090. };
  80091. CartoCSS['mapnik_reference'] = {
  80092. version: {
  80093. latest: _mapnik_reference_latest,
  80094. '2.1.1': _mapnik_reference_latest
  80095. }
  80096. };
  80097. CartoCSS.Tree = {};
  80098. CartoCSS.Tree.operate = function(op, a, b) {
  80099. switch (op) {
  80100. case '+': return a + b;
  80101. case '-': return a - b;
  80102. case '*': return a * b;
  80103. case '%': return a % b;
  80104. case '/': return a / b;
  80105. }
  80106. };
  80107. CartoCSS.Tree.functions = {
  80108. rgb: function (r, g, b) {
  80109. return this.rgba(r, g, b, 1.0);
  80110. },
  80111. rgba: function (r, g, b, a) {
  80112. var me = this;
  80113. var rgb = [r, g, b].map(function (c) {
  80114. return me.number(c);
  80115. });
  80116. a = me.number(a);
  80117. if (rgb.some(isNaN) || isNaN(a)) {return null;}
  80118. return new CartoCSS.Tree.Color(rgb, a);
  80119. },
  80120. // Only require val
  80121. stop: function (val) {
  80122. var color, mode;
  80123. if (arguments.length > 1) {color = arguments[1];}
  80124. if (arguments.length > 2) {mode = arguments[2];}
  80125. return {
  80126. is: 'tag',
  80127. val: val,
  80128. color: color,
  80129. mode: mode,
  80130. toString(env) {
  80131. return '\n\t<stop value="' + val.ev(env) + '"' +
  80132. (color ? ' color="' + color.ev(env) + '" ' : '') +
  80133. (mode ? ' mode="' + mode.ev(env) + '" ' : '') +
  80134. '/>';
  80135. }
  80136. };
  80137. },
  80138. hsl: function (h, s, l) {
  80139. return this.hsla(h, s, l, 1.0);
  80140. },
  80141. hsla: function (h, s, l, a) {
  80142. h = (this.number(h) % 360) / 360;
  80143. s = this.number(s);
  80144. l = this.number(l);
  80145. a = this.number(a);
  80146. if ([h, s, l, a].some(isNaN)) {return null;}
  80147. var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s,
  80148. m1 = l * 2 - m2;
  80149. return this.rgba(hue(h + 1 / 3) * 255,
  80150. hue(h) * 255,
  80151. hue(h - 1 / 3) * 255,
  80152. a);
  80153. function hue(h) {
  80154. h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
  80155. 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;}
  80156. }
  80157. },
  80158. hue: function (color) {
  80159. if (!('toHSL' in color)) {return null;}
  80160. return new CartoCSS.Tree.Dimension(Math.round(color.toHSL().h));
  80161. },
  80162. saturation: function (color) {
  80163. if (!('toHSL' in color)) {return null;}
  80164. return new CartoCSS.Tree.Dimension(Math.round(color.toHSL().s * 100), '%');
  80165. },
  80166. lightness: function (color) {
  80167. if (!('toHSL' in color)) {return null;}
  80168. return new CartoCSS.Tree.Dimension(Math.round(color.toHSL().l * 100), '%');
  80169. },
  80170. alpha: function (color) {
  80171. if (!('toHSL' in color)) {return null;}
  80172. return new CartoCSS.Tree.Dimension(color.toHSL().a);
  80173. },
  80174. saturate: function (color, amount) {
  80175. if (!('toHSL' in color)) {return null;}
  80176. var hsl = color.toHSL();
  80177. hsl.s += amount.value / 100;
  80178. hsl.s = this.clamp(hsl.s);
  80179. return this.hsla_simple(hsl);
  80180. },
  80181. desaturate: function (color, amount) {
  80182. if (!('toHSL' in color)) {return null;}
  80183. var hsl = color.toHSL();
  80184. hsl.s -= amount.value / 100;
  80185. hsl.s = this.clamp(hsl.s);
  80186. return this.hsla_simple(hsl);
  80187. },
  80188. lighten: function (color, amount) {
  80189. if (!('toHSL' in color)) {return null;}
  80190. var hsl = color.toHSL();
  80191. hsl.l += amount.value / 100;
  80192. hsl.l = this.clamp(hsl.l);
  80193. return this.hsla_simple(hsl);
  80194. },
  80195. darken: function (color, amount) {
  80196. if (!('toHSL' in color)) {return null;}
  80197. var hsl = color.toHSL();
  80198. hsl.l -= amount.value / 100;
  80199. hsl.l = this.clamp(hsl.l);
  80200. return this.hsla_simple(hsl);
  80201. },
  80202. fadein: function (color, amount) {
  80203. if (!('toHSL' in color)) {return null;}
  80204. var hsl = color.toHSL();
  80205. hsl.a += amount.value / 100;
  80206. hsl.a = this.clamp(hsl.a);
  80207. return this.hsla_simple(hsl);
  80208. },
  80209. fadeout: function (color, amount) {
  80210. if (!('toHSL' in color)) {return null;}
  80211. var hsl = color.toHSL();
  80212. hsl.a -= amount.value / 100;
  80213. hsl.a = this.clamp(hsl.a);
  80214. return this.hsla_simple(hsl);
  80215. },
  80216. spin: function (color, amount) {
  80217. if (!('toHSL' in color)) {return null;}
  80218. var hsl = color.toHSL();
  80219. var hue = (hsl.h + amount.value) % 360;
  80220. hsl.h = hue < 0 ? 360 + hue : hue;
  80221. return this.hsla_simple(hsl);
  80222. },
  80223. replace: function (entity, a, b) {
  80224. if (entity.is === 'field') {
  80225. return entity.toString + '.replace(' + a.toString() + ', ' + b.toString() + ')';
  80226. } else {
  80227. return entity.replace(a, b);
  80228. }
  80229. },
  80230. //
  80231. // Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein
  80232. // http://sass-lang.com
  80233. //
  80234. mix: function (color1, color2, weight) {
  80235. var p = weight.value / 100.0;
  80236. var w = p * 2 - 1;
  80237. var a = color1.toHSL().a - color2.toHSL().a;
  80238. var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
  80239. var w2 = 1 - w1;
  80240. var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2,
  80241. color1.rgb[1] * w1 + color2.rgb[1] * w2,
  80242. color1.rgb[2] * w1 + color2.rgb[2] * w2];
  80243. var alpha = color1.alpha * p + color2.alpha * (1 - p);
  80244. return new CartoCSS.Tree.Color(rgb, alpha);
  80245. },
  80246. greyscale: function (color) {
  80247. return this.desaturate(color, new CartoCSS.Tree.Dimension(100));
  80248. },
  80249. '%': function (quoted /* arg, arg, ...*/) {
  80250. var args = Array.prototype.slice.call(arguments, 1),
  80251. str = quoted.value;
  80252. for (var i = 0; i < args.length; i++) {
  80253. str = str.replace(/%s/, args[i].value)
  80254. .replace(/%[da]/, args[i].toString());
  80255. }
  80256. str = str.replace(/%%/g, '%');
  80257. return new CartoCSS.Tree.Quoted(str);
  80258. },
  80259. hsla_simple: function (h) {
  80260. return this.hsla(h.h, h.s, h.l, h.a);
  80261. },
  80262. number: function (n) {
  80263. if (n instanceof CartoCSS.Tree.Dimension) {
  80264. return parseFloat(n.unit === '%' ? n.value / 100 : n.value);
  80265. } else if (typeof(n) === 'number') {
  80266. return n;
  80267. } else {
  80268. return NaN;
  80269. }
  80270. },
  80271. clamp: function (val) {
  80272. return Math.min(1, Math.max(0, val));
  80273. }
  80274. };
  80275. CartoCSS.Tree.Call = class Call {
  80276. constructor(name, args, index) {
  80277. this.is = 'call';
  80278. this.name = name;
  80279. this.args = args;
  80280. this.index = index;
  80281. }
  80282. // When evuating a function call,
  80283. // we either find the function in `tree.functions` [1],
  80284. // in which case we call it, passing the evaluated arguments,
  80285. // or we simply print it out as it appeared originally [2].
  80286. // The *functions.js* file contains the built-in functions.
  80287. // The reason why we evaluate the arguments, is in the case where
  80288. // we try to pass a variable to a function, like: `saturate(@color)`.
  80289. // The function should receive the value, not the variable.
  80290. 'ev'(env) {
  80291. var args = this.args.map(function (a) {
  80292. return a.ev(env);
  80293. });
  80294. for (var i = 0; i < args.length; i++) {
  80295. if (args[i].is === 'undefined') {
  80296. return {
  80297. is: 'undefined',
  80298. value: 'undefined'
  80299. };
  80300. }
  80301. }
  80302. if (this.name in CartoCSS.Tree.functions) {
  80303. if (CartoCSS.Tree.functions[this.name].length <= args.length) {
  80304. var val = CartoCSS.Tree.functions[this.name].apply(CartoCSS.Tree.functions, args);
  80305. if (val === null) {
  80306. env.error({
  80307. message: 'incorrect arguments given to ' + this.name + '()',
  80308. index: this.index,
  80309. type: 'runtime',
  80310. filename: this.filename
  80311. });
  80312. return {is: 'undefined', value: 'undefined'};
  80313. }
  80314. return val;
  80315. } else {
  80316. env.error({
  80317. message: 'incorrect number of arguments for ' + this.name +
  80318. '(). ' + CartoCSS.Tree.functions[this.name].length + ' expected.',
  80319. index: this.index,
  80320. type: 'runtime',
  80321. filename: this.filename
  80322. });
  80323. return {
  80324. is: 'undefined',
  80325. value: 'undefined'
  80326. };
  80327. }
  80328. } else {
  80329. var fn = CartoCSS.Tree.Reference.mapnikFunctions[this.name];
  80330. if (fn === undefined) {
  80331. var functions = lodash_topairs_default()(CartoCSS.Tree.Reference.mapnikFunctions);
  80332. // cheap closest, needs improvement.
  80333. var name = this.name;
  80334. var mean = functions.map(function (f) {
  80335. return [f[0], CartoCSS.Tree.Reference.editDistance(name, f[0]), f[1]];
  80336. }).sort(function (a, b) {
  80337. return a[1] - b[1];
  80338. });
  80339. env.error({
  80340. message: 'unknown function ' + this.name + '(), did you mean ' +
  80341. mean[0][0] + '(' + mean[0][2] + ')',
  80342. index: this.index,
  80343. type: 'runtime',
  80344. filename: this.filename
  80345. });
  80346. return {
  80347. is: 'undefined',
  80348. value: 'undefined'
  80349. };
  80350. }
  80351. if (fn !== args.length &&
  80352. // support variable-arg functions like `colorize-alpha`
  80353. fn !== -1) {
  80354. env.error({
  80355. message: 'function ' + this.name + '() takes ' +
  80356. fn + ' arguments and was given ' + args.length,
  80357. index: this.index,
  80358. type: 'runtime',
  80359. filename: this.filename
  80360. });
  80361. return {
  80362. is: 'undefined',
  80363. value: 'undefined'
  80364. };
  80365. } else {
  80366. // Save the evaluated versions of arguments
  80367. this.args = args;
  80368. return this;
  80369. }
  80370. }
  80371. }
  80372. toString(env, format) {
  80373. if (this.args.length) {
  80374. return this.name + '(' + this.args.join(',') + ')';
  80375. } else {
  80376. return this.name;
  80377. }
  80378. }
  80379. };
  80380. CartoCSS.Tree.Color = class Color {
  80381. constructor(rgb, a) {
  80382. this.is = 'color';
  80383. // The end goal here, is to parse the arguments
  80384. // into an integer triplet, such as `128, 255, 0`
  80385. //
  80386. // This facilitates operations and conversions.
  80387. if (Array.isArray(rgb)) {
  80388. this.rgb = rgb.slice(0, 3);
  80389. } else if (rgb.length == 6) {
  80390. this.rgb = rgb.match(/.{2}/g).map(function (c) {
  80391. return parseInt(c, 16);
  80392. });
  80393. } else {
  80394. this.rgb = rgb.split('').map(function (c) {
  80395. return parseInt(c + c, 16);
  80396. });
  80397. }
  80398. if (typeof(a) === 'number') {
  80399. this.alpha = a;
  80400. } else if (rgb.length === 4) {
  80401. this.alpha = rgb[3];
  80402. } else {
  80403. this.alpha = 1;
  80404. }
  80405. }
  80406. 'ev'() {
  80407. return this;
  80408. }
  80409. // If we have some transparency, the only way to represent it
  80410. // is via `rgba`. Otherwise, we use the hex representation,
  80411. // which has better compatibility with older browsers.
  80412. // Values are capped between `0` and `255`, rounded and zero-padded.
  80413. toString() {
  80414. /* if (this.alpha < 1.0) {*/
  80415. return 'rgba(' + this.rgb.map(function (c) {
  80416. return Math.round(c);
  80417. }).concat(this.alpha).join(', ') + ')';
  80418. /*} else {
  80419. return '#' + this.rgb.map(function(i) {
  80420. i = Math.round(i);
  80421. i = (i > 255 ? 255 : (i < 0 ? 0 : i)).toString(16);
  80422. return i.length === 1 ? '0' + i : i;
  80423. }).join('');
  80424. }*/
  80425. }
  80426. // Operations have to be done per-channel, if not,
  80427. // channels will spill onto each other. Once we have
  80428. // our result, in the form of an integer triplet,
  80429. // we create a new Color node to hold the result.
  80430. operate(env, op, other) {
  80431. var result = [];
  80432. if (!(other instanceof CartoCSS.Tree.Color)) {
  80433. other = other.toColor();
  80434. }
  80435. for (var c = 0; c < 3; c++) {
  80436. result[c] = CartoCSS.Tree.operate(op, this.rgb[c], other.rgb[c]);
  80437. }
  80438. return new CartoCSS.Tree.Color(result);
  80439. }
  80440. toHSL() {
  80441. var r = this.rgb[0] / 255,
  80442. g = this.rgb[1] / 255,
  80443. b = this.rgb[2] / 255,
  80444. a = this.alpha;
  80445. var max = Math.max(r, g, b), min = Math.min(r, g, b);
  80446. var h, s, l = (max + min) / 2, d = max - min;
  80447. if (max === min) {
  80448. h = s = 0;
  80449. } else {
  80450. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  80451. switch (max) {
  80452. case r:
  80453. h = (g - b) / d + (g < b ? 6 : 0);
  80454. break;
  80455. case g:
  80456. h = (b - r) / d + 2;
  80457. break;
  80458. case b:
  80459. h = (r - g) / d + 4;
  80460. break;
  80461. default:
  80462. break;
  80463. }
  80464. h /= 6;
  80465. }
  80466. return {h: h * 360, s: s, l: l, a: a};
  80467. }
  80468. };
  80469. CartoCSS.Tree.Comment = class Comment {
  80470. constructor(value, silent) {
  80471. this.value = value;
  80472. this.silent = !!silent;
  80473. }
  80474. toString(env) {
  80475. return '<!--' + this.value + '-->';
  80476. }
  80477. 'ev'() {
  80478. return this;
  80479. }
  80480. };
  80481. CartoCSS.Tree.Definition = class Definition {
  80482. constructor(selector, rules) {
  80483. this.elements = selector.elements;
  80484. //assert.ok(selector.filters instanceof CartoCSS.Tree.Filterset);
  80485. this.rules = rules;
  80486. this.ruleIndex = {};
  80487. for (var i = 0; i < this.rules.length; i++) {
  80488. if ('zoom' in this.rules[i]) {this.rules[i] = this.rules[i].clone();}
  80489. this.rules[i].zoom = selector.zoom;
  80490. this.ruleIndex[this.rules[i].updateID()] = true;
  80491. }
  80492. this.filters = selector.filters;
  80493. this.zoom = selector.zoom;
  80494. this.attachment = selector.attachment || '__default__';
  80495. this.specificity = selector.specificity();
  80496. }
  80497. toString() {
  80498. var str = this.filters.toString();
  80499. for (var i = 0; i < this.rules.length; i++) {
  80500. str += '\n ' + this.rules[i];
  80501. }
  80502. return str;
  80503. }
  80504. toJS(env) {
  80505. var shaderAttrs = {};
  80506. // merge conditions from filters with zoom condition of the
  80507. // definition
  80508. var zoom = this.zoom;
  80509. //var frame_offset = this.frame_offset;
  80510. var _if = this.filters.toJS(env);
  80511. var filters = [zoom];
  80512. if (_if) {filters.push(_if);}
  80513. //if(frame_offset) filters.push('ctx["frame-offset"] === ' + frame_offset);
  80514. _if = filters.join(" && ");
  80515. function eachRule(rule) {
  80516. if (rule instanceof CartoCSS.Tree.Rule) {
  80517. shaderAttrs[rule.name] = shaderAttrs[rule.name] || [];
  80518. if (_if) {
  80519. shaderAttrs[rule.name].push(
  80520. "if(" + _if + "){" + rule.value.toJS(env) + "}"
  80521. );
  80522. } else {
  80523. shaderAttrs[rule.name].push(rule.value.toJS(env));
  80524. }
  80525. } else {
  80526. if (rule instanceof CartoCSS.Tree.Ruleset) {
  80527. var sh = rule.toJS(env);
  80528. for (var v in sh) {
  80529. shaderAttrs[v] = shaderAttrs[v] || [];
  80530. for (var attr in sh[v]) {
  80531. shaderAttrs[v].push(sh[v][attr]);
  80532. }
  80533. }
  80534. }
  80535. }
  80536. }
  80537. for (var id in this.rules) {
  80538. eachRule(this.rules[id]);
  80539. }
  80540. return shaderAttrs;
  80541. }
  80542. };
  80543. CartoCSS.Tree.Dimension = class Dimension {
  80544. constructor(value, unit, index) {
  80545. this.is = 'float';
  80546. this.physical_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc'];
  80547. this.screen_units = ['px', '%'];
  80548. this.all_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc', 'px', '%'];
  80549. this.densities = {
  80550. m: 0.0254,
  80551. mm: 25.4,
  80552. cm: 2.54,
  80553. pt: 72,
  80554. pc: 6
  80555. };
  80556. this.value = parseFloat(value);
  80557. this.unit = unit || null;
  80558. this.index = index;
  80559. }
  80560. ev(env) {
  80561. if (this.unit && this.all_units.indexOf(this.unit)<0) {
  80562. env.error({
  80563. message: "Invalid unit: '" + this.unit + "'",
  80564. index: this.index
  80565. });
  80566. return {is: 'undefined', value: 'undefined'};
  80567. }
  80568. // normalize units which are not px or %
  80569. if (this.unit && this.physical_units.indexOf(this.unit)>=0) {
  80570. if (!env.ppi) {
  80571. env.error({
  80572. message: "ppi is not set, so metric units can't be used",
  80573. index: this.index
  80574. });
  80575. return {is: 'undefined', value: 'undefined'};
  80576. }
  80577. // convert all units to inch
  80578. // convert inch to px using ppi
  80579. this.value = (this.value / this.densities[this.unit]) * env.ppi;
  80580. this.unit = 'px';
  80581. }
  80582. return this;
  80583. }
  80584. toColor() {
  80585. return new CartoCSS.Tree.Color([this.value, this.value, this.value]);
  80586. }
  80587. round() {
  80588. this.value = Math.round(this.value);
  80589. return this;
  80590. }
  80591. toString() {
  80592. return this.value.toString();
  80593. }
  80594. operate(env, op, other) {
  80595. if (this.unit === '%' && other.unit !== '%') {
  80596. env.error({
  80597. message: 'If two operands differ, the first must not be %',
  80598. index: this.index
  80599. });
  80600. return {
  80601. is: 'undefined',
  80602. value: 'undefined'
  80603. };
  80604. }
  80605. if (this.unit !== '%' && other.unit === '%') {
  80606. if (op === '*' || op === '/' || op === '%') {
  80607. env.error({
  80608. message: 'Percent values can only be added or subtracted from other values',
  80609. index: this.index
  80610. });
  80611. return {
  80612. is: 'undefined',
  80613. value: 'undefined'
  80614. };
  80615. }
  80616. return new CartoCSS.Tree.Dimension(CartoCSS.Tree.operate(op,
  80617. this.value, this.value * other.value * 0.01),
  80618. this.unit);
  80619. }
  80620. //here the operands are either the same (% or undefined or px), or one is undefined and the other is px
  80621. return new CartoCSS.Tree.Dimension(CartoCSS.Tree.operate(op, this.value, other.value),
  80622. this.unit || other.unit);
  80623. }
  80624. };
  80625. CartoCSS.Tree.Element = class Element {
  80626. constructor(value) {
  80627. this.value = value.trim();
  80628. if (this.value[0] === '#') {
  80629. this.type = 'id';
  80630. this.clean = this.value.replace(/^#/, '');
  80631. }
  80632. if (this.value[0] === '.') {
  80633. this.type = 'class';
  80634. this.clean = this.value.replace(/^\./, '');
  80635. }
  80636. if (this.value.indexOf('*') !== -1) {
  80637. this.type = 'wildcard';
  80638. }
  80639. }
  80640. specificity() {
  80641. return [
  80642. (this.type === 'id') ? 1 : 0, // a
  80643. (this.type === 'class') ? 1 : 0 // b
  80644. ];
  80645. }
  80646. toString() {
  80647. return this.value;
  80648. }
  80649. };
  80650. CartoCSS.Tree.Expression = class Expression {
  80651. constructor(value) {
  80652. this.is = 'expression';
  80653. this.value = value;
  80654. }
  80655. ev(env) {
  80656. if (this.value.length > 1) {
  80657. return new CartoCSS.Tree.Expression(this.value.map(function (e) {
  80658. return e.ev(env);
  80659. }));
  80660. } else {
  80661. return this.value[0].ev(env);
  80662. }
  80663. }
  80664. toString(env) {
  80665. return this.value.map(function (e) {
  80666. return e.toString(env);
  80667. }).join(' ');
  80668. }
  80669. };
  80670. CartoCSS.Tree.Field = class Field {
  80671. constructor(content) {
  80672. this.is = 'field';
  80673. this.value = content || '';
  80674. }
  80675. toString() {
  80676. return '["' + this.value.toUpperCase() + '"]';
  80677. }
  80678. 'ev'() {
  80679. return this;
  80680. }
  80681. };
  80682. CartoCSS.Tree.Filter = class Filter {
  80683. constructor(key, op, val, index, filename) {
  80684. this.ops = {
  80685. '<': [' &lt; ', 'numeric'],
  80686. '>': [' &gt; ', 'numeric'],
  80687. '=': [' = ', 'both'],
  80688. '!=': [' != ', 'both'],
  80689. '<=': [' &lt;= ', 'numeric'],
  80690. '>=': [' &gt;= ', 'numeric'],
  80691. '=~': ['.match(', 'string', ')']
  80692. };
  80693. this.key = key;
  80694. this.op = op;
  80695. this.val = val;
  80696. this.index = index;
  80697. this.filename = filename;
  80698. this.id = this.key + this.op + this.val;
  80699. }
  80700. ev(env) {
  80701. this.key = this.key.ev(env);
  80702. this.val = this.val.ev(env);
  80703. return this;
  80704. }
  80705. toString() {
  80706. return '[' + this.id + ']';
  80707. }
  80708. };
  80709. CartoCSS.Tree.Filterset = class Filterset {
  80710. constructor() {
  80711. this.filters = {};
  80712. }
  80713. toJS(env) {
  80714. function eachFilter(filter) {
  80715. var op = filter.op;
  80716. if (op === "=") {
  80717. op = "==";
  80718. }
  80719. var val = filter.val;
  80720. if (filter._val !== undefined) {
  80721. val = filter._val.toString(true);
  80722. }
  80723. //对scale进行特殊处理,将值转换成数值
  80724. if (filter.key && filter.key.value === 'scale') {
  80725. val = +val;
  80726. } else if (typeof val === 'string' || typeof val === 'object') {
  80727. val = "'" + val + "'";
  80728. }
  80729. var attrs = "attributes";
  80730. return attrs + "&&" + attrs + filter.key + "&&" + attrs + filter.key + " " + op + val;
  80731. }
  80732. var results = [];
  80733. for (var id in this.filters) {
  80734. results.push(eachFilter(this.filters[id]));
  80735. }
  80736. return results.join(' && ');
  80737. }
  80738. toString() {
  80739. var arr = [];
  80740. for (var id in this.filters) {arr.push(this.filters[id].id);}
  80741. return arr.sort().join('\t');
  80742. }
  80743. ev(env) {
  80744. for (var i in this.filters) {
  80745. this.filters[i].ev(env);
  80746. }
  80747. return this;
  80748. }
  80749. clone() {
  80750. var clone = new CartoCSS.Tree.Filterset();
  80751. for (var id in this.filters) {
  80752. clone.filters[id] = this.filters[id];
  80753. }
  80754. return clone;
  80755. }
  80756. cloneWith(other) {
  80757. var additions = [];
  80758. for (var id in other.filters) {
  80759. var status = this.addable(other.filters[id]);
  80760. // status is true, false or null. if it's null we don't fail this
  80761. // clone nor do we add the filter.
  80762. if (status === false) {
  80763. return false;
  80764. }
  80765. if (status === true) {
  80766. // Adding the filter will override another value.
  80767. additions.push(other.filters[id]);
  80768. }
  80769. }
  80770. // Adding the other filters doesn't make this filterset invalid, but it
  80771. // doesn't add anything to it either.
  80772. if (!additions.length) {
  80773. return null;
  80774. }
  80775. // We can successfully add all filters. Now clone the filterset and add the
  80776. // new rules.
  80777. var clone = new CartoCSS.Tree.Filterset();
  80778. // We can add the rules that are already present without going through the
  80779. // add function as a Filterset is always in it's simplest canonical form.
  80780. for (id in this.filters) {
  80781. clone.filters[id] = this.filters[id];
  80782. }
  80783. // Only add new filters that actually change the filter.
  80784. while (id = additions.shift()) {
  80785. clone.add(id);
  80786. }
  80787. return clone;
  80788. }
  80789. addable(filter) {
  80790. var key = filter.key.toString(),
  80791. value = filter.val.toString();
  80792. if (value.match(/^[0-9]+(\.[0-9]*)?_match/)) {value = parseFloat(value);}
  80793. switch (filter.op) {
  80794. case '=':
  80795. // if there is already foo= and we're adding foo=
  80796. if (this.filters[key + '='] !== undefined) {
  80797. if (this.filters[key + '='].val.toString() != value) {
  80798. return false;
  80799. } else {
  80800. return null;
  80801. }
  80802. }
  80803. if (this.filters[key + '!=' + value] !== undefined) {return false;}
  80804. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  80805. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  80806. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
  80807. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
  80808. return true;
  80809. case '=~':
  80810. return true;
  80811. case '!=':
  80812. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val === value) ? false : null;}
  80813. if (this.filters[key + '!=' + value] !== undefined) {return null;}
  80814. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  80815. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  80816. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
  80817. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
  80818. return true;
  80819. case '>':
  80820. if (key + '=' in this.filters) {
  80821. if (this.filters[key + '='].val <= value) {
  80822. return false;
  80823. } else {
  80824. return null;
  80825. }
  80826. }
  80827. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  80828. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return false;}
  80829. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  80830. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
  80831. return true;
  80832. case '>=':
  80833. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val < value) ? false : null;}
  80834. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  80835. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
  80836. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  80837. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return null;}
  80838. return true;
  80839. case '<':
  80840. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val >= value) ? false : null;}
  80841. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  80842. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return false;}
  80843. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  80844. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
  80845. return true;
  80846. case '<=':
  80847. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val > value) ? false : null;}
  80848. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  80849. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
  80850. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  80851. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return null;}
  80852. return true;
  80853. default:
  80854. break;
  80855. }
  80856. }
  80857. conflict(filter) {
  80858. var key = filter.key.toString(),
  80859. value = filter.val.toString();
  80860. if (!isNaN(parseFloat(value))) {value = parseFloat(value);}
  80861. // if (a=b) && (a=c)
  80862. // if (a=b) && (a!=b)
  80863. // or (a!=b) && (a=b)
  80864. if ((filter.op === '=' && this.filters[key + '='] !== undefined &&
  80865. value != this.filters[key + '='].val.toString()) ||
  80866. (filter.op === '!=' && this.filters[key + '='] !== undefined &&
  80867. value == this.filters[key + '='].val.toString()) ||
  80868. (filter.op === '=' && this.filters[key + '!='] !== undefined &&
  80869. value === this.filters[key + '!='].val.toString())) {
  80870. return filter.toString() + ' added to ' + this.toString() + ' produces an invalid filter';
  80871. }
  80872. return false;
  80873. }
  80874. add(filter, env) {
  80875. var key = filter.key.toString(),
  80876. op = filter.op,
  80877. conflict = this.conflict(filter),
  80878. numval;
  80879. if (conflict) {return conflict;}
  80880. if (op === '=') {
  80881. for (var i in this.filters) {
  80882. if (this.filters[i].key === key) {delete this.filters[i];}
  80883. }
  80884. this.filters[key + '='] = filter;
  80885. } else if (op === '!=') {
  80886. this.filters[key + '!=' + filter.val] = filter;
  80887. } else if (op === '=~') {
  80888. this.filters[key + '=~' + filter.val] = filter;
  80889. } else if (op === '>') {
  80890. // If there are other filters that are also >
  80891. // but are less than this one, they don't matter, so
  80892. // remove them.
  80893. for (var j in this.filters) {
  80894. if (this.filters[j].key === key && this.filters[j].val <= filter.val) {
  80895. delete this.filters[j];
  80896. }
  80897. }
  80898. this.filters[key + '>'] = filter;
  80899. } else if (op === '>=') {
  80900. for (var k in this.filters) {
  80901. numval = (+this.filters[k].val.toString());
  80902. if (this.filters[k].key === key && numval < filter.val) {
  80903. delete this.filters[k];
  80904. }
  80905. }
  80906. if (this.filters[key + '!=' + filter.val] !== undefined) {
  80907. delete this.filters[key + '!=' + filter.val];
  80908. filter.op = '>';
  80909. this.filters[key + '>'] = filter;
  80910. } else {
  80911. this.filters[key + '>='] = filter;
  80912. }
  80913. } else if (op === '<') {
  80914. for (var l in this.filters) {
  80915. numval = (+this.filters[l].val.toString());
  80916. if (this.filters[l].key === key && numval >= filter.val) {
  80917. delete this.filters[l];
  80918. }
  80919. }
  80920. this.filters[key + '<'] = filter;
  80921. } else if (op === '<=') {
  80922. for (var m in this.filters) {
  80923. numval = (+this.filters[m].val.toString());
  80924. if (this.filters[m].key === key && numval > filter.val) {
  80925. delete this.filters[m];
  80926. }
  80927. }
  80928. if (this.filters[key + '!=' + filter.val] !== undefined) {
  80929. delete this.filters[key + '!=' + filter.val];
  80930. filter.op = '<';
  80931. this.filters[key + '<'] = filter;
  80932. } else {
  80933. this.filters[key + '<='] = filter;
  80934. }
  80935. }
  80936. }
  80937. };
  80938. CartoCSS.Tree.Fontset = class Fontset {
  80939. constructor(env, fonts) {
  80940. this.fonts = fonts;
  80941. this.name = 'fontset-' + env.effects.length;
  80942. }
  80943. };
  80944. CartoCSS.Tree.Invalid = class Invalid {
  80945. constructor(chunk, index, message) {
  80946. this.is = 'invalid';
  80947. this.chunk = chunk;
  80948. this.index = index;
  80949. this.type = 'syntax';
  80950. this.message = message || "Invalid code: " + this.chunk;
  80951. }
  80952. ev(env) {
  80953. env.error({
  80954. chunk: this.chunk,
  80955. index: this.index,
  80956. type: 'syntax',
  80957. message: this.message || "Invalid code: " + this.chunk
  80958. });
  80959. return {
  80960. is: 'undefined'
  80961. };
  80962. }
  80963. };
  80964. CartoCSS.Tree.Keyword = class Keyword {
  80965. ev() {
  80966. return this;
  80967. }
  80968. constructor(value) {
  80969. this.value = value;
  80970. var special = {
  80971. 'transparent': 'color',
  80972. 'true': 'boolean',
  80973. 'false': 'boolean'
  80974. };
  80975. this.is = special[value] ? special[value] : 'keyword';
  80976. }
  80977. toString() {
  80978. return this.value;
  80979. }
  80980. };
  80981. /*Layer:class Invalid ),*/
  80982. CartoCSS.Tree.Literal = class Literal {
  80983. constructor(content) {
  80984. this.value = content || '';
  80985. this.is = 'field';
  80986. }
  80987. toString() {
  80988. return this.value;
  80989. }
  80990. 'ev'() {
  80991. return this;
  80992. }
  80993. };
  80994. CartoCSS.Tree.Operation = class Operation {
  80995. constructor(op, operands, index) {
  80996. this.is = 'operation';
  80997. this.op = op.trim();
  80998. this.operands = operands;
  80999. this.index = index;
  81000. }
  81001. ev(env) {
  81002. var a = this.operands[0].ev(env),
  81003. b = this.operands[1].ev(env),
  81004. temp;
  81005. if (a.is === 'undefined' || b.is === 'undefined') {
  81006. return {
  81007. is: 'undefined',
  81008. value: 'undefined'
  81009. };
  81010. }
  81011. if (a instanceof CartoCSS.Tree.Dimension && b instanceof CartoCSS.Tree.Color) {
  81012. if (this.op === '*' || this.op === '+') {
  81013. temp = b;
  81014. b = a;
  81015. a = temp;
  81016. } else {
  81017. env.error({
  81018. name: "OperationError",
  81019. message: "Can't substract or divide a color from a number",
  81020. index: this.index
  81021. });
  81022. }
  81023. }
  81024. // Only concatenate plain strings, because this is easily
  81025. // pre-processed
  81026. if (a instanceof CartoCSS.Tree.Quoted && b instanceof CartoCSS.Tree.Quoted && this.op !== '+') {
  81027. env.error({
  81028. message: "Can't subtract, divide, or multiply strings.",
  81029. index: this.index,
  81030. type: 'runtime',
  81031. filename: this.filename
  81032. });
  81033. return {
  81034. is: 'undefined',
  81035. value: 'undefined'
  81036. };
  81037. }
  81038. // Fields, literals, dimensions, and quoted strings can be combined.
  81039. if (a instanceof CartoCSS.Tree.Field || b instanceof CartoCSS.Tree.Field ||
  81040. a instanceof CartoCSS.Tree.Literal || b instanceof CartoCSS.Tree.Literal) {
  81041. if (a.is === 'color' || b.is === 'color') {
  81042. env.error({
  81043. message: "Can't subtract, divide, or multiply colors in expressions.",
  81044. index: this.index,
  81045. type: 'runtime',
  81046. filename: this.filename
  81047. });
  81048. return {
  81049. is: 'undefined',
  81050. value: 'undefined'
  81051. };
  81052. } else {
  81053. return new CartoCSS.Tree.Literal(a.ev(env).toString(true) + this.op + b.ev(env).toString(true));
  81054. }
  81055. }
  81056. if (a.operate === undefined) {
  81057. env.error({
  81058. message: 'Cannot do math with type ' + a.is + '.',
  81059. index: this.index,
  81060. type: 'runtime',
  81061. filename: this.filename
  81062. });
  81063. return {
  81064. is: 'undefined',
  81065. value: 'undefined'
  81066. };
  81067. }
  81068. return a.operate(env, this.op, b);
  81069. }
  81070. };
  81071. CartoCSS.Tree.Quoted = class Quoted {
  81072. constructor(content) {
  81073. this.is = 'string';
  81074. this.value = content || '';
  81075. }
  81076. toString(quotes) {
  81077. var escapedValue = this.value
  81078. .replace(/&/g, '&amp;')
  81079. var xmlvalue = escapedValue
  81080. .replace(/\'/g, '\\\'')
  81081. .replace(/\"/g, '&quot;')
  81082. .replace(/</g, '&lt;')
  81083. .replace(/\>/g, '&gt;');
  81084. return (quotes === true) ? "'" + xmlvalue + "'" : escapedValue;
  81085. }
  81086. ev() {
  81087. return this;
  81088. }
  81089. operate(env, op, other) {
  81090. return new CartoCSS.Tree.Quoted(CartoCSS.Tree.operate(op, this.toString(), other.toString(this.contains_field)));
  81091. }
  81092. };
  81093. CartoCSS.Tree.Reference = {
  81094. _validateValue: {
  81095. 'font': function (env, value) {
  81096. if (env.validation_data && env.validation_data.fonts) {
  81097. return env.validation_data.fonts.indexOf(value) != -1;
  81098. } else {
  81099. return true;
  81100. }
  81101. }
  81102. },
  81103. setData: function (data) {
  81104. this.data = data;
  81105. this.selector_cache = generateSelectorCache(data);
  81106. this.mapnikFunctions = generateMapnikFunctions(data);
  81107. this.required_cache = generateRequiredProperties(data);
  81108. function generateSelectorCache(data) {
  81109. var index = {};
  81110. for (var i in data.symbolizers) {
  81111. for (var j in data.symbolizers[i]) {
  81112. if (data.symbolizers[i][j].hasOwnProperty('css')) {
  81113. index[data.symbolizers[i][j].css] = [data.symbolizers[i][j], i, j];
  81114. }
  81115. }
  81116. }
  81117. return index;
  81118. }
  81119. function generateMapnikFunctions(data) {
  81120. var functions = {};
  81121. for (var i in data.symbolizers) {
  81122. for (var j in data.symbolizers[i]) {
  81123. if (data.symbolizers[i][j].type === 'functions') {
  81124. for (var k = 0; k < data.symbolizers[i][j].functions.length; k++) {
  81125. var fn = data.symbolizers[i][j].functions[k];
  81126. functions[fn[0]] = fn[1];
  81127. }
  81128. }
  81129. }
  81130. }
  81131. return functions;
  81132. }
  81133. function generateRequiredProperties(data) {
  81134. var cache = {};
  81135. for (var symbolizer_name in data.symbolizers) {
  81136. cache[symbolizer_name] = [];
  81137. for (var j in data.symbolizers[symbolizer_name]) {
  81138. if (data.symbolizers[symbolizer_name][j].required) {
  81139. cache[symbolizer_name].push(data.symbolizers[symbolizer_name][j].css);
  81140. }
  81141. }
  81142. }
  81143. return cache;
  81144. }
  81145. },
  81146. setVersion: function (version) {
  81147. if (CartoCSS.mapnik_reference.version.hasOwnProperty(version)) {
  81148. this.setData(CartoCSS.mapnik_reference.version[version]);
  81149. return true;
  81150. }
  81151. return false;
  81152. },
  81153. selectorData: function (selector, i) {
  81154. if (this.selector_cache && this.selector_cache[selector]) {return this.selector_cache[selector][i];}
  81155. },
  81156. validSelector: function (selector) {
  81157. return !!this.selector_cache[selector];
  81158. },
  81159. selectorName: function (selector) {
  81160. return this.selectorData(selector, 2);
  81161. },
  81162. selector: function (selector) {
  81163. return this.selectorData(selector, 0);
  81164. },
  81165. symbolizer: function (selector) {
  81166. return this.selectorData(selector, 1);
  81167. },
  81168. requiredProperties: function (symbolizer_name, rules) {
  81169. var req = this.required_cache[symbolizer_name];
  81170. for (var i in req) {
  81171. if (!(req[i] in rules)) {
  81172. return 'Property ' + req[i] + ' required for defining ' +
  81173. symbolizer_name + ' styles.';
  81174. }
  81175. }
  81176. },
  81177. isFont: function (selector) {
  81178. return this.selector(selector).validate === 'font';
  81179. },
  81180. editDistance: function (a, b) {
  81181. if (a.length === 0) {return b.length;}
  81182. if (b.length === 0) {return a.length;}
  81183. var matrix = [];
  81184. for (var i = 0; i <= b.length; i++) {
  81185. matrix[i] = [i];
  81186. }
  81187. for (var j = 0; j <= a.length; j++) {
  81188. matrix[0][j] = j;
  81189. }
  81190. for (i = 1; i <= b.length; i++) {
  81191. for (j = 1; j <= a.length; j++) {
  81192. if (b.charAt(i - 1) === a.charAt(j - 1)) {
  81193. matrix[i][j] = matrix[i - 1][j - 1];
  81194. } else {
  81195. matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
  81196. Math.min(matrix[i][j - 1] + 1, // insertion
  81197. matrix[i - 1][j] + 1)); // deletion
  81198. }
  81199. }
  81200. }
  81201. return matrix[b.length][a.length];
  81202. },
  81203. validValue: function (env, selector, value) {
  81204. function validateFunctions(value, selector) {
  81205. if (value.value[0].is === 'string') {return true;}
  81206. for (var i in value.value) {
  81207. for (var j in value.value[i].value) {
  81208. if (value.value[i].value[j].is !== 'call') {return false;}
  81209. var f = find(this.selector(selector).functions, function (x) {//NOSONAR
  81210. return x[0] === value.value[i].value[j].name;
  81211. });
  81212. if (!(f && f[1] === -1)) {
  81213. // This filter is unknown or given an incorrect number of arguments
  81214. if (!f || f[1] !== value.value[i].value[j].args.length) {return false;}
  81215. }
  81216. }
  81217. }
  81218. return true;
  81219. }
  81220. function validateKeyword(value, selector) {
  81221. if (typeof this.selector(selector).type === 'object') {
  81222. return this.selector(selector).type
  81223. .indexOf(value.value[0].value) !== -1;
  81224. } else {
  81225. // allow unquoted keywords as strings
  81226. return this.selector(selector).type === 'string';
  81227. }
  81228. }
  81229. var i;
  81230. if (!this.selector(selector)) {
  81231. return false;
  81232. } else if (value.value[0].is === 'keyword') {
  81233. return validateKeyword(value, selector);
  81234. } else if (value.value[0].is === 'undefined') {
  81235. // caught earlier in the chain - ignore here so that
  81236. // error is not overridden
  81237. return true;
  81238. } else if (this.selector(selector).type === 'numbers') {
  81239. for (i in value.value) {
  81240. if (value.value[i].is !== 'float') {
  81241. return false;
  81242. }
  81243. }
  81244. return true;
  81245. } else if (this.selector(selector).type === 'tags') {
  81246. if (!value.value) {return false;}
  81247. if (!value.value[0].value) {
  81248. return value.value[0].is === 'tag';
  81249. }
  81250. for (i = 0; i < value.value[0].value.length; i++) {
  81251. if (value.value[0].value[i].is !== 'tag') {return false;}
  81252. }
  81253. return true;
  81254. } else if (this.selector(selector).type == 'functions') {
  81255. // For backwards compatibility, you can specify a string for `functions`-compatible
  81256. // values, though they will not be validated.
  81257. return validateFunctions(value, selector);
  81258. } else if (this.selector(selector).type === 'expression') {
  81259. return true;
  81260. } else if (this.selector(selector).type === 'unsigned') {
  81261. if (value.value[0].is === 'float') {
  81262. value.value[0].round();
  81263. return true;
  81264. } else {
  81265. return false;
  81266. }
  81267. } else {
  81268. if (this.selector(selector).validate) {
  81269. var valid = false;
  81270. for (i = 0; i < value.value.length; i++) {
  81271. if (this.selector(selector).type === value.value[i].is &&
  81272. this._validateValue[this.selector(selector).validate](env, value.value[i].value)) {
  81273. return true;
  81274. }
  81275. }
  81276. return valid;
  81277. } else {
  81278. return this.selector(selector).type === value.value[0].is;
  81279. }
  81280. }
  81281. }
  81282. };
  81283. CartoCSS.Tree.Reference.setVersion("latest");
  81284. CartoCSS.Tree.Rule = class Rule {
  81285. constructor(name, value, index, filename) {
  81286. this.is = 'rule';
  81287. var parts = name.split('/');
  81288. this.name = parts.pop();
  81289. this.instance = parts.length ? parts[0] : '__default__';
  81290. this.value = (value instanceof CartoCSS.Tree.Value) ?
  81291. value : new CartoCSS.Tree.Value([value]);
  81292. this.index = index;
  81293. this.symbolizer = CartoCSS.Tree.Reference.symbolizer(this.name);
  81294. this.filename = filename;
  81295. this.variable = (name.charAt(0) === '@');
  81296. }
  81297. clone() {
  81298. var clone = Object.create(CartoCSS.Tree.Rule.prototype);
  81299. clone.name = this.name;
  81300. clone.value = this.value;
  81301. clone.index = this.index;
  81302. clone.instance = this.instance;
  81303. clone.symbolizer = this.symbolizer;
  81304. clone.filename = this.filename;
  81305. clone.variable = this.variable;
  81306. return clone;
  81307. }
  81308. updateID() {
  81309. return this.id = this.zoom + '#' + this.instance + '#' + this.name;
  81310. }
  81311. toString() {
  81312. return '[' + CartoCSS.Tree.Zoom.toString(this.zoom) + '] ' + this.name + ': ' + this.value;
  81313. }
  81314. ev(context) {
  81315. return new CartoCSS.Tree.Rule(this.name,
  81316. this.value.ev(context),
  81317. this.index,
  81318. this.filename);
  81319. }
  81320. };
  81321. CartoCSS.Tree.Ruleset = class Ruleset {
  81322. constructor(selectors, rules) {
  81323. this.is = 'ruleset';
  81324. this.selectors = selectors;
  81325. this.rules = rules;
  81326. // static cache of find() function
  81327. this._lookups = {};
  81328. }
  81329. ev(env) {
  81330. var i,
  81331. rule,
  81332. ruleset = new CartoCSS.Tree.Ruleset(this.selectors, this.rules.slice(0));
  81333. ruleset.root = this.root;
  81334. // push the current ruleset to the frames stack
  81335. env.frames.unshift(ruleset);
  81336. // Evaluate everything else
  81337. for (i = 0, rule; i < ruleset.rules.length; i++) {
  81338. rule = ruleset.rules[i];
  81339. ruleset.rules[i] = rule.ev ? rule.ev(env) : rule;
  81340. }
  81341. // Pop the stack
  81342. env.frames.shift();
  81343. return ruleset;
  81344. }
  81345. match(args) {
  81346. return !args || args.length === 0;
  81347. }
  81348. variables() {
  81349. if (this._variables) {
  81350. return this._variables;
  81351. } else {
  81352. return this._variables = this.rules.reduce(function (hash, r) {
  81353. if (r instanceof CartoCSS.Tree.Rule && r.variable === true) {
  81354. hash[r.name] = r;
  81355. }
  81356. return hash;
  81357. }, {});
  81358. }
  81359. }
  81360. variable(name) {
  81361. return this.variables()[name];
  81362. }
  81363. rulesets() {
  81364. if (this._rulesets) {
  81365. return this._rulesets;
  81366. } else {
  81367. return this._rulesets = this.rules.filter(function (r) {
  81368. return (r instanceof CartoCSS.Tree.Ruleset);
  81369. });
  81370. }
  81371. }
  81372. find(selector, self) {
  81373. self = self || this;
  81374. var rules = [], match,
  81375. key = selector.toString();
  81376. if (key in this._lookups) {
  81377. return this._lookups[key];
  81378. }
  81379. this.rulesets().forEach(function (rule) {
  81380. if (rule !== self) {
  81381. for (var j = 0; j < rule.selectors.length; j++) {
  81382. match = selector.match(rule.selectors[j]);
  81383. if (match) {
  81384. if (selector.elements.length > 1) {
  81385. Array.prototype.push.apply(rules, rule.find(
  81386. new CartoCSS.Tree.Selector(null, null, selector.elements.slice(1)), self));
  81387. } else {
  81388. rules.push(rule);
  81389. }
  81390. break;
  81391. }
  81392. }
  81393. }
  81394. });
  81395. return this._lookups[key] = rules;
  81396. }
  81397. // Zooms can use variables. This replaces CartoCSS.Tree.Zoom objects on selectors
  81398. // with simple bit-arrays that we can compare easily.
  81399. evZooms(env) {
  81400. for (var i = 0; i < this.selectors.length; i++) {
  81401. var zval = CartoCSS.Tree.Zoom.all;
  81402. for (var z = 0; z < this.selectors[i].zoom.length; z++) {
  81403. zval = this.selectors[i].zoom[z].ev(env).zoom;
  81404. }
  81405. this.selectors[i].zoom = zval;
  81406. }
  81407. }
  81408. flatten(result, parents, env) {
  81409. var selectors = [], i, j;
  81410. if (this.selectors.length === 0) {
  81411. env.frames = env.frames.concat(this.rules);
  81412. }
  81413. // evaluate zoom variables on this object.
  81414. this.evZooms(env);
  81415. for (i = 0; i < this.selectors.length; i++) {
  81416. var child = this.selectors[i];
  81417. if (!child.filters) {
  81418. // This is an invalid filterset.
  81419. continue;
  81420. }
  81421. if (parents.length) {
  81422. for (j = 0; j < parents.length; j++) {
  81423. var parent = parents[j];
  81424. var mergedFilters = parent.filters.cloneWith(child.filters);
  81425. if (mergedFilters === null) {
  81426. // Filters could be added, but they didn't change the
  81427. // filters. This means that we only have to clone when
  81428. // the zoom levels or the attachment is different too.
  81429. if (parent.zoom === child.zoom &&
  81430. parent.attachment === child.attachment &&
  81431. parent.elements.join() === child.elements.join()) {
  81432. selectors.push(parent);
  81433. continue;
  81434. } else {
  81435. mergedFilters = parent.filters;
  81436. }
  81437. } else if (!mergedFilters) {
  81438. // The merged filters are invalid, that means we don't
  81439. // have to clone.
  81440. continue;
  81441. }
  81442. var clone = Object.create(CartoCSS.Tree.Selector.prototype);
  81443. clone.filters = mergedFilters;
  81444. clone.zoom = child.zoom;
  81445. clone.elements = parent.elements.concat(child.elements);
  81446. if (parent.attachment && child.attachment) {
  81447. clone.attachment = parent.attachment + '/' + child.attachment;
  81448. } else {clone.attachment = child.attachment || parent.attachment;}
  81449. clone.conditions = parent.conditions + child.conditions;
  81450. clone.index = child.index;
  81451. selectors.push(clone);
  81452. }
  81453. } else {
  81454. selectors.push(child);
  81455. }
  81456. }
  81457. var rules = [];
  81458. for (i = 0; i < this.rules.length; i++) {
  81459. var rule = this.rules[i];
  81460. // Recursively flatten any nested rulesets
  81461. if (rule instanceof CartoCSS.Tree.Ruleset) {
  81462. rule.flatten(result, selectors, env);
  81463. } else if (rule instanceof CartoCSS.Tree.Rule) {
  81464. rules.push(rule);
  81465. } else if (rule instanceof CartoCSS.Tree.Invalid) {
  81466. env.error(rule);
  81467. }
  81468. }
  81469. var index = rules.length ? rules[0].index : false;
  81470. for (i = 0; i < selectors.length; i++) {
  81471. // For specificity sort, use the position of the first rule to allow
  81472. // defining attachments that are under current element as a descendant
  81473. // selector.
  81474. if (index !== false) {
  81475. selectors[i].index = index;
  81476. }
  81477. result.push(new CartoCSS.Tree.Definition(selectors[i], rules.slice()));
  81478. }
  81479. return result;
  81480. }
  81481. };
  81482. CartoCSS.Tree.Selector = class Selector {
  81483. constructor(filters, zoom, elements, attachment, conditions, index) {
  81484. this.elements = elements || [];
  81485. this.attachment = attachment;
  81486. this.filters = filters || {};
  81487. this.zoom = typeof zoom !== 'undefined' ? zoom : CartoCSS.Tree.Zoom.all;
  81488. this.conditions = conditions;
  81489. this.index = index;
  81490. }
  81491. specificity() {
  81492. return this.elements.reduce(function (memo, e) {
  81493. var spec = e.specificity();
  81494. memo[0] += spec[0];
  81495. memo[1] += spec[1];
  81496. return memo;
  81497. }, [0, 0, this.conditions, this.index]);
  81498. }
  81499. };
  81500. /*style:class Invalid ),*/
  81501. CartoCSS.Tree.URL = class URL {
  81502. constructor(val, paths) {
  81503. this.is = 'uri';
  81504. this.value = val;
  81505. this.paths = paths;
  81506. }
  81507. toString() {
  81508. return this.value.toString();
  81509. }
  81510. ev(ctx) {
  81511. return new CartoCSS.Tree.URL(this.value.ev(ctx), this.paths);
  81512. }
  81513. };
  81514. CartoCSS.Tree.Value = class Value {
  81515. constructor(value) {
  81516. this.is = 'value';
  81517. this.value = value;
  81518. }
  81519. ev(env) {
  81520. if (this.value.length === 1) {
  81521. return this.value[0].ev(env);
  81522. } else {
  81523. return new CartoCSS.Tree.Value(this.value.map(function (v) {
  81524. return v.ev(env);
  81525. }));
  81526. }
  81527. }
  81528. toJS(env) {
  81529. //var v = this.value[0].value[0];
  81530. var val = this.ev(env);
  81531. var v = val.toString();
  81532. if (val.is === "color" || val.is === 'uri' || val.is === 'string' || val.is === 'keyword') {
  81533. v = "'" + v + "'";
  81534. } else if (val.is === 'field') {
  81535. // replace [varuable] by ctx['variable']
  81536. v = v.replace(/\[(.*)\]/g, "attributes['\_match1']")
  81537. } else if (val.value && typeof val.value === "object") {
  81538. v = "[" + v + "]";
  81539. }
  81540. return "_value = " + v + ";";
  81541. }
  81542. toString(env, selector, sep, format) {
  81543. return this.value.map(function (e) {
  81544. return e.toString(env, format);
  81545. }).join(sep || ', ');
  81546. }
  81547. clone() {
  81548. var obj = Object.create(CartoCSS.Tree.Value.prototype);
  81549. if (Array.isArray(obj)) {obj.value = this.value.slice();} else {obj.value = this.value;}
  81550. obj.is = this.is;
  81551. return obj;
  81552. }
  81553. };
  81554. CartoCSS.Tree.Variable = class Variable {
  81555. constructor(name, index, filename) {
  81556. this.is = 'variable';
  81557. this.name = name;
  81558. this.index = index;
  81559. this.filename = filename;
  81560. }
  81561. toString() {
  81562. return this.name;
  81563. }
  81564. ev(env) {
  81565. if (this._css) {return this._css;}
  81566. var thisframe = env.frames.filter(function (f) {
  81567. return f.name === this.name;
  81568. }.bind(this));
  81569. if (thisframe.length) {
  81570. return thisframe[0].value.ev(env);
  81571. } else {
  81572. env.error({
  81573. message: 'variable ' + this.name + ' is undefined',
  81574. index: this.index,
  81575. type: 'runtime',
  81576. filename: this.filename
  81577. });
  81578. return {
  81579. is: 'undefined',
  81580. value: 'undefined'
  81581. };
  81582. }
  81583. }
  81584. };
  81585. CartoCSS.Tree.Zoom = class Zoom {
  81586. constructor(op, value, index) {
  81587. this.op = op;
  81588. this.value = value;
  81589. this.index = index;
  81590. }
  81591. setZoom(zoom) {
  81592. this.zoom = zoom;
  81593. return this;
  81594. }
  81595. ev(env) {
  81596. var value = parseInt(this.value.ev(env).toString(), 10);
  81597. if (value > CartoCSS.Tree.Zoom.maxZoom || value < 0) {
  81598. env.error({
  81599. message: 'Only zoom levels between 0 and ' +
  81600. CartoCSS.Tree.Zoom.maxZoom + ' supported.',
  81601. index: this.index
  81602. });
  81603. }
  81604. switch (this.op) {
  81605. case '=':
  81606. this.zoom = "zoom && zoom === " + value;
  81607. return this;
  81608. case '>':
  81609. this.zoom = "zoom && zoom > " + value;
  81610. break;
  81611. case '>=':
  81612. this.zoom = "zoom && zoom >= " + value;
  81613. break;
  81614. case '<':
  81615. this.zoom = "zoom && zoom < " + value;
  81616. break;
  81617. case '<=':
  81618. this.zoom = "zoom && zoom <= " + value;
  81619. break;
  81620. default:
  81621. break;
  81622. }
  81623. /*
  81624. for (var i = 0; i <= CartoCSS.Tree.Zoom.maxZoom; i++) {
  81625. if (i >= start && i <= end) {
  81626. zoom |= (1 << i);
  81627. }
  81628. }
  81629. this.zoom = zoom;
  81630. this.zoom=value+this.op+"zoom";*/
  81631. return this;
  81632. }
  81633. toString() {
  81634. var str = '';
  81635. for (var i = 0; i <= CartoCSS.Tree.Zoom.maxZoom; i++) {
  81636. str += (this.zoom & (1 << i)) ? 'X' : '.';
  81637. }
  81638. return str;
  81639. }
  81640. };
  81641. // Covers all zoomlevels from 0 to 22
  81642. CartoCSS.Tree.Zoom.all = 23;
  81643. CartoCSS.Tree.Zoom.maxZoom = 22;
  81644. CartoCSS.Tree.Zoom.ranges = {
  81645. 0: 1000000000,
  81646. 1: 500000000,
  81647. 2: 200000000,
  81648. 3: 100000000,
  81649. 4: 50000000,
  81650. 5: 25000000,
  81651. 6: 12500000,
  81652. 7: 6500000,
  81653. 8: 3000000,
  81654. 9: 1500000,
  81655. 10: 750000,
  81656. 11: 400000,
  81657. 12: 200000,
  81658. 13: 100000,
  81659. 14: 50000,
  81660. 15: 25000,
  81661. 16: 12500,
  81662. 17: 5000,
  81663. 18: 2500,
  81664. 19: 1500,
  81665. 20: 750,
  81666. 21: 500,
  81667. 22: 250,
  81668. 23: 100
  81669. };
  81670. ;// CONCATENATED MODULE: ./src/common/style/ThemeStyle.js
  81671. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  81672. * This program are made available under the terms of the Apache License, Version 2.0
  81673. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81674. /**
  81675. * @class ThemeStyle
  81676. * @deprecatedclass SuperMap.ThemeStyle
  81677. * @classdesc 客户端专题图风格类。
  81678. * @modulecategory Overlay
  81679. * @category Visualization Theme
  81680. * @param {Object} options - 可选参数。
  81681. * @param {boolean} [options.fill=true] - 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  81682. * @param {string} [options.fillColor='#000000'] - 十六进制填充颜色。
  81683. * @param {number} [options.fillOpacity=1] - 填充不透明度。取值范围[0, 1]。
  81684. * @param {boolean} [options.stroke=false] - 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  81685. * @param {string} [options.strokeColor='#000000'] - 十六进制描边颜色。
  81686. * @param {number} [options.strokeOpacity=1] - 描边的不透明度。取值范围[0, 1]。
  81687. * @param {number} [options.strokeWidth=1] - 线宽度/描边宽度。
  81688. * @param {string} [options.strokeLinecap='butt'] - 线帽样式。strokeLinecap 有三种类型 “butt", "round", "square"。
  81689. * @param {string} [options.strokeLineJoin='iter'] - 线段连接样式。strokeLineJoin 有三种类型 “miter", "round", "bevel"。
  81690. * @param {string} [options.strokeDashstyle='solid'] - 虚线类型。strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"。solid 表示实线。
  81691. * @param {number} [options.pointRadius=6] - 点半径,单位为像素。
  81692. * @param {number} [options.shadowBlur=0] - 阴影模糊度,(大于 0 有效)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  81693. * @param {string} [options.shadowColor='#000000'] - 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  81694. * @param {number} [options.shadowOffsetX=0] - 阴影 X 方向偏移值。
  81695. * @param {number} [options.shadowOffsetY=0] - 阴影 Y 方向偏移值。
  81696. * @param {string} options.label - 专题要素附加文本标签内容。
  81697. * @param {string} [options.fontColor] - 附加文本字体颜色。
  81698. * @param {number} [options.fontSize=12] - 附加文本字体大小,单位是像素。
  81699. * @param {string} [options.fontStyle='normal'] - 附加文本字体样式。可设值:"normal", "italic", "oblique"。
  81700. * @param {string} [options.fontVariant='normal'] - 附加文本字体变体。可设值:"normal", "small-caps"。
  81701. * @param {string} [options.fontWeight='normal'] - 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
  81702. * @param {string} [options.fontFamily='arial,sans-serif'] - 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,
  81703. * 浏览器会使用它可识别的第一个可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称
  81704. * ("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
  81705. * @param {string} [options.labelPosition='top'] - 附加文本位置,可以是 'inside', 'left', 'right', 'top', 'bottom'。
  81706. * @param {string} [options.labelAlign='center'] - 附加文本水平对齐。可以是 'left', 'right', 'center'。
  81707. * @param {string} [options.labelBaseline='middle'] - 附加文本垂直对齐。可以是 'top', 'bottom', 'middle' 。
  81708. * @param {number} [options.labelXOffset=0] - 附加文本在x轴方向的偏移量。
  81709. * @param {number} [options.labelYOffset=0] - 附加文本在y轴方向的偏移量。
  81710. * @usage
  81711. */
  81712. class ThemeStyle {
  81713. constructor(options) {
  81714. options = options || {};
  81715. /**
  81716. * @member {boolean} [ThemeStyle.prototype.fill=true]
  81717. * @description 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  81718. */
  81719. this.fill = true;
  81720. /**
  81721. * @member {string} [ThemeStyle.prototype.fillColor="#000000"]
  81722. * @description 十六进制填充颜色。
  81723. */
  81724. this.fillColor = "#000000";
  81725. /**
  81726. * @member {number} [ThemeStyle.prototype.fillOpacity=1]
  81727. * @description 填充不透明度。取值范围[0, 1]。
  81728. */
  81729. this.fillOpacity = 1;
  81730. /**
  81731. * @member {boolean} [ThemeStyle.prototype.stroke=false]
  81732. * @description 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  81733. */
  81734. this.stroke = false;
  81735. /**
  81736. * @member {string} [ThemeStyle.prototype.strokeColor="#000000"]
  81737. * @description 十六进制描边颜色。
  81738. */
  81739. this.strokeColor = "#000000";
  81740. /**
  81741. * @member {number} [ThemeStyle.prototype.strokeOpacity=1]
  81742. * @description 描边的不透明度。取值范围[0, 1]。
  81743. */
  81744. this.strokeOpacity = 1;
  81745. /**
  81746. * @member {number} [ThemeStyle.prototype.strokeWidth=1]
  81747. * @description 线宽度/描边宽度。
  81748. */
  81749. this.strokeWidth = 1;
  81750. /**
  81751. * @member {string} [ThemeStyle.prototype.strokeLinecap="butt"]
  81752. * @description 线帽样式;strokeLinecap 有三种类型 “butt", "round", "square" 。
  81753. */
  81754. this.strokeLinecap = "butt";
  81755. /**
  81756. * @member {string} [ThemeStyle.prototype.strokeLineJoin="miter"]
  81757. * @description 线段连接样式;strokeLineJoin 有三种类型 “miter", "round", "bevel"。
  81758. */
  81759. this.strokeLineJoin = "miter";
  81760. /**
  81761. * @member {string} [ThemeStyle.prototype.strokeDashstyle="solid"]
  81762. * @description 虚线类型;strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted";
  81763. * solid 表示实线。
  81764. */
  81765. this.strokeDashstyle = "solid";
  81766. /**
  81767. * @member {number} [ThemeStyle.prototype.pointRadius=6]
  81768. * @description 点半径。单位为像素。
  81769. */
  81770. this.pointRadius = 6;
  81771. /**
  81772. * @member {number} [ThemeStyle.prototype.shadowBlur=0]
  81773. * @description 阴影模糊度,(大于 0 有效)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  81774. */
  81775. this.shadowBlur = 0;
  81776. /**
  81777. * @member {string} [ThemeStyle.prototype.shadowColor='#000000']
  81778. * @description 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  81779. */
  81780. this.shadowColor = "#000000";
  81781. /**
  81782. * @member {number} [ThemeStyle.prototype.shadowOffsetX=0]
  81783. * @description 阴影 X 方向偏移值。
  81784. */
  81785. this.shadowOffsetX = 0;
  81786. /**
  81787. * @member {number} ThemeStyle.prototype.shadowOffsetY
  81788. * @description Y 方向偏移值。
  81789. */
  81790. this.shadowOffsetY = 0;
  81791. /**
  81792. * @member {string} [ThemeStyle.prototype.label]
  81793. * @description 专题要素附加文本标签内容。
  81794. */
  81795. this.label = "";
  81796. /**
  81797. * @member {boolean} [ThemeStyle.prototype.labelRect=false]
  81798. * @description 是否显示文本标签矩形背景。
  81799. */
  81800. this.labelRect = false;
  81801. /**
  81802. * @member {string} [ThemeStyle.prototype.fontColor]
  81803. * @description 附加文本字体颜色。
  81804. */
  81805. this.fontColor = "";
  81806. /**
  81807. * @member {number} [ThemeStyle.prototype.fontSize=12]
  81808. * @description 附加文本字体大小,单位是像素。
  81809. */
  81810. this.fontSize = 12;
  81811. /**
  81812. * @member {string} [ThemeStyle.prototype.fontStyle="normal"]
  81813. * @description 附加文本字体样式。可设值:"normal", "italic", "oblique"。
  81814. */
  81815. this.fontStyle = "normal";
  81816. /**
  81817. * @member {string} [ThemeStyle.prototype.fontVariant="normal"]
  81818. * @description 附加文本字体变体。可设值:"normal", "small-caps"。
  81819. */
  81820. this.fontVariant = "normal";
  81821. /**
  81822. * @member {string} [ThemeStyle.prototype.fontWeight="normal"]
  81823. * @description 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
  81824. */
  81825. this.fontWeight = "normal";
  81826. /**
  81827. * @member {string} [ThemeStyle.prototype.fontFamily="arial,sans-serif"]
  81828. * @description 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,浏览器会使用它可识别的第一个
  81829. * 可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
  81830. */
  81831. this.fontFamily = "arial,sans-serif";
  81832. /**
  81833. * @member {string} [ThemeStyle.prototype.labelPosition='top']
  81834. * @description 附加文本位置,可以是 'inside', 'left', 'right', 'top', 'bottom'。
  81835. */
  81836. this.labelPosition = "top";
  81837. /**
  81838. * @member {string} [ThemeStyle.prototype.labelAlign='center']
  81839. * @description 附加文本水平对齐。可以是 'left', 'right', 'center'。
  81840. */
  81841. this.labelAlign = "center";
  81842. /**
  81843. * @member {string} [ThemeStyle.prototype.labelBaseline='middle']
  81844. * @description 附加文本垂直对齐。可以是 'top', 'bottom', 'middle'。
  81845. */
  81846. this.labelBaseline = "middle";
  81847. /**
  81848. * @member {number} [ThemeStyle.prototype.labelXOffset=0]
  81849. * @description 附加文本在 X 轴方向的偏移量。
  81850. */
  81851. this.labelXOffset = 0;
  81852. /**
  81853. * @member {number} [ThemeStyle.prototype.labelYOffset=0]
  81854. * @description 附加文本在 Y 轴方向的偏移量。
  81855. */
  81856. this.labelYOffset = 0;
  81857. Util_Util.extend(this, options);
  81858. }
  81859. }
  81860. ;// CONCATENATED MODULE: ./src/common/style/index.js
  81861. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  81862. * This program are made available under the terms of the Apache License, Version 2.0
  81863. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81864. ;// CONCATENATED MODULE: ./src/common/overlay/Graph.js
  81865. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  81866. * This program are made available under the terms of the Apache License, Version 2.0
  81867. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81868. /**
  81869. * @class FeatureThemeGraph
  81870. * @aliasclass Feature.Theme.Graph
  81871. * @deprecatedclass SuperMap.Feature.Theme.Graph
  81872. * @category Visualization Theme
  81873. * @classdesc 统计专题要素基类。
  81874. * 此类定义了统计专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
  81875. * 统计专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <FeatureThemeGraph.setting> 的基础属性只有 7 个,
  81876. * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
  81877. * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
  81878. * @extends FeatureTheme
  81879. * @param {FeatureVector} data - 用户数据。
  81880. * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层。
  81881. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  81882. * @param {Object} setting - 图表配置对象。
  81883. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  81884. * @usage
  81885. */
  81886. class Graph_Graph extends Theme {
  81887. constructor(data, layer, fields, setting, lonlat, options) {
  81888. super(data, layer, fields, setting, lonlat, options);
  81889. /**
  81890. * @member {FeatureShapeFactory} FeatureThemeGraph.prototype.shapeFactory
  81891. * @description 内置的图形工厂对象,调用其 createShape 方法创建图形。
  81892. */
  81893. this.shapeFactory = new ShapeFactory();
  81894. /**
  81895. * @member {Object} FeatureThemeGraph.prototype.shapeParameters
  81896. * @description 当前图形参数对象,<{@link ShapeParameters}> 的子类对象。
  81897. */
  81898. this.shapeParameters = null;
  81899. /**
  81900. * @member {boolean} [FeatureThemeGraph.prototype.RelativeCoordinate]
  81901. * @description 图形是否已经计算了相对坐标。
  81902. */
  81903. this.RelativeCoordinate = false;
  81904. /**
  81905. * @member {Object} FeatureThemeGraph.prototype.setting
  81906. * @description 图表配置对象,该对象控制着图表的可视化显示。
  81907. * @param {number} width - 专题要素(图表)宽度。
  81908. * @param {number} height - 专题要素(图表)高度。
  81909. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  81910. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  81911. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  81912. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox
  81913. * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  81914. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。
  81915. * 如果不设置此参数,在取数据值时不对数据做小数位处理。
  81916. *
  81917. */
  81918. this.setting = null;
  81919. /**
  81920. * @readonly
  81921. * @member {Array.<number>} FeatureThemeGraph.prototype.origonPoint
  81922. * @description 专题要素(图表)原点,图表左上角点像素坐标,是长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  81923. */
  81924. this.origonPoint = null;
  81925. /**
  81926. * @readonly
  81927. * @member {Array.<number>} FeatureThemeGraph.prototype.chartBox
  81928. * @description 专题要素(图表)区域,即图表框,长度为 4 的一维数组,数组的 4 个元素依次表示图表框左端 x 坐标值、
  81929. * 下端 y坐标值、右端 x坐标值、上端 y 坐标值;[left, bottom, right, top]。
  81930. */
  81931. this.chartBox = null;
  81932. /**
  81933. * @readonly
  81934. * @member {Bounds} FeatureThemeGraph.prototype.chartBounds
  81935. * @description 图表 Bounds 随着 lonlat、XOffset、YOffset 更新,注意 chartBounds 是图表像素范围,不是地理范围。
  81936. */
  81937. this.chartBounds = null;
  81938. /**
  81939. * @readonly
  81940. * @member {number} FeatureThemeGraph.prototype.width
  81941. * @description 专题要素(图表)宽度 。
  81942. */
  81943. this.width = null;
  81944. /**
  81945. * @readonly
  81946. * @member {number} FeatureThemeGraph.prototype.height
  81947. * @description 专题要素(图表)高度 。
  81948. */
  81949. this.height = null;
  81950. /**
  81951. * @readonly
  81952. * @member {number} FeatureThemeGraph.prototype.XOffset
  81953. * @description 专题要素(图表)在 X 方向上的偏移值,单位像素。
  81954. */
  81955. this.XOffset = 0;
  81956. /**
  81957. * @readonly
  81958. * @member {number} FeatureThemeGraph.prototype.YOffset
  81959. * @description 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  81960. */
  81961. this.YOffset = 0;
  81962. /**
  81963. * @readonly
  81964. * @member {Array.<number>} FeatureThemeGraph.prototype.DVBParameter
  81965. * @description 数据视图框参数,长度为 4 的一维数组(数组元素值 >= 0),[leftOffset, bottomOffset, rightOffset, topOffset],chartBox 内偏距值。
  81966. * 此属性用于指定数据视图框 dataViewBox 的范围。
  81967. */
  81968. this.DVBParameter = null;
  81969. /**
  81970. * @readonly
  81971. * @member {Array.<number>} FeatureThemeGraph.prototype.dataViewBox
  81972. * @description 数据视图框,长度为 4 的一维数组,[left, bottom, right, top]。
  81973. * dataViewBox 是统计专题要素最核心的内容,它负责解释数据在一个像素区域里的数据可视化含义,
  81974. * 这种含义用可视化图形表达出来,这些表示数据的图形和一些辅助图形组合在一起构成统计专题图表。
  81975. */
  81976. this.dataViewBox = null;
  81977. /**
  81978. * @readonly
  81979. * @member {Array.<number>} FeatureThemeGraph.prototype.DVBCodomain
  81980. * @description 数据视图框的内允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  81981. * dataViewBox 中允许的数据范围,对数据溢出值域范围情况的处理需要在 assembleShapes 中进行。
  81982. */
  81983. this.DVBCodomain = null;
  81984. /**
  81985. * @readonly
  81986. * @member {Array.<number>} FeatureThemeGraph.prototype.DVBCenterPoint
  81987. * @description 数据视图框中心点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  81988. */
  81989. this.DVBCenterPoint = null;
  81990. /**
  81991. * @readonly
  81992. * @member {string} FeatureThemeGraph.prototype.DVBUnitValue
  81993. * @description 单位值。在 assembleShapes() 中初始化其具体意义,例如:饼图的 DVBUnitValue 可以定义为"360/数据总和",
  81994. * 折线图的 DVBUnitValue 可以定义为 "DVBCodomain/DVBHeight"。
  81995. */
  81996. this.DVBUnitValue = null;
  81997. /**
  81998. * @readonly
  81999. * @member {Array.<number>} FeatureThemeGraph.prototype.DVBOrigonPoint
  82000. * @description 数据视图框原点,数据视图框左上角点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  82001. */
  82002. this.DVBOrigonPoint = null;
  82003. /**
  82004. * @readonly
  82005. * @member {number} FeatureThemeGraph.prototype.DVBWidth
  82006. * @description 数据视图框宽度。
  82007. */
  82008. this.DVBWidth = null;
  82009. /**
  82010. * @readonly
  82011. * @member {number} FeatureThemeGraph.prototype.DVBHeight
  82012. * @description 数据视图框高度。
  82013. */
  82014. this.DVBHeight = null;
  82015. /**
  82016. * @readonly
  82017. * @member {Array.<number>} FeatureThemeGraph.prototype.origonPointOffset
  82018. * @description 数据视图框原点相对于图表框的原点偏移量,长度为 2 的一维数组,第一个元素表示 x 偏移量,第二个元素表示 y 偏移量。
  82019. */
  82020. this.origonPointOffset = null;
  82021. /**
  82022. * @readonly
  82023. * @member {Array.<string>} FeatureThemeGraph.prototype.fields
  82024. * @description 数据{FeatureVector}属性字段。
  82025. */
  82026. this.fields = fields || [];
  82027. /**
  82028. * @readonly
  82029. * @member {Array.<number>} FeatureThemeGraph.prototype.dataValues
  82030. * @description 图表展示的数据值,通过 fields 从数据 feature 属性中获得。
  82031. */
  82032. this.dataValues = null;
  82033. // 图表位置
  82034. if (lonlat) {
  82035. this.lonlat = lonlat;
  82036. } else {
  82037. // 默认使用 bounds 中心
  82038. this.lonlat = this.data.geometry.getBounds().getCenterLonLat();
  82039. }
  82040. // 配置项检测与赋值
  82041. if (setting && setting.width && setting.height && setting.codomain) {
  82042. this.setting = setting;
  82043. }
  82044. this.CLASS_NAME = "SuperMap.Feature.Theme.Graph";
  82045. }
  82046. /**
  82047. * @function FeatureThemeGraph.prototype.destroy
  82048. * @description 销毁专题要素。
  82049. */
  82050. destroy() {
  82051. this.shapeFactory = null;
  82052. this.shapeParameters = null;
  82053. this.width = null;
  82054. this.height = null;
  82055. this.origonPoint = null;
  82056. this.chartBox = null;
  82057. this.dataViewBox = null;
  82058. this.chartBounds = null;
  82059. this.DVBParameter = null;
  82060. this.DVBOrigonPoint = null;
  82061. this.DVBCenterPoint = null;
  82062. this.DVBWidth = null;
  82063. this.DVBHeight = null;
  82064. this.DVBCodomain = null;
  82065. this.DVBUnitValue = null;
  82066. this.origonPointOffset = null;
  82067. this.XOffset = null;
  82068. this.YOffset = null;
  82069. this.fields = null;
  82070. this.dataValues = null;
  82071. this.setting = null;
  82072. super.destroy();
  82073. }
  82074. /**
  82075. * @function FeatureThemeGraph.prototype.initBaseParameter
  82076. * @description 初始化专题要素(图表)基础参数。在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
  82077. * 调用此函数关系到 setting 对象的以下属性。
  82078. * @param {number} width - 专题要素(图表)宽度。
  82079. * @param {number} height - 专题要素(图表)高度。
  82080. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  82081. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  82082. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  82083. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox。
  82084. * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  82085. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  82086. * @returns {boolean} 初始化参数是否成功。
  82087. */
  82088. initBaseParameter() {
  82089. // 参数初始化是否成功
  82090. var isSuccess = true;
  82091. // setting 属性是否已成功赋值
  82092. if (!this.setting) {
  82093. return false;
  82094. }
  82095. var sets = this.setting;
  82096. // 检测 setting 的必设参数
  82097. if (!(sets.width && sets.height && sets.codomain)) {
  82098. return false;
  82099. }
  82100. // 数据
  82101. var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
  82102. var dataEffective = Theme.getDataValues(this.data, this.fields, decimalNumber);
  82103. this.dataValues = dataEffective ? dataEffective : [];
  82104. // 基础参数 width, height, codomain
  82105. this.width = parseFloat(sets.width);
  82106. this.height = parseFloat(sets.height);
  82107. this.DVBCodomain = sets.codomain;
  82108. // 图表偏移
  82109. // if(sets.XOffset) {this.XOffset = sets.XOffset};
  82110. // if(sets.YOffset) {this.YOffset = sets.YOffset};
  82111. this.XOffset = sets.XOffset ? sets.XOffset : 0;
  82112. this.YOffset = sets.YOffset ? sets.YOffset : 0;
  82113. // 其他默认值
  82114. this.origonPoint = [];
  82115. this.chartBox = [];
  82116. this.dataViewBox = [];
  82117. this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
  82118. this.DVBOrigonPoint = [];
  82119. this.DVBCenterPoint = [];
  82120. this.origonPointOffset = [];
  82121. // 图表位置
  82122. this.resetLocation();
  82123. // 专题要素宽度 w
  82124. var w = this.width;
  82125. // 专题要素高度 h
  82126. var h = this.height;
  82127. // 专题要素像素位置 loc
  82128. var loc = this.location;
  82129. // 专题要素像素位置 loc
  82130. this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
  82131. // 专题要素原点(左上角)
  82132. var op = this.origonPoint;
  82133. // 图表框([left, bottom, right, top])
  82134. this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
  82135. // 图表框
  82136. var cb = this.chartBox;
  82137. // 数据视图框参数,它是图表框各方向对应的内偏距
  82138. var dbbP = this.DVBParameter;
  82139. // 数据视图框 ([left, bottom, right, top])
  82140. this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
  82141. // 数据视图框
  82142. var dvb = this.dataViewBox;
  82143. //检查数据视图框是否合法
  82144. if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
  82145. return false;
  82146. }
  82147. // 数据视图框原点
  82148. this.DVBOrigonPoint = [dvb[0], dvb[3]];
  82149. // 数据视图框宽度
  82150. this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
  82151. // 数据视图框高度
  82152. this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
  82153. // 数据视图框中心点
  82154. this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2]
  82155. // 数据视图框原点与图表框的原点偏移量
  82156. this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
  82157. return isSuccess;
  82158. }
  82159. /**
  82160. * @function FeatureThemeGraph.prototype.resetLocation
  82161. * @description 根据地理位置 lonlat 重置专题要素(图表)位置。
  82162. * @param {LonLat} lonlat - 专题要素新的像素中心位置。
  82163. * @returns {Array.<number>} 新专题要素像素参考位置。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  82164. */
  82165. resetLocation(lonlat) {
  82166. if (lonlat) {
  82167. this.lonlat = lonlat;
  82168. }
  82169. // 获取地理位置对应的像素坐标 newLocalLX
  82170. var newLocalLX = this.getLocalXY(this.lonlat);
  82171. // 处理偏移量 XOffset, YOffset
  82172. newLocalLX[0] += this.XOffset;
  82173. newLocalLX[1] += this.YOffset;
  82174. // 将图形位置赋予 location 属性(注意 location 属性表示的是专题要素中心位置)
  82175. this.location = newLocalLX;
  82176. // 更新图表像素 Bounds
  82177. var w = this.width;
  82178. var h = this.height;
  82179. var loc = this.location;
  82180. this.chartBounds = new Bounds(loc[0] - w / 2, loc[1] + h / 2, loc[0] + w / 2, loc[1] - h / 2);
  82181. //重新计算当前渐变色
  82182. this.resetLinearGradient();
  82183. return loc;
  82184. }
  82185. /**
  82186. * @function FeatureThemeGraph.prototype.resetLinearGradient
  82187. * @description resetLocation 中调用 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图渐变色 所以子类实现此方法)。
  82188. */
  82189. resetLinearGradient() {
  82190. //子类实现此方法
  82191. }
  82192. /**
  82193. * @function FeatureThemeGraph.prototype.shapesConvertToRelativeCoordinate
  82194. * @description 将(构成图表)图形的节点转为相对坐标表示,此函数必须且只能在 assembleShapes() 结束时调用。
  82195. */
  82196. shapesConvertToRelativeCoordinate() {
  82197. var shapes = this.shapes;
  82198. var shapeROP = this.location;
  82199. for (var i = 0, len = shapes.length; i < len; i++) {
  82200. shapes[i].refOriginalPosition = shapeROP;
  82201. var style = shapes[i].style;
  82202. for (var sty in style) {
  82203. switch (sty) {
  82204. case "pointList":
  82205. var pl = style[sty];
  82206. for (var j = 0, len2 = pl.length; j < len2; j++) {
  82207. pl[j][0] -= shapeROP[0];
  82208. pl[j][1] -= shapeROP[1];
  82209. }
  82210. break;
  82211. case "x":
  82212. style[sty] -= shapeROP[0];
  82213. break;
  82214. case "y":
  82215. style[sty] -= shapeROP[1];
  82216. break;
  82217. default:
  82218. break;
  82219. }
  82220. }
  82221. }
  82222. this.RelativeCoordinate = true;
  82223. }
  82224. /**
  82225. * @function FeatureThemeGraph.prototype.assembleShapes
  82226. * @description 图形装配函数。抽象方法,可视化子类必须实现此方法。<br>
  82227. * 重写此方法的步骤:<br>
  82228. * 1. 图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。<br>
  82229. * 2. 调用 initBaseParameter() 方法初始化模型属性值,此步骤必须执行,只有当 initBaseParameter 返回 true 时才可以允许进行后续步骤。<br>
  82230. * 3. 计算图形参数,制作图形,图形组合。在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。<br>
  82231. * 4. 调用 shapesConvertToRelativeCoordinate() 方法,将图形的坐标值转为相对坐标,此步骤必须执行。
  82232. * @example
  82233. * //子类实现 assembleShapes() 接口的步骤示例:
  82234. * assembleShapes: function(){
  82235. * // 第一步:图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。此步骤是非必须过程。
  82236. *
  82237. * // 图表配置对象
  82238. * var sets = this.setting;
  82239. * // 默认数据视图框,这里展示在使用坐标轴和不使用坐标轴情况下对数据视图框参数赋予不同的默认值
  82240. * if(!sets.dataViewBoxParameter){
  82241. * if(typeof(sets.useAxis) === "undefined" || sets.useAxis){
  82242. * sets.dataViewBoxParameter = [45, 15, 15, 15];
  82243. * }
  82244. * else{
  82245. * sets.dataViewBoxParameter = [5, 5, 5, 5];
  82246. * }
  82247. * }
  82248. *
  82249. * // 第二步:初始化图表模型基本参数,只有在图表模型基本参数初始化成功时才可模型相关属性,如 this.dataViewBox、 this.DVBCodomain等。此步骤是必须过程。
  82250. * if(!this.initBaseParameter()) return;
  82251. *
  82252. * // 第三步:用图形组装图表,在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。
  82253. * // 定义图表数据视图框中单位值的含义,下面行代码表示将数据视图框单位值定义为数据视图框高度上每像素代表的数据值
  82254. * this.DVBUnitValue = (this.codomain[1] - this.codomain[0])/this.DVBHeight;
  82255. * var uv = this.DVBUnitValue;
  82256. *
  82257. * // 图形参数计算代码......
  82258. *
  82259. * // 关于图形装配,实际上就是利用图形工程对象 this.shapeFactory 的 createShape() 方法通过图形参数对象创建可视化的图形对象,并把这些图形对象按序添加到模型的图形库(his.shapes)中。下面的代码演示创建一个面图形参数对象,并允许通过图形配置对象设置图形的 style 和 highlightStyle,
  82260. * var barParams = new ShapeParametersPolygon(poiLists);
  82261. * barParams.style = sets.barStyle? sets.barStyle:{fillColor: "lightblue"};
  82262. * barParams.highlightStyle = sets.barHoverStyle? sets.barHoverStyle:{fillColor: "blue"};
  82263. * // 图形携带数据ID信息
  82264. * barParams.refDataID = this.data.id;
  82265. * // 创建图形并添加到图表图形数组中
  82266. * this.shapes.push(this.shapeFactory.createShape(barParams));
  82267. *
  82268. * // 第四步:调用 shapesConvertToRelativeCoordinate() 方法,将图形库(his.shapes)中的图形转为由相对坐标表示的图形,客户端统计专题图模块从结构上要求可视化图形使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数。此步骤是必须过程。
  82269. * this.shapesConvertToRelativeCoordinate();
  82270. * },
  82271. */
  82272. assembleShapes() {
  82273. //子类必须实现此方法
  82274. }
  82275. /**
  82276. * @function FeatureThemeGraph.prototype.getLocalXY
  82277. * @description 地理坐标转为像素坐标。
  82278. * @param {LonLat} lonlat - 带转换的地理坐标。
  82279. * @returns 屏幕像素坐标。
  82280. */
  82281. getLocalXY(lonlat) {
  82282. return this.layer.getLocalXY(lonlat);
  82283. }
  82284. }
  82285. /**
  82286. * @function FeatureTheme.getDataValues
  82287. * @description 根据字段名数组获取指定数据(feature)的属性值数组。属性值类型必须为 Number。
  82288. * @param {FeatureVector} data - 数据。
  82289. * @param {Array.<string>} [fields] - 字段名数组。
  82290. * @param {number} [decimalNumber] - 小数位处理参数,对获取到的属性数据值进行小数位处理。
  82291. * @returns {Array.<string>} 字段名数组对应的属性数据值数组。
  82292. */
  82293. Theme.getDataValues = function (data, fields, decimalNumber) {
  82294. if (!data.attributes) {
  82295. return false;
  82296. }
  82297. var fieldsValue = [];
  82298. var attrs = data.attributes;
  82299. for (var i = 0; i < fields.length; i++) {
  82300. for (var field in attrs) {
  82301. if (field !== fields[i]) {
  82302. continue
  82303. }
  82304. // 数字转换判断
  82305. try {
  82306. if (!isNaN(decimalNumber) && decimalNumber >= 0) {
  82307. fieldsValue.push(parseFloat(attrs[field].toString()).toFixed(decimalNumber));
  82308. } else {
  82309. fieldsValue.push(parseFloat(attrs[field].toString()));
  82310. }
  82311. } catch (e) {
  82312. throw new Error("not a number")
  82313. }
  82314. }
  82315. }
  82316. if (fieldsValue.length === fields.length) {
  82317. return fieldsValue;
  82318. } else {
  82319. return false;
  82320. }
  82321. };
  82322. ;// CONCATENATED MODULE: ./src/common/overlay/Bar.js
  82323. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82324. * This program are made available under the terms of the Apache License, Version 2.0
  82325. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82326. /**
  82327. * @class FeatureThemeBar
  82328. * @aliasclass Feature.Theme.Bar
  82329. * @deprecatedclass SuperMap.Feature.Theme.Bar
  82330. * @classdesc 柱状图 。
  82331. * @category Visualization Theme
  82332. * @example
  82333. * // barStyleByCodomain参数用法如下:
  82334. * // barStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  82335. * // start: 值域值下限(包含);
  82336. * // end: 值域值上限(不包含);
  82337. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersPolygon.style> 。
  82338. * // barStyleByCodomain 数组形如:
  82339. * [
  82340. * {
  82341. * start:0,
  82342. * end:250,
  82343. * style:{
  82344. * fillColor:"#00CD00"
  82345. * }
  82346. * },
  82347. * {
  82348. * start:250,
  82349. * end:500,
  82350. * style:{
  82351. * fillColor:"#00EE00"
  82352. * }
  82353. * },
  82354. * {
  82355. * start:500,
  82356. * end:750,
  82357. * style:{
  82358. * fillColor:"#00FF7F"
  82359. * }
  82360. * },
  82361. * {
  82362. * start:750,
  82363. * end:1500,
  82364. * style:{
  82365. * fillColor:"#00FF00"
  82366. * }
  82367. * }
  82368. * ]
  82369. * @extends FeatureThemeGraph
  82370. * @param {FeatureVector} data - 用户数据。
  82371. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  82372. * @param {Array.<string>} fields - data 属性中的参与此图表生成的属性字段名称。
  82373. * @param {FeatureThemeBar.setting} setting - 图表配置对象。
  82374. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  82375. * @usage
  82376. * @private
  82377. */
  82378. class Bar extends Graph_Graph {
  82379. constructor(data, layer, fields, setting, lonlat) {
  82380. super(data, layer, fields, setting, lonlat);
  82381. this.CLASS_NAME = "SuperMap.Feature.Theme.Bar";
  82382. }
  82383. /**
  82384. * @function FeatureThemeBar.prototype.destroy
  82385. * @override
  82386. */
  82387. destroy() {
  82388. super.destroy();
  82389. }
  82390. /**
  82391. * @function FeatureThemeBar.prototype.assembleShapes
  82392. * @description 图表图形装配函数。
  82393. */
  82394. assembleShapes() {
  82395. //默认渐变颜色数组
  82396. var deafaultColors = [["#00FF00", "#00CD00"], ["#00CCFF", "#5E87A2"], ["#00FF66", "#669985"], ["#CCFF00", "#94A25E"], ["#FF9900", "#A2945E"]];
  82397. //默认阴影
  82398. var deafaultShawdow = {
  82399. showShadow: true,
  82400. shadowBlur: 8,
  82401. shadowColor: "rgba(100,100,100,0.8)",
  82402. shadowOffsetX: 2,
  82403. shadowOffsetY: 2
  82404. };
  82405. // 图表配置对象
  82406. var sets = this.setting;
  82407. if (!sets.barLinearGradient) {
  82408. sets.barLinearGradient = deafaultColors;
  82409. }
  82410. // 默认数据视图框
  82411. if (!sets.dataViewBoxParameter) {
  82412. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  82413. sets.dataViewBoxParameter = [45, 15, 15, 15];
  82414. } else {
  82415. sets.dataViewBoxParameter = [5, 5, 5, 5];
  82416. }
  82417. }
  82418. // 重要步骤:初始化参数
  82419. if (!this.initBaseParameter()) {
  82420. return;
  82421. }
  82422. // 值域
  82423. var codomain = this.DVBCodomain;
  82424. // 重要步骤:定义图表 BaFeatureThemeBarr 数据视图框中单位值的含义
  82425. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  82426. // 数据视图域
  82427. var dvb = this.dataViewBox;
  82428. // 用户数据值
  82429. var fv = this.dataValues;
  82430. if (fv.length < 1) {
  82431. return;
  82432. } // 没有数据
  82433. // 数据溢出值域范围处理
  82434. for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
  82435. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  82436. return;
  82437. }
  82438. }
  82439. // 获取 x 轴上的图形信息
  82440. var xShapeInfo = this.calculateXShapeInfo();
  82441. if (!xShapeInfo) {
  82442. return;
  82443. }
  82444. // 每个柱条 x 位置
  82445. var xsLoc = xShapeInfo.xPositions;
  82446. // 柱条宽度
  82447. var xsWdith = xShapeInfo.width;
  82448. // 背景框,默认启用
  82449. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  82450. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  82451. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  82452. }
  82453. // 坐标轴, 默认启用
  82454. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  82455. // 添加坐标轴图形数组
  82456. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  82457. }
  82458. for (var i = 0; i < fv.length; i++) {
  82459. // 计算柱条 top 边的 y 轴坐标值
  82460. var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
  82461. // 柱条节点数组
  82462. var poiLists = [
  82463. [xsLoc[i] - xsWdith / 2, dvb[1] - 1],
  82464. [xsLoc[i] + xsWdith / 2, dvb[1] - 1],
  82465. [xsLoc[i] + xsWdith / 2, yPx],
  82466. [xsLoc[i] - xsWdith / 2, yPx]
  82467. ];
  82468. // 柱条参数对象(一个面参数对象)
  82469. var barParams = new feature_Polygon_Polygon(poiLists);
  82470. // 柱条 阴影 style
  82471. if (typeof(sets.showShadow) === "undefined" || sets.showShadow) {
  82472. if (sets.barShadowStyle) {
  82473. var sss = sets.barShadowStyle;
  82474. if (sss.shadowBlur) {
  82475. deafaultShawdow.shadowBlur = sss.shadowBlur;
  82476. }
  82477. if (sss.shadowColor) {
  82478. deafaultShawdow.shadowColor = sss.shadowColor;
  82479. }
  82480. if (sss.shadowOffsetX) {
  82481. deafaultShawdow.shadowOffsetX = sss.shadowOffsetX;
  82482. }
  82483. if (sss.shadowOffsetY) {
  82484. deafaultShawdow.shadowOffsetY = sss.shadowOffsetY;
  82485. }
  82486. }
  82487. barParams.style = {};
  82488. Util_Util.copyAttributesWithClip(barParams.style, deafaultShawdow);
  82489. }
  82490. // 图形携带的数据信息
  82491. barParams.refDataID = this.data.id;
  82492. barParams.dataInfo = {
  82493. field: this.fields[i],
  82494. value: fv[i]
  82495. };
  82496. // 柱条 hover click
  82497. if (typeof(sets.barHoverAble) !== "undefined") {
  82498. barParams.hoverable = sets.barHoverAble;
  82499. }
  82500. if (typeof(sets.barClickAble) !== "undefined") {
  82501. barParams.clickable = sets.barClickAble;
  82502. }
  82503. // 创建柱条并添加到图表图形数组中
  82504. this.shapes.push(this.shapeFactory.createShape(barParams));
  82505. }
  82506. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  82507. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  82508. this.shapesConvertToRelativeCoordinate();
  82509. }
  82510. /**
  82511. * @function FeatureThemeBar.prototype.calculateXShapeInfo
  82512. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  82513. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  82514. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  82515. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  82516. * 本函数中图形配置对象 setting 可设属性:
  82517. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  82518. * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  82519. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  82520. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
  82521. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  82522. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  82523. *
  82524. */
  82525. calculateXShapeInfo() {
  82526. var dvb = this.dataViewBox; // 数据视图框
  82527. var sets = this.setting; // 图表配置对象
  82528. var fvc = this.dataValues.length; // 数组值个数
  82529. if (fvc < 1) {
  82530. return null;
  82531. }
  82532. var xBlank; // x 轴空白间隔参数
  82533. var xShapePositions = []; // x 轴上图形的位置
  82534. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  82535. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  82536. // x 轴空白间隔参数处理
  82537. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
  82538. xBlank = sets.xShapeBlank;
  82539. var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1]);
  82540. if (xsLen <= fvc) {
  82541. return null;
  82542. }
  82543. xShapeWidth = xsLen / fvc
  82544. } else {
  82545. // 默认使用等距离空白间隔,空白间隔为图形宽度
  82546. xShapeWidth = dvbWidth / (2 * fvc + 1);
  82547. xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
  82548. }
  82549. // 图形 x 轴上的位置计算
  82550. var xOffset = 0
  82551. for (var i = 0; i < fvc; i++) {
  82552. if (i == 0) {
  82553. xOffset = xBlank[0] + xShapeWidth / 2;
  82554. } else {
  82555. xOffset += (xShapeWidth + xBlank[1]);
  82556. }
  82557. xShapePositions.push(dvb[0] + xOffset);
  82558. }
  82559. return {
  82560. "xPositions": xShapePositions,
  82561. "width": xShapeWidth
  82562. };
  82563. }
  82564. /**
  82565. * @function FeatureThemeBar.prototype.resetLinearGradient
  82566. * @description 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图 所以子类实现此方法)。
  82567. */
  82568. resetLinearGradient() {
  82569. if (this.RelativeCoordinate) {
  82570. var shpelength = this.shapes.length;
  82571. var barLinearGradient = this.setting.barLinearGradient;
  82572. var index = -1;
  82573. for (var i = 0; i < shpelength; i++) {
  82574. var shape = this.shapes[i];
  82575. if (shape.CLASS_NAME === "SuperMap.LevelRenderer.Shape.SmicPolygon") {
  82576. var style = shape.style;
  82577. //计算出当前的绝对 x y
  82578. var x1 = this.location[0] + style.pointList[0][0];
  82579. var x2 = this.location[0] + style.pointList[1][0];
  82580. //渐变颜色
  82581. index++;
  82582. //以防定义的颜色数组不够用
  82583. if (index >= barLinearGradient.length) {
  82584. index = index % barLinearGradient.length;
  82585. }
  82586. var color1 = barLinearGradient[index][0];
  82587. var color2 = barLinearGradient[index][1];
  82588. //颜色
  82589. var zcolor = new Color();
  82590. var linearGradient = zcolor.getLinearGradient(x1, 0, x2, 0,
  82591. [[0, color1], [1, color2]]);
  82592. //赋值
  82593. shape.style.color = linearGradient;
  82594. }
  82595. }
  82596. }
  82597. }
  82598. }
  82599. ;// CONCATENATED MODULE: ./src/common/overlay/Bar3D.js
  82600. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82601. * This program are made available under the terms of the Apache License, Version 2.0
  82602. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82603. /**
  82604. * @class FeatureThemeBar3D
  82605. * @aliasclass Feature.Theme.Bar3D
  82606. * @deprecatedclass SuperMap.Feature.Theme.Bar3D
  82607. * @classdesc 三维柱状图 。
  82608. * @category Visualization Theme
  82609. * @extends FeatureThemeGraph
  82610. * @param {FeatureVector} data - 用户数据。
  82611. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  82612. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  82613. * @param {FeatureThemeBar3D.setting} setting - 图表配置对象。
  82614. * @param {LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
  82615. *
  82616. *
  82617. * @example
  82618. * // barFaceStyleByCodomain 用法示例如下:
  82619. * // barFaceStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  82620. * // start: 值域值下限(包含);
  82621. * // end: 值域值上限(不包含);
  82622. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersPolygon.style> 。
  82623. * // barFaceStyleByCodomain 数组形如:
  82624. * [
  82625. * {
  82626. * start:0,
  82627. * end:250,
  82628. * style:{
  82629. * fillColor:"#00CD00"
  82630. * }
  82631. * },
  82632. * {
  82633. * start:250,
  82634. * end:500,
  82635. * style:{
  82636. * fillColor:"#00EE00"
  82637. * }
  82638. * },
  82639. * {
  82640. * start:500,
  82641. * end:750,
  82642. * style:{
  82643. * fillColor:"#00FF7F"
  82644. * }
  82645. * },
  82646. * {
  82647. * start:750,
  82648. * end:1500,
  82649. * style:{
  82650. * fillColor:"#00FF00"
  82651. * }
  82652. * }
  82653. * ]
  82654. *
  82655. * @example
  82656. * // barSideStyleByCodomain 用法示例如下:
  82657. * // barSideStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  82658. * // start: 值域值下限(包含);
  82659. * // end: 值域值上限(不包含);
  82660. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersPolygon.style> 。
  82661. * // barSideStyleByCodomain 数组形如:
  82662. * [
  82663. * {
  82664. * start:0,
  82665. * end:250,
  82666. * style:{
  82667. * fillColor:"#00CD00"
  82668. * }
  82669. * },
  82670. * {
  82671. * start:250,
  82672. * end:500,
  82673. * style:{
  82674. * fillColor:"#00EE00"
  82675. * }
  82676. * },
  82677. * {
  82678. * start:500,
  82679. * end:750,
  82680. * style:{
  82681. * fillColor:"#00FF7F"
  82682. * }
  82683. * },
  82684. * {
  82685. * start:750,
  82686. * end:1500,
  82687. * style:{
  82688. * fillColor:"#00FF00"
  82689. * }
  82690. * }
  82691. * ]
  82692. *
  82693. * @example
  82694. * // barTopStyleByCodomain 用法示例如下:
  82695. * // barTopStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  82696. * // start: 值域值下限(包含);
  82697. * // end: 值域值上限(不包含);
  82698. * // style: 数据可视化图形的 style,这个样式对象的可设属性:<ShapeParametersPolygon.style> 。
  82699. * // barTopStyleByCodomain 数组形如:
  82700. * [
  82701. * {
  82702. * start:0,
  82703. * end:250,
  82704. * style:{
  82705. * fillColor:"#00CD00"
  82706. * }
  82707. * },
  82708. * {
  82709. * start:250,
  82710. * end:500,
  82711. * style:{
  82712. * fillColor:"#00EE00"
  82713. * }
  82714. * },
  82715. * {
  82716. * start:500,
  82717. * end:750,
  82718. * style:{
  82719. * fillColor:"#00FF7F"
  82720. * }
  82721. * },
  82722. * {
  82723. * start:750,
  82724. * end:1500,
  82725. * style:{
  82726. * fillColor:"#00FF00"
  82727. * }
  82728. * }
  82729. * ]
  82730. * @usage
  82731. * @private
  82732. */
  82733. class Bar3D extends Graph_Graph {
  82734. constructor(data, layer, fields, setting, lonlat) {
  82735. super(data, layer, fields, setting, lonlat);
  82736. this.CLASS_NAME = "SuperMap.Feature.Theme.Bar3D";
  82737. }
  82738. /**
  82739. * @function FeatureThemeBar3D.prototype.destroy
  82740. * @override
  82741. */
  82742. destroy() {
  82743. super.destroy();
  82744. }
  82745. /**
  82746. * @function FeatureThemeBar3D.prototype.assembleShapes
  82747. * @description 图形装配实现(扩展接口)。
  82748. */
  82749. assembleShapes() {
  82750. // 图表配置对象
  82751. var sets = this.setting;
  82752. // 默认数据视图框
  82753. if (!sets.dataViewBoxParameter) {
  82754. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  82755. sets.dataViewBoxParameter = [45, 25, 20, 20];
  82756. } else {
  82757. sets.dataViewBoxParameter = [5, 5, 5, 5];
  82758. }
  82759. }
  82760. // 3d 柱图的坐标轴默认使用坐标轴箭头
  82761. sets.axisUseArrow = (typeof(sets.axisUseArrow) !== "undefined") ? sets.axisUseArrow : true;
  82762. sets.axisXLabelsOffset = (typeof(sets.axisXLabelsOffset) !== "undefined") ? sets.axisXLabelsOffset : [-10, 10];
  82763. // 重要步骤:初始化参数
  82764. if (!this.initBaseParameter()) {
  82765. return;
  82766. }
  82767. // 值域
  82768. var codomain = this.DVBCodomain;
  82769. // 重要步骤:定义图表 FeatureThemeBar 数据视图框中单位值的含义
  82770. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  82771. // 数据视图域
  82772. var dvb = this.dataViewBox;
  82773. // 用户数据值
  82774. var fv = this.dataValues;
  82775. if (fv.length < 1) {
  82776. return;
  82777. } // 没有数据
  82778. // 数据溢出值域范围处理
  82779. for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
  82780. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  82781. return;
  82782. }
  82783. }
  82784. // 获取 x 轴上的图形信息
  82785. var xShapeInfo = this.calculateXShapeInfo();
  82786. if (!xShapeInfo) {
  82787. return;
  82788. }
  82789. // 每个柱条 x 位置
  82790. var xsLoc = xShapeInfo.xPositions;
  82791. // 柱条宽度
  82792. var xsWdith = xShapeInfo.width;
  82793. // 坐标轴, 默认启用
  82794. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  82795. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  82796. }
  82797. // 坐标轴
  82798. if (!sets.axis3DParameter || isNaN(sets.axis3DParameter) || sets.axis3DParameter < 15) {
  82799. sets.axis3DParameter = 20;
  82800. }
  82801. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  82802. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  82803. }
  82804. // 3d 偏移量, 默认值 10;
  82805. var offset3d = (sets.bar3DParameter && !isNaN(sets.bar3DParameter)) ? sets.bar3DParameter : 10;
  82806. for (let i = 0; i < fv.length; i++) {
  82807. // 无 3d 偏移量时的柱面顶部 y 坐标
  82808. var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
  82809. // 无 3d 偏移量时的柱面的左、右端 x 坐标
  82810. var iPoiL = xsLoc[i] - xsWdith / 2;
  82811. var iPoiR = xsLoc[i] + xsWdith / 2;
  82812. // 3d 柱顶面节点
  82813. var bar3DTopPois = [
  82814. [iPoiL, yPx],
  82815. [iPoiR, yPx],
  82816. [iPoiR - offset3d, yPx + offset3d],
  82817. [iPoiL - offset3d, yPx + offset3d]
  82818. ];
  82819. // 3d 柱侧面节点
  82820. var bar3DSidePois = [
  82821. [iPoiR, yPx],
  82822. [iPoiR - offset3d, yPx + offset3d],
  82823. [iPoiR - offset3d, dvb[1] + offset3d],
  82824. [iPoiR, dvb[1]]
  82825. ];
  82826. // 3d 柱正面节点
  82827. var bar3DFacePois = [
  82828. [iPoiL - offset3d, dvb[1] + offset3d],
  82829. [iPoiR - offset3d, dvb[1] + offset3d],
  82830. [iPoiR - offset3d, yPx + offset3d],
  82831. [iPoiL - offset3d, yPx + offset3d]
  82832. ];
  82833. if (offset3d <= 0) { // offset3d <= 0 时正面不偏移
  82834. bar3DFacePois = [
  82835. [iPoiL, dvb[1]],
  82836. [iPoiR, dvb[1]],
  82837. [iPoiR, yPx],
  82838. [iPoiL, yPx]
  82839. ];
  82840. }
  82841. // 新建 3d 柱面顶面、侧面、正面图形参数对象
  82842. var polyTopSP = new feature_Polygon_Polygon(bar3DTopPois);
  82843. var polySideSP = new feature_Polygon_Polygon(bar3DSidePois);
  82844. var polyFaceSP = new feature_Polygon_Polygon(bar3DFacePois);
  82845. // 侧面、正面图形 style 默认值
  82846. sets.barSideStyle = sets.barSideStyle ? sets.barSideStyle : sets.barFaceStyle;
  82847. sets.barSideStyleByFields = sets.barSideStyleByFields ? sets.barSideStyleByFields : sets.barFaceStyleByFields;
  82848. sets.barSideStyleByCodomain = sets.barSideStyleByCodomain ? sets.barSideStyleByCodomain : sets.barFaceStyleByCodomain;
  82849. sets.barTopStyle = sets.barTopStyle ? sets.barTopStyle : sets.barFaceStyle;
  82850. sets.barTopStyleByFields = sets.barTopStyleByFields ? sets.barTopStyleByFields : sets.barFaceStyleByFields;
  82851. sets.barTopStyleByCodomain = sets.barTopStyleByCodomain ? sets.barTopStyleByCodomain : sets.barFaceStyleByCodomain;
  82852. // 顶面、侧面、正面图形 style
  82853. polyFaceSP.style = ShapeFactory.ShapeStyleTool({
  82854. stroke: true,
  82855. strokeColor: "#ffffff",
  82856. fillColor: "#ee9900"
  82857. },
  82858. sets.barFaceStyle, sets.barFaceStyleByFields, sets.barFaceStyleByCodomain, i, fv[i]);
  82859. polySideSP.style = ShapeFactory.ShapeStyleTool({
  82860. stroke: true,
  82861. strokeColor: "#ffffff",
  82862. fillColor: "#ee9900"
  82863. },
  82864. sets.barSideStyle, sets.barSideStyleByFields, sets.barSideStyleByCodomain, i, fv[i]);
  82865. polyTopSP.style = ShapeFactory.ShapeStyleTool({
  82866. stroke: true,
  82867. strokeColor: "#ffffff",
  82868. fillColor: "#ee9900"
  82869. },
  82870. sets.barTopStyle, sets.barTopStyleByFields, sets.barTopStyleByCodomain, i, fv[i]);
  82871. // 3d 柱条高亮样式
  82872. sets.barSideHoverStyle = sets.barSideHoverStyle ? sets.barSideHoverStyle : sets.barFaceHoverStyle;
  82873. sets.barTopHoverStyle = sets.barTopHoverStyle ? sets.barTopHoverStyle : sets.barFaceHoverStyle;
  82874. polyFaceSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barFaceHoverStyle);
  82875. polySideSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barSideHoverStyle);
  82876. polyTopSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barTopHoverStyle);
  82877. // 图形携带的数据 id 信息 & 高亮模式
  82878. polyTopSP.refDataID = polySideSP.refDataID = polyFaceSP.refDataID = this.data.id;
  82879. // hover 模式(组合)
  82880. polyTopSP.isHoverByRefDataID = polySideSP.isHoverByRefDataID = polyFaceSP.isHoverByRefDataID = true;
  82881. // 高亮组(当鼠标 hover 到组内任何一个图形,整个组的图形都会高亮。refDataHoverGroup 在 isHoverByRefDataID 为 true 时有效)
  82882. polyTopSP.refDataHoverGroup = polySideSP.refDataHoverGroup = polyFaceSP.refDataHoverGroup = Util_Util.createUniqueID("lr_shg");
  82883. // 图形携带的数据信息
  82884. polyTopSP.dataInfo = polySideSP.dataInfo = polyFaceSP.dataInfo = {
  82885. field: this.fields[i],
  82886. value: fv[i]
  82887. };
  82888. // 3d 柱条顶面、侧面、正面图形 hover click 设置
  82889. if (typeof(sets.barHoverAble) !== "undefined") {
  82890. polyTopSP.hoverable = polySideSP.hoverable = polyFaceSP.hoverable = sets.barHoverAble;
  82891. }
  82892. if (typeof(sets.barClickAble) !== "undefined") {
  82893. polyTopSP.clickable = polySideSP.clickable = polyFaceSP.clickable = sets.barClickAble;
  82894. }
  82895. // 创建3d 柱条的顶面、侧面、正面图形并添加到图表的图形列表数组
  82896. this.shapes.push(this.shapeFactory.createShape(polySideSP));
  82897. this.shapes.push(this.shapeFactory.createShape(polyTopSP));
  82898. this.shapes.push(this.shapeFactory.createShape(polyFaceSP));
  82899. }
  82900. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  82901. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  82902. this.shapesConvertToRelativeCoordinate();
  82903. }
  82904. /**
  82905. * @function FeatureThemeBar3D.prototype.calculateXShapeInfo
  82906. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  82907. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  82908. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  82909. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  82910. * 本函数中图形配置对象 setting 可设属性:
  82911. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  82912. * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  82913. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  82914. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
  82915. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  82916. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  82917. */
  82918. calculateXShapeInfo() {
  82919. var dvb = this.dataViewBox; // 数据视图框
  82920. var sets = this.setting; // 图表配置对象
  82921. var fvc = this.dataValues.length; // 数组值个数
  82922. if (fvc < 1) {
  82923. return null;
  82924. }
  82925. var xBlank; // x 轴空白间隔参数
  82926. var xShapePositions = []; // x 轴上图形的位置
  82927. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  82928. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  82929. // x 轴空白间隔参数处理
  82930. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
  82931. xBlank = sets.xShapeBlank;
  82932. var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1])
  82933. if (xsLen <= fvc) {
  82934. return null;
  82935. }
  82936. xShapeWidth = xsLen / fvc
  82937. } else {
  82938. // 默认使用等距离空白间隔,空白间隔为图形宽度
  82939. xShapeWidth = dvbWidth / (2 * fvc + 1);
  82940. xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
  82941. }
  82942. // 图形 x 轴上的位置计算
  82943. var xOffset = 0
  82944. for (var i = 0; i < fvc; i++) {
  82945. if (i == 0) {
  82946. xOffset = xBlank[0] + xShapeWidth / 2;
  82947. } else {
  82948. xOffset += (xShapeWidth + xBlank[1]);
  82949. }
  82950. xShapePositions.push(dvb[0] + xOffset);
  82951. }
  82952. return {
  82953. "xPositions": xShapePositions,
  82954. "width": xShapeWidth
  82955. };
  82956. }
  82957. }
  82958. ;// CONCATENATED MODULE: ./src/common/overlay/RankSymbol.js
  82959. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82960. * This program are made available under the terms of the Apache License, Version 2.0
  82961. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82962. /**
  82963. * @class FeatureThemeRankSymbol
  82964. * @aliasclass Feature.Theme.RankSymbol
  82965. * @deprecatedclass SuperMap.Feature.Theme.RankSymbol
  82966. * @category Visualization Theme
  82967. * @classdesc 符号专题要素基类。此类定义了符号专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
  82968. * 符号专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <FeatureThemeRankSymbol.setting> 的基础属性只有 5 个,
  82969. * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
  82970. * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
  82971. * @param {FeatureVector} data - 用户数据。
  82972. * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
  82973. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  82974. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  82975. * @param {Object} setting - 图表配置对象。除了以下 5 个基础属性,此对象的可设属性在不同子类中有较大差异,不同子类中对同一属性的解释也可能不同,请在此类的子类中查看 setting 对象的可设属性和属性含义。
  82976. * @param {Array.<number>} setting.codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  82977. * @param {number} [setting.XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  82978. * @param {number} [setting.YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  82979. * @param {Array.<number>} [setting.dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  82980. * @param {number} [setting.decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  82981. * @extends FeatureThemeGraph
  82982. * @usage
  82983. */
  82984. class RankSymbol_RankSymbol extends Graph_Graph {
  82985. constructor(data, layer, fields, setting, lonlat, options) {
  82986. super(data, layer, fields, setting, lonlat, options);
  82987. /**
  82988. * @member {Object} FeatureThemeRankSymbol.prototype.setting
  82989. * @description 符号配置对象,该对象控制着图表的可视化显示。
  82990. */
  82991. this.setting = null;
  82992. // 配置项检测与赋值
  82993. if (setting && setting.codomain) {
  82994. this.setting = setting;
  82995. this.DVBCodomain = this.setting.codomain;
  82996. }
  82997. this.CLASS_NAME = "SuperMap.Feature.Theme.RankSymbol";
  82998. }
  82999. /**
  83000. * @function FeatureThemeRankSymbol.prototype.destroy
  83001. * @description 销毁专题要素。
  83002. */
  83003. destroy() {
  83004. this.setting = null;
  83005. super.destroy();
  83006. }
  83007. /**
  83008. * @function FeatureThemeRankSymbol.prototype.initBaseParameter
  83009. * @description 初始化专题要素(图形)基础参数。
  83010. * 在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
  83011. * 调用此函数关系到 setting 对象的以下属性。
  83012. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  83013. * @param {number} [XOffset] - 专题要素(图形)在 X 方向上的偏移值,单位像素。
  83014. * @param {number} [YOffset] - 专题要素(图形)在 Y 方向上的偏移值,单位像素。
  83015. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图形框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  83016. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  83017. * @returns {boolean} 初始化参数是否成功。
  83018. */
  83019. initBaseParameter() {
  83020. // 参数初始化是否成功
  83021. var isSuccess = true;
  83022. // setting 属性是否已成功赋值
  83023. if (!this.setting) {
  83024. return false;
  83025. }
  83026. var sets = this.setting;
  83027. // 图表偏移
  83028. if (sets.XOffset) {
  83029. this.XOffset = sets.XOffset;
  83030. }
  83031. if (sets.YOffset) {
  83032. this.YOffset = sets.YOffset;
  83033. }
  83034. this.XOffset = sets.XOffset ? sets.XOffset : 0;
  83035. this.YOffset = sets.YOffset ? sets.YOffset : 0;
  83036. // 其他默认值
  83037. this.origonPoint = [];
  83038. this.chartBox = [];
  83039. this.dataViewBox = [];
  83040. this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
  83041. this.DVBOrigonPoint = [];
  83042. this.DVBCenterPoint = [];
  83043. this.origonPointOffset = [];
  83044. // 图表位置
  83045. this.resetLocation();
  83046. // 专题要素宽度 w
  83047. var w = this.width;
  83048. // 专题要素高度 h
  83049. var h = this.height;
  83050. // 专题要素像素位置 loc
  83051. var loc = this.location;
  83052. // 专题要素像素位置 loc
  83053. this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
  83054. // 专题要素原点(左上角)
  83055. var op = this.origonPoint;
  83056. // 图表框([left, bottom, right, top])
  83057. this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
  83058. // 图表框
  83059. var cb = this.chartBox;
  83060. // 数据视图框参数,它是图表框各方向对应的内偏距
  83061. var dbbP = this.DVBParameter;
  83062. // 数据视图框 ([left, bottom, right, top])
  83063. this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
  83064. // 数据视图框
  83065. var dvb = this.dataViewBox;
  83066. //检查数据视图框是否合法
  83067. if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
  83068. return false;
  83069. }
  83070. // 数据视图框原点
  83071. this.DVBOrigonPoint = [dvb[0], dvb[3]];
  83072. // 数据视图框宽度
  83073. this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
  83074. // 数据视图框高度
  83075. this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
  83076. // 数据视图框中心点
  83077. this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2];
  83078. // 数据视图框原点与图表框的原点偏移量
  83079. this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
  83080. return isSuccess;
  83081. }
  83082. }
  83083. ;// CONCATENATED MODULE: ./src/common/overlay/Circle.js
  83084. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  83085. * This program are made available under the terms of the Apache License, Version 2.0
  83086. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83087. /**
  83088. * @class FeatureThemeCircle
  83089. * @aliasclass Feature.Theme.Circle
  83090. * @deprecatedclass SuperMap.Feature.Theme.Circle
  83091. * @classdesc 圆类。
  83092. * @category Visualization Theme
  83093. * @extends FeatureThemeRankSymbol
  83094. * @param {FeatureVector} data - 用户数据。
  83095. * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
  83096. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  83097. * @param {FeatureThemeCircle.setting} setting - 图表配置对象。
  83098. * @param {LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
  83099. * @usage
  83100. * @private
  83101. */
  83102. class Circle extends RankSymbol_RankSymbol {
  83103. constructor(data, layer, fields, setting, lonlat) {
  83104. super(data, layer, fields, setting, lonlat);
  83105. this.CLASS_NAME = "SuperMap.Feature.Theme.Circle";
  83106. }
  83107. /**
  83108. * @function FeatureThemeCircle.prototype.destroy
  83109. * @override
  83110. */
  83111. destroy() {
  83112. super.destroy();
  83113. }
  83114. /**
  83115. * @function FeatureThemeCircle.prototype.assembleShapes
  83116. * @description 装配图形(扩展接口)。
  83117. */
  83118. assembleShapes() {
  83119. //默认填充颜色
  83120. var defaultFillColor = "#ff9277";
  83121. // setting 属性是否已成功赋值
  83122. if (!this.setting) {
  83123. return false;
  83124. }
  83125. var sets = this.setting;
  83126. // 检测 setting 的必设参数
  83127. if (!(sets.codomain)) {
  83128. return false;
  83129. }
  83130. // 数据
  83131. var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
  83132. var dataEffective = Theme.getDataValues(this.data, this.fields, decimalNumber);
  83133. this.dataValues = dataEffective ? dataEffective : [];
  83134. // 数据值数组
  83135. var fv = this.dataValues;
  83136. //if(fv.length != 1) return; // 没有数据 或者数据不唯一
  83137. //if(fv[0] < 0) return; //数据为负值
  83138. //用户应该定义最大 最小半径 默认最大半径MaxR:100 最小半径MinR:0;
  83139. if (!sets.maxR) {
  83140. sets.maxR = 100;
  83141. }
  83142. if (!sets.minR) {
  83143. sets.minR = 0;
  83144. }
  83145. // 值域范围
  83146. var codomain = this.DVBCodomain;
  83147. // 重要步骤:定义Circle数据视图框中单位值的含义,单位值:1所代表的长度
  83148. // 用户定义了值域范围
  83149. if (codomain && codomain[1] - codomain[0] > 0) {
  83150. this.DVBUnitValue = sets.maxR / (codomain[1] - codomain[0]);
  83151. } else {
  83152. //this.DVBUnitValue = sets.maxR / maxValue;
  83153. this.DVBUnitValue = sets.maxR;
  83154. }
  83155. var uv = this.DVBUnitValue;
  83156. //圆半径
  83157. var r = fv[0] * uv + sets.minR;
  83158. this.width = 2 * r;
  83159. this.height = 2 * r;
  83160. // 重要步骤:初始化参数
  83161. if (!this.initBaseParameter()) {
  83162. return;
  83163. }
  83164. //假如用户设置了值域范围 没有在值域范围直接返回
  83165. if (codomain) {
  83166. if (fv[0] < codomain[0] || fv[0] > codomain[1]) {
  83167. return;
  83168. }
  83169. }
  83170. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为圆心
  83171. //圆形对象参数
  83172. var circleSP = new Circle_Circle(dvbCenter[0], dvbCenter[1], r);
  83173. //circleSP.sytle 初始化
  83174. circleSP.style = ShapeFactory.ShapeStyleTool(null, sets.circleStyle, null, null, 0);
  83175. //图形的填充颜色
  83176. if (typeof (sets.fillColor) !== "undefined") {
  83177. //用户自定义
  83178. circleSP.style.fillColor = sets.fillColor;
  83179. } else {
  83180. //当前默认
  83181. circleSP.style.fillColor = defaultFillColor;
  83182. }
  83183. //圆形 Hover样式
  83184. circleSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.circleHoverStyle);
  83185. //圆形 Hover 与 click 设置
  83186. if (typeof(sets.circleHoverAble) !== "undefined") {
  83187. circleSP.hoverable = sets.circleHoverAble;
  83188. }
  83189. if (typeof(sets.circleClickAble) !== "undefined") {
  83190. circleSP.clickable = sets.circleClickAble;
  83191. }
  83192. //图形携带的数据信息
  83193. circleSP.refDataID = this.data.id;
  83194. circleSP.dataInfo = {
  83195. field: this.fields[0],
  83196. r: r,
  83197. value: fv[0]
  83198. };
  83199. // 创建扇形并把此扇形添加到图表图形数组
  83200. this.shapes.push(this.shapeFactory.createShape(circleSP));
  83201. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  83202. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  83203. this.shapesConvertToRelativeCoordinate();
  83204. }
  83205. }
  83206. ;// CONCATENATED MODULE: ./src/common/overlay/Line.js
  83207. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  83208. * This program are made available under the terms of the Apache License, Version 2.0
  83209. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83210. /**
  83211. * @class FeatureThemeLine
  83212. * @aliasclass Feature.Theme.Line
  83213. * @deprecatedclass SuperMap.Feature.Theme.Line
  83214. * @classdesc 折线图。
  83215. * @category Visualization Theme
  83216. * @example
  83217. * // pointStyleByCodomain 参数用法示例
  83218. * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  83219. * // start: 值域值下限(包含);
  83220. * // end: 值域值上限(不包含);
  83221. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <Point.style> 。
  83222. * // pointStyleByCodomain 数组形如:
  83223. * [
  83224. * {
  83225. * start:0,
  83226. * end:250,
  83227. * style:{
  83228. * fillColor:"#00CD00"
  83229. * }
  83230. * },
  83231. * {
  83232. * start:250,
  83233. * end:500,
  83234. * style:{
  83235. * fillColor:"#00EE00"
  83236. * }
  83237. * },
  83238. * {
  83239. * start:500,
  83240. * end:750,
  83241. * style:{
  83242. * fillColor:"#00FF7F"
  83243. * }
  83244. * },
  83245. * {
  83246. * start:750,
  83247. * end:1500,
  83248. * style:{
  83249. * fillColor:"#00FF00"
  83250. * }
  83251. * }
  83252. * ]
  83253. *
  83254. * @extends FeatureThemeGraph
  83255. * @param {FeatureVector} data - 用户数据。
  83256. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  83257. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  83258. * @param {FeatureThemeLine.setting} setting - 图表配置对象。
  83259. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  83260. * @usage
  83261. * @private
  83262. */
  83263. class Line extends Graph_Graph {
  83264. constructor(data, layer, fields, setting, lonlat, options) {
  83265. super(data, layer, fields, setting, lonlat, options);
  83266. this.CLASS_NAME = "SuperMap.Feature.Theme.Line";
  83267. }
  83268. /**
  83269. * @function FeatureThemeLine.prototype.destroy
  83270. * @override
  83271. */
  83272. destroy() {
  83273. super.destroy();
  83274. }
  83275. /**
  83276. * @function FeatureThemeLine.prototype.assembleShapes
  83277. * @description 装配图形(扩展接口)。
  83278. */
  83279. assembleShapes() {
  83280. // 图表配置对象
  83281. var sets = this.setting;
  83282. // 默认数据视图框
  83283. if (!sets.dataViewBoxParameter) {
  83284. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  83285. sets.dataViewBoxParameter = [45, 15, 15, 15];
  83286. } else {
  83287. sets.dataViewBoxParameter = [5, 5, 5, 5];
  83288. }
  83289. }
  83290. // 重要步骤:初始化参数
  83291. if (!this.initBaseParameter()) {
  83292. return;
  83293. }
  83294. var dvb = this.dataViewBox;
  83295. // 值域
  83296. var codomain = this.DVBCodomain;
  83297. // 重要步骤:定义图表 FeatureThemeBar 数据视图框中单位值的含义
  83298. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  83299. var uv = this.DVBUnitValue;
  83300. // 数据值数组
  83301. var fv = this.dataValues;
  83302. if (fv.length < 1) {
  83303. return;
  83304. } // 没有数据
  83305. // 获取 x 轴上的图形信息
  83306. var xShapeInfo = this.calculateXShapeInfo();
  83307. if (!xShapeInfo) {
  83308. return;
  83309. }
  83310. // 折线每个节点的 x 位置
  83311. var xsLoc = xShapeInfo.xPositions;
  83312. // 背景框,默认启用
  83313. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  83314. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  83315. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  83316. }
  83317. // 折线图必须使用坐标轴
  83318. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  83319. // var isDataEffective = true;
  83320. var xPx; // 折线节点 x 坐标
  83321. var yPx; // 折线节点 y 坐标
  83322. var poiLists = []; // 折线节点数组
  83323. var shapePois = []; // 折线节点图形数组
  83324. for (var i = 0, len = fv.length; i < len; i++) {
  83325. // 数据溢出值域检查
  83326. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  83327. // isDataEffective = false;
  83328. return null;
  83329. }
  83330. xPx = xsLoc[i];
  83331. yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
  83332. // 折线节点参数对象
  83333. var poiSP = new Point_Point(xPx, yPx);
  83334. // 折线节点 style
  83335. poiSP.style = ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
  83336. // 折线节点 hover 样式
  83337. poiSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
  83338. // 折线节点 hover click
  83339. if (typeof(sets.pointHoverAble) !== "undefined") {
  83340. poiSP.hoverable = sets.pointHoverAble;
  83341. }
  83342. if (typeof(sets.pointClickAble) !== "undefined") {
  83343. poiSP.clickable = sets.pointClickAble;
  83344. }
  83345. // 图形携带的数据信息
  83346. poiSP.refDataID = this.data.id;
  83347. poiSP.dataInfo = {
  83348. field: this.fields[i],
  83349. value: fv[i]
  83350. };
  83351. // 创建图形并把此图形添加到折线节点图形数组
  83352. shapePois.push(this.shapeFactory.createShape(poiSP));
  83353. // 添加折线节点到折线节点数组
  83354. var poi = [xPx, yPx];
  83355. poiLists.push(poi);
  83356. }
  83357. // 折线参数对象
  83358. var lineSP = new Line_Line(poiLists);
  83359. lineSP.style = ShapeFactory.ShapeStyleTool({strokeColor: "#ee9900"}, sets.lineStyle);
  83360. // 禁止事件响应
  83361. lineSP.clickable = false;
  83362. lineSP.hoverable = false;
  83363. var shapeLine = this.shapeFactory.createShape(lineSP);
  83364. this.shapes.push(shapeLine);
  83365. // 添加节点到图表图形数组
  83366. this.shapes = this.shapes.concat(shapePois);
  83367. // // 数据范围检测未通过,清空图形
  83368. // if (isDataEffective === false) {
  83369. // this.shapes = [];
  83370. // }
  83371. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  83372. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  83373. this.shapesConvertToRelativeCoordinate();
  83374. }
  83375. /**
  83376. * @function FeatureThemeLine.prototype.calculateXShapeInfo
  83377. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  83378. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  83379. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  83380. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  83381. * 本函数中图形配置对象 setting 可设属性:<br>
  83382. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  83383. * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
  83384. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
  83385. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。<br>
  83386. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  83387. */
  83388. calculateXShapeInfo() {
  83389. var dvb = this.dataViewBox; // 数据视图框
  83390. var sets = this.setting; // 图表配置对象
  83391. var fvc = this.dataValues.length; // 数组值个数
  83392. if (fvc < 1) {
  83393. return null;
  83394. }
  83395. var xBlank; // x 轴空白间隔参数
  83396. var xShapePositions = []; // x 轴上图形的位置
  83397. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  83398. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  83399. var unitOffset = 0; // 单位偏移量
  83400. // x 轴空白间隔参数处理
  83401. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
  83402. xBlank = sets.xShapeBlank;
  83403. var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
  83404. if (xsLen <= fvc) {
  83405. return null;
  83406. }
  83407. unitOffset = xsLen / (fvc - 1);
  83408. } else {
  83409. // 默认使用等距离空白间隔,空白间隔为图形宽度
  83410. unitOffset = dvbWidth / (fvc + 1);
  83411. xBlank = [unitOffset, unitOffset, unitOffset];
  83412. }
  83413. // 图形 x 轴上的位置计算
  83414. var xOffset = 0
  83415. for (var i = 0; i < fvc; i++) {
  83416. if (i == 0) {
  83417. xOffset = xBlank[0];
  83418. } else {
  83419. xOffset += unitOffset;
  83420. }
  83421. xShapePositions.push(dvb[0] + xOffset);
  83422. }
  83423. return {
  83424. "xPositions": xShapePositions,
  83425. "width": xShapeWidth
  83426. };
  83427. }
  83428. }
  83429. ;// CONCATENATED MODULE: ./src/common/overlay/Pie.js
  83430. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  83431. * This program are made available under the terms of the Apache License, Version 2.0
  83432. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83433. /**
  83434. * @class FeatureThemePie
  83435. * @aliasclass Feature.Theme.Pie
  83436. * @deprecatedclass SuperMap.Feature.Theme.Pie
  83437. * @classdesc 饼图。
  83438. * @category Visualization Theme
  83439. * @param {FeatureVector} data - 用户数据。
  83440. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  83441. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  83442. * @param {FeatureThemePoint.setting} setting - 图表配置对象。
  83443. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  83444. * @extends FeatureThemeGraph
  83445. * @example
  83446. * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  83447. * // start: 值域值下限(包含);
  83448. * // end: 值域值上限(不包含);
  83449. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersSector.style> 。
  83450. * // sectorStyleByCodomain 数组形如:
  83451. * [
  83452. * {
  83453. * start:0,
  83454. * end:250,
  83455. * style:{
  83456. * fillColor:"#00CD00"
  83457. * }
  83458. * },
  83459. * {
  83460. * start:250,
  83461. * end:500,
  83462. * style:{
  83463. * fillColor:"#00EE00"
  83464. * }
  83465. * },
  83466. * {
  83467. * start:500,
  83468. * end:750,
  83469. * style:{
  83470. * fillColor:"#00FF7F"
  83471. * }
  83472. * },
  83473. * {
  83474. * start:750,
  83475. * end:1500,
  83476. * style:{
  83477. * fillColor:"#00FF00"
  83478. * }
  83479. * }
  83480. * ]
  83481. * @usage
  83482. * @private
  83483. */
  83484. class Pie extends Graph_Graph {
  83485. constructor(data, layer, fields, setting, lonlat) {
  83486. super(data, layer, fields, setting, lonlat);
  83487. this.CLASS_NAME = "SuperMap.Feature.Theme.Pie";
  83488. }
  83489. /**
  83490. * @function FeatureThemePie.prototype.destroy
  83491. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  83492. */
  83493. destroy() {
  83494. super.destroy();
  83495. }
  83496. /**
  83497. * @function FeatureThemePie.prototype.assembleShapes
  83498. * @description 装配图形(扩展接口)。
  83499. */
  83500. assembleShapes() {
  83501. // 图表配置对象
  83502. var sets = this.setting;
  83503. // 一个默认 style 组
  83504. var defaultStyleGroup = [
  83505. {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
  83506. {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
  83507. {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
  83508. {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
  83509. {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
  83510. {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
  83511. ];
  83512. // 重要步骤:初始化参数
  83513. if (!this.initBaseParameter()) {
  83514. return;
  83515. }
  83516. // 背景框,默认不启用
  83517. if (sets.useBackground) {
  83518. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  83519. }
  83520. // 数据值数组
  83521. var fv = this.dataValues;
  83522. if (fv.length < 1) {
  83523. return;
  83524. } // 没有数据
  83525. // 值域范围
  83526. var codomain = this.DVBCodomain;
  83527. // 值域范围检测
  83528. for (let i = 0; i < fv.length; i++) {
  83529. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  83530. return;
  83531. }
  83532. }
  83533. // 值的绝对值总和
  83534. var valueSum = 0;
  83535. for (let i = 0; i < fv.length; i++) {
  83536. valueSum += Math.abs(fv[i]);
  83537. }
  83538. // 重要步骤:定义图表 FeatureThemePie 数据视图框中单位值的含义,单位值:每度代表的数值
  83539. this.DVBUnitValue = 360 / valueSum;
  83540. var uv = this.DVBUnitValue;
  83541. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
  83542. var startAngle = 0; // 扇形起始边角度
  83543. var endAngle = 0; // 扇形终止边角度
  83544. var startAngleTmp = startAngle; // 扇形临时起始边角度
  83545. // 扇形(自适应)半径
  83546. var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
  83547. for (var i = 0; i < fv.length; i++) {
  83548. var fvi = Math.abs(fv[i]);
  83549. //计算终止角
  83550. if (i === 0) {
  83551. endAngle = startAngle + fvi * uv;
  83552. } else if (i === fvi.length - 1) {
  83553. endAngle = startAngleTmp;
  83554. } else {
  83555. endAngle = startAngle + fvi * uv;
  83556. }
  83557. //矫正误差计算
  83558. if ((endAngle - startAngle) >= 360) {
  83559. endAngle = 359.9999999;
  83560. }
  83561. // 扇形参数对象
  83562. var sectorSP = new Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle);
  83563. // 扇形样式
  83564. if (typeof(sets.sectorStyleByFields) === "undefined") {
  83565. // 使用默认 style 组
  83566. var colorIndex = i % defaultStyleGroup.length;
  83567. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
  83568. } else {
  83569. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
  83570. }
  83571. // 扇形 hover 样式
  83572. sectorSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
  83573. // 扇形 hover 与 click 设置
  83574. if (typeof(sets.sectorHoverAble) !== "undefined") {
  83575. sectorSP.hoverable = sets.sectorHoverAble;
  83576. }
  83577. if (typeof(sets.sectorClickAble) !== "undefined") {
  83578. sectorSP.clickable = sets.sectorClickAble;
  83579. }
  83580. // 图形携带的数据信息
  83581. sectorSP.refDataID = this.data.id;
  83582. sectorSP.dataInfo = {
  83583. field: this.fields[i],
  83584. value: fv[i]
  83585. };
  83586. // 创建扇形并把此扇形添加到图表图形数组
  83587. this.shapes.push(this.shapeFactory.createShape(sectorSP));
  83588. // 把上一次的结束角度作为下一次的起始角度
  83589. startAngle = endAngle;
  83590. }
  83591. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  83592. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  83593. this.shapesConvertToRelativeCoordinate();
  83594. }
  83595. }
  83596. ;// CONCATENATED MODULE: ./src/common/overlay/Point.js
  83597. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  83598. * This program are made available under the terms of the Apache License, Version 2.0
  83599. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83600. /**
  83601. * @class FeatureThemePoint
  83602. * @aliasclass Feature.Theme.Point
  83603. * @deprecatedclass SuperMap.Feature.Theme.Point
  83604. * @classdesc 点状图。
  83605. * @category Visualization Theme
  83606. * @param {FeatureVector} data - 用户数据。
  83607. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  83608. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  83609. * @param {FeatureThemePoint.setting} setting - 图表配置对象。
  83610. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  83611. * @example
  83612. * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  83613. * // start: 值域值下限(包含);
  83614. * // end: 值域值上限(不包含);
  83615. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <Point.style> 。
  83616. * // pointStyleByCodomain 数组形如:
  83617. * [
  83618. * {
  83619. * start:0,
  83620. * end:250,
  83621. * style:{
  83622. * fillColor:"#00CD00"
  83623. * }
  83624. * },
  83625. * {
  83626. * start:250,
  83627. * end:500,
  83628. * style:{
  83629. * fillColor:"#00EE00"
  83630. * }
  83631. * },
  83632. * {
  83633. * start:500,
  83634. * end:750,
  83635. * style:{
  83636. * fillColor:"#00FF7F"
  83637. * }
  83638. * },
  83639. * {
  83640. * start:750,
  83641. * end:1500,
  83642. * style:{
  83643. * fillColor:"#00FF00"
  83644. * }
  83645. * }
  83646. * ]
  83647. * @extends FeatureThemeGraph
  83648. * @usage
  83649. * @private
  83650. */
  83651. class overlay_Point_Point extends Graph_Graph {
  83652. constructor(data, layer, fields, setting, lonlat, options) {
  83653. super(data, layer, fields, setting, lonlat, options);
  83654. this.CLASS_NAME = "SuperMap.Feature.Theme.Point";
  83655. }
  83656. /**
  83657. * @function FeatureThemePoint.prototype.destroy
  83658. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  83659. */
  83660. destroy() {
  83661. super.destroy();
  83662. }
  83663. /**
  83664. * @function FeatureThemePoint.prototype.Point.assembleShapes
  83665. * @description 装配图形(扩展接口)。
  83666. */
  83667. assembleShapes() {
  83668. // 图表配置对象
  83669. var sets = this.setting;
  83670. // 默认数据视图框
  83671. if (!sets.dataViewBoxParameter) {
  83672. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  83673. sets.dataViewBoxParameter = [45, 15, 15, 15];
  83674. } else {
  83675. sets.dataViewBoxParameter = [5, 5, 5, 5];
  83676. }
  83677. }
  83678. // 重要步骤:初始化参数
  83679. if (!this.initBaseParameter()) {
  83680. return;
  83681. }
  83682. var dvb = this.dataViewBox;
  83683. // 值域
  83684. var codomain = this.DVBCodomain;
  83685. // 重要步骤:定义图表 FeatureThemeBar 数据视图框中单位值的含义
  83686. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  83687. var uv = this.DVBUnitValue;
  83688. var fv = this.dataValues;
  83689. // 获取 x 轴上的图形信息
  83690. var xShapeInfo = this.calculateXShapeInfo();
  83691. if (!xShapeInfo) {
  83692. return;
  83693. }
  83694. // 折线每个节点的 x 位置
  83695. var xsLoc = xShapeInfo.xPositions;
  83696. // 背景框,默认启用
  83697. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  83698. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  83699. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  83700. }
  83701. // 点状图必须使用坐标轴
  83702. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  83703. var xPx; // 图形点 x 坐标
  83704. var yPx; // 图形点 y 坐标
  83705. for (var i = 0, len = fv.length; i < len; i++) {
  83706. // 数据溢出值域检查
  83707. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  83708. //isDataEffective = false;
  83709. return null;
  83710. }
  83711. xPx = xsLoc[i];
  83712. yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
  83713. // 图形点参数对象
  83714. var poiSP = new Point_Point(xPx, yPx);
  83715. // 图形点 style
  83716. poiSP.style = ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
  83717. // 图形点 hover 样式
  83718. poiSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
  83719. // 图形点 hover click
  83720. if (typeof(sets.pointHoverAble) !== "undefined") {
  83721. poiSP.hoverable = sets.pointHoverAble;
  83722. }
  83723. if (typeof(sets.pointClickAble) !== "undefined") {
  83724. poiSP.clickable = sets.pointClickAble;
  83725. }
  83726. // 图形携带的数据信息
  83727. poiSP.refDataID = this.data.id;
  83728. poiSP.dataInfo = {
  83729. field: this.fields[i],
  83730. value: fv[i]
  83731. };
  83732. // 创建图形点并把此图形添加到图表图形数组
  83733. this.shapes.push(this.shapeFactory.createShape(poiSP));
  83734. }
  83735. // 数据范围检测未通过,清空图形
  83736. // if (isDataEffective === false) {
  83737. // this.shapes = [];
  83738. // }
  83739. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  83740. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  83741. this.shapesConvertToRelativeCoordinate();
  83742. }
  83743. /**
  83744. * @function FeatureThemePoint.prototype.calculateXShapeInfo
  83745. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  83746. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  83747. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  83748. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  83749. * 本函数中图形配置对象 setting 可设属性:<br>
  83750. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  83751. * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
  83752. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
  83753. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  83754. * width - {number}表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  83755. */
  83756. calculateXShapeInfo() {
  83757. var dvb = this.dataViewBox; // 数据视图框
  83758. var sets = this.setting; // 图表配置对象
  83759. var fvc = this.dataValues.length; // 数组值个数
  83760. if (fvc < 1) {
  83761. return null;
  83762. }
  83763. var xBlank; // x 轴空白间隔参数
  83764. var xShapePositions = []; // x 轴上图形的位置
  83765. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  83766. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  83767. var unitOffset = 0; // 单位偏移量
  83768. // x 轴空白间隔参数处理
  83769. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
  83770. xBlank = sets.xShapeBlank;
  83771. var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
  83772. if (xsLen <= fvc) {
  83773. return null;
  83774. }
  83775. unitOffset = xsLen / (fvc - 1);
  83776. } else {
  83777. // 默认使用等距离空白间隔,空白间隔为图形宽度
  83778. unitOffset = dvbWidth / (fvc + 1);
  83779. xBlank = [unitOffset, unitOffset, unitOffset];
  83780. }
  83781. // 图形 x 轴上的位置计算
  83782. var xOffset = 0
  83783. for (var i = 0; i < fvc; i++) {
  83784. if (i == 0) {
  83785. xOffset = xBlank[0];
  83786. } else {
  83787. xOffset += unitOffset;
  83788. }
  83789. xShapePositions.push(dvb[0] + xOffset);
  83790. }
  83791. return {
  83792. "xPositions": xShapePositions,
  83793. "width": xShapeWidth
  83794. };
  83795. }
  83796. }
  83797. ;// CONCATENATED MODULE: ./src/common/overlay/Ring.js
  83798. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  83799. * This program are made available under the terms of the Apache License, Version 2.0
  83800. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83801. /**
  83802. * @class FeatureThemeRing
  83803. * @aliasclass Feature.Theme.Ring
  83804. * @deprecatedclass SuperMap.Feature.Theme.Ring
  83805. * @classdesc 环状图。
  83806. * @category Visualization Theme
  83807. * @description 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
  83808. * @param {FeatureVector} data - 用户数据。
  83809. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  83810. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  83811. * @param {FeatureThemeRing.setting} setting - 图表配置对象。
  83812. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  83813. * @example
  83814. * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  83815. * // start: 值域值下限(包含);
  83816. * // end: 值域值上限(不包含);
  83817. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersSector.style> 。
  83818. * // sectorStyleByCodomain 数组形如:
  83819. * [
  83820. * {
  83821. * start:0,
  83822. * end:250,
  83823. * style:{
  83824. * fillColor:"#00CD00"
  83825. * }
  83826. * },
  83827. * {
  83828. * start:250,
  83829. * end:500,
  83830. * style:{
  83831. * fillColor:"#00EE00"
  83832. * }
  83833. * },
  83834. * {
  83835. * start:500,
  83836. * end:750,
  83837. * style:{
  83838. * fillColor:"#00FF7F"
  83839. * }
  83840. * },
  83841. * {
  83842. * start:750,
  83843. * end:1500,
  83844. * style:{
  83845. * fillColor:"#00FF00"
  83846. * }
  83847. * }
  83848. * ]
  83849. * @param {Object} [sectorHoverStyle=true] - 环状图扇形 hover 状态时的样式,sectorHoverAble 为 true 时有效。
  83850. * @param {boolean} [sectorHoverAble=true] - 是否允许环状图扇形使用 hover 状态。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
  83851. * @param {boolean} [sectorClickAble=true] - 是否允许环状图扇形被点击。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
  83852. *
  83853. * @extends FeatureThemeGraph
  83854. * @usage
  83855. * @private
  83856. */
  83857. class Ring extends Graph_Graph {
  83858. constructor(data, layer, fields, setting, lonlat) {
  83859. super(data, layer, fields, setting, lonlat);
  83860. this.CLASS_NAME = "SuperMap.Feature.Theme.Ring";
  83861. }
  83862. /**
  83863. * @function FeatureThemeRing.prototype.destroy
  83864. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  83865. */
  83866. destroy() {
  83867. super.destroy();
  83868. }
  83869. /**
  83870. * @function FeatureThemeRing.prototype.assembleShapes
  83871. * @description 装配图形(扩展接口)。
  83872. */
  83873. assembleShapes() {
  83874. // 重要步骤:初始化参数
  83875. if (!this.initBaseParameter()) {
  83876. return;
  83877. }
  83878. // 一个默认 style 组
  83879. var defaultStyleGroup = [
  83880. {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
  83881. {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
  83882. {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
  83883. {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
  83884. {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
  83885. {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
  83886. ];
  83887. // 图表配置对象
  83888. var sets = this.setting;
  83889. // 背景框,默认不启用
  83890. if (sets.useBackground) {
  83891. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  83892. }
  83893. // 数据值数组
  83894. var fv = this.dataValues;
  83895. if (fv.length < 1) {
  83896. return;
  83897. } // 没有数据
  83898. // 值域范围
  83899. var codomain = this.DVBCodomain;
  83900. // 值域范围检测
  83901. for (let i = 0; i < fv.length; i++) {
  83902. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  83903. return;
  83904. }
  83905. }
  83906. // 值的绝对值总和
  83907. var valueSum = 0;
  83908. for (let i = 0; i < fv.length; i++) {
  83909. valueSum += Math.abs(fv[i]);
  83910. }
  83911. // 重要步骤:定义图表 FeatureThemeRing 数据视图框中单位值的含义,单位值:每度代表的数值
  83912. this.DVBUnitValue = 360 / valueSum;
  83913. var uv = this.DVBUnitValue;
  83914. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
  83915. var startAngle = 0; // 扇形起始边角度
  83916. var endAngle = 0; // 扇形终止边角度
  83917. var startAngleTmp = startAngle; // 扇形临时起始边角度
  83918. // 扇形外环(自适应)半径
  83919. var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
  83920. // 扇形内环(自适应)半径
  83921. var isInRange = sets.innerRingRadius >= 0 && sets.innerRingRadius < r;
  83922. var r0 = (
  83923. typeof(sets.innerRingRadius) !== "undefined"
  83924. && !isNaN(sets.innerRingRadius)
  83925. && isInRange
  83926. ) ? sets.innerRingRadius : 0;
  83927. for (var i = 0; i < fv.length; i++) {
  83928. var fvi = Math.abs(fv[i]);
  83929. // 计算结束角度
  83930. if (i === 0) {
  83931. endAngle = startAngle + fvi * uv;
  83932. } else if (i === fvi.length - 1) {
  83933. endAngle = startAngleTmp;
  83934. } else {
  83935. endAngle = startAngle + fvi * uv;
  83936. }
  83937. // 扇形参数对象
  83938. var sectorSP = new Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle, r0);
  83939. // 扇形样式
  83940. if (typeof(sets.sectorStyleByFields) === "undefined") {
  83941. // 使用默认 style 组
  83942. var colorIndex = i % defaultStyleGroup.length;
  83943. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
  83944. } else {
  83945. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
  83946. }
  83947. // 扇形 hover 样式
  83948. sectorSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
  83949. // 扇形 hover 与 click 设置
  83950. if (typeof(sets.sectorHoverAble) !== "undefined") {
  83951. sectorSP.hoverable = sets.sectorHoverAble;
  83952. }
  83953. if (typeof(sets.sectorClickAble) !== "undefined") {
  83954. sectorSP.clickable = sets.sectorClickAble;
  83955. }
  83956. // 图形携带的数据信息
  83957. sectorSP.refDataID = this.data.id;
  83958. sectorSP.dataInfo = {
  83959. field: this.fields[i],
  83960. value: fv[i]
  83961. };
  83962. // 创建扇形并把此扇形添加到图表图形数组
  83963. this.shapes.push(this.shapeFactory.createShape(sectorSP));
  83964. // 把上一次的结束角度作为下一次的起始角度
  83965. startAngle = endAngle;
  83966. }
  83967. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  83968. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  83969. this.shapesConvertToRelativeCoordinate();
  83970. }
  83971. }
  83972. ;// CONCATENATED MODULE: ./src/common/overlay/feature/index.js
  83973. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  83974. * This program are made available under the terms of the Apache License, Version 2.0
  83975. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83976. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicEllipse.js
  83977. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  83978. * This program are made available under the terms of the Apache License, Version 2.0
  83979. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83980. /**
  83981. * @private
  83982. * @class LevelRenderer.Shape.SmicEllipse
  83983. * @category Visualization Theme
  83984. * @classdesc 椭圆。
  83985. * @extends LevelRenderer.Shape
  83986. * @example
  83987. * var shape = new LevelRenderer.Shape.SmicEllipse({
  83988. * style: {
  83989. * x: 100,
  83990. * y: 100,
  83991. * a: 40,
  83992. * b: 20,
  83993. * brushType: 'both',
  83994. * color: 'blue',
  83995. * strokeColor: 'red',
  83996. * lineWidth: 3,
  83997. * text: 'SmicEllipse'
  83998. * }
  83999. * });
  84000. * levelRenderer.addShape(shape);
  84001. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  84002. *
  84003. */
  84004. class SmicEllipse extends (/* unused pure expression or super */ null && (Shape)) {
  84005. constructor(options) {
  84006. super(options);
  84007. /**
  84008. * @member {string} LevelRenderer.Shape.SmicEllipse.prototype.type
  84009. * @description 图形类型。
  84010. */
  84011. this.type = 'smicellipse';
  84012. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  84013. this.refOriginalPosition = [0, 0];
  84014. }
  84015. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicEllipse";
  84016. }
  84017. /**
  84018. * @function LevelRenderer.Shape.SmicEllipse.prototype.destroy
  84019. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  84020. */
  84021. destroy() {
  84022. this.type = null;
  84023. super.destroy();
  84024. }
  84025. /**
  84026. * @function LevelRenderer.Shape.SmicEllipse.prototype.buildPath
  84027. * @description 构建椭圆的 Path。
  84028. *
  84029. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  84030. * @param {Object} style - style。
  84031. *
  84032. */
  84033. buildPath(ctx, style) {
  84034. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  84035. this.refOriginalPosition = [0, 0];
  84036. }
  84037. var __OP = this.refOriginalPosition;
  84038. var k = 0.5522848;
  84039. var x = style.x + __OP[0];
  84040. var y = style.y + __OP[1];
  84041. var a = style.a;
  84042. var b = style.b;
  84043. var ox = a * k; // 水平控制点偏移量
  84044. var oy = b * k; // 垂直控制点偏移量
  84045. // 从椭圆的左端点开始顺时针绘制四条三次贝塞尔曲线
  84046. ctx.moveTo(x - a, y);
  84047. ctx.bezierCurveTo(x - a, y - oy, x - ox, y - b, x, y - b);
  84048. ctx.bezierCurveTo(x + ox, y - b, x + a, y - oy, x + a, y);
  84049. ctx.bezierCurveTo(x + a, y + oy, x + ox, y + b, x, y + b);
  84050. ctx.bezierCurveTo(x - ox, y + b, x - a, y + oy, x - a, y);
  84051. ctx.closePath();
  84052. }
  84053. /**
  84054. * @function LevelRenderer.Shape.SmicEllipse.prototype.getRect
  84055. * @description 计算返回椭圆包围盒矩形
  84056. *
  84057. * @param {Object} style - style
  84058. * @return {Object} 边框对象。包含属性:x,y,width,height。
  84059. *
  84060. */
  84061. getRect(style) {
  84062. if (style.__rect) {
  84063. return style.__rect;
  84064. }
  84065. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  84066. this.refOriginalPosition = [0, 0];
  84067. }
  84068. var __OP = this.refOriginalPosition;
  84069. var lineWidth;
  84070. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  84071. lineWidth = style.lineWidth || 1;
  84072. } else {
  84073. lineWidth = 0;
  84074. }
  84075. style.__rect = {
  84076. x: Math.round((style.x + __OP[0]) - style.a - lineWidth / 2),
  84077. y: Math.round((style.x + __OP[1]) - style.b - lineWidth / 2),
  84078. width: style.a * 2 + lineWidth,
  84079. height: style.b * 2 + lineWidth
  84080. };
  84081. return style.__rect;
  84082. }
  84083. }
  84084. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicIsogon.js
  84085. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84086. * This program are made available under the terms of the Apache License, Version 2.0
  84087. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84088. /**
  84089. * @private
  84090. * @class LevelRenderer.Shape.SmicIsogon
  84091. * @category Visualization Theme
  84092. * @classdesc 正多边形。
  84093. * @extends LevelRenderer.Shape
  84094. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  84095. */
  84096. class SmicIsogon extends (/* unused pure expression or super */ null && (Shape)) {
  84097. constructor(options) {
  84098. super(options);
  84099. /**
  84100. * @member {string} LevelRenderer.Shape.SmicIsogon.prototype.type
  84101. * @description 图形类型。
  84102. */
  84103. this.type = 'smicisogon';
  84104. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  84105. this.refOriginalPosition = [0, 0];
  84106. }
  84107. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicIsogon";
  84108. }
  84109. /**
  84110. * @function LevelRenderer.Shape.SmicIsogon.prototype.destroy
  84111. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  84112. */
  84113. destroy() {
  84114. this.type = null;
  84115. super.destroy();
  84116. }
  84117. /**
  84118. * @function LevelRenderer.Shape.SmicIsogon.prototype.buildPath
  84119. * @description 创建n角星(n>=3)路径。
  84120. *
  84121. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  84122. * @param {Object} style - style。
  84123. *
  84124. */
  84125. buildPath(ctx, style) {
  84126. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  84127. this.refOriginalPosition = [0, 0];
  84128. }
  84129. var __OP = this.refOriginalPosition;
  84130. var sin = SUtil.Util_math.sin;
  84131. var cos = SUtil.Util_math.cos;
  84132. var PI = Math.PI;
  84133. var n = style.n;
  84134. if (!n || n < 2) {
  84135. return;
  84136. }
  84137. var x = style.x + __OP[0];
  84138. var y = style.y + __OP[1];
  84139. var r = style.r;
  84140. var dStep = 2 * PI / n;
  84141. var deg = -PI / 2;
  84142. var xStart = x + r * cos(deg);
  84143. var yStart = y + r * sin(deg);
  84144. deg += dStep;
  84145. // 记录边界点,用于判断insight
  84146. var pointList = style.pointList = [];
  84147. pointList.push([xStart, yStart]);
  84148. for (let i = 0, end = n - 1; i < end; i++) {
  84149. pointList.push([x + r * cos(deg), y + r * sin(deg)]);
  84150. deg += dStep;
  84151. }
  84152. pointList.push([xStart, yStart]);
  84153. // 绘制
  84154. ctx.moveTo(pointList[0][0], pointList[0][1]);
  84155. for (let i = 0; i < pointList.length; i++) {
  84156. ctx.lineTo(pointList[i][0], pointList[i][1]);
  84157. }
  84158. ctx.closePath();
  84159. return;
  84160. }
  84161. /**
  84162. * @function LevelRenderer.Shape.SmicIsogon.prototype.getRect
  84163. * @description 计算返回正多边形的包围盒矩形。
  84164. *
  84165. * @param {Object} style - style
  84166. * @return {Object} 边框对象。包含属性:x,y,width,height。
  84167. */
  84168. getRect(style) {
  84169. if (style.__rect) {
  84170. return style.__rect;
  84171. }
  84172. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  84173. this.refOriginalPosition = [0, 0];
  84174. }
  84175. var __OP = this.refOriginalPosition;
  84176. var lineWidth;
  84177. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  84178. lineWidth = style.lineWidth || 1;
  84179. } else {
  84180. lineWidth = 0;
  84181. }
  84182. style.__rect = {
  84183. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  84184. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  84185. width: style.r * 2 + lineWidth,
  84186. height: style.r * 2 + lineWidth
  84187. };
  84188. return style.__rect;
  84189. }
  84190. }
  84191. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRing.js
  84192. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84193. * This program are made available under the terms of the Apache License, Version 2.0
  84194. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84195. /**
  84196. * @private
  84197. * @class LevelRenderer.Shape.SmicRing
  84198. * @category Visualization Theme
  84199. * @classdesc 圆环。
  84200. * @extends LevelRenderer.Shape
  84201. * @example
  84202. * var shape = new LevelRenderer.Shape.SmicRing({
  84203. * style: {
  84204. * x: 100,
  84205. * y: 100,
  84206. * r0: 30,
  84207. * r: 50
  84208. * }
  84209. * });
  84210. * levelRenderer.addShape(shape);
  84211. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  84212. */
  84213. class SmicRing extends (/* unused pure expression or super */ null && (Shape)) {
  84214. constructor(options) {
  84215. super(options);
  84216. /**
  84217. * @member {string} LevelRenderer.Shape.SmicRing.prototype.type
  84218. * @description 图形类型。
  84219. */
  84220. this.type = 'smicring';
  84221. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  84222. this.refOriginalPosition = [0, 0];
  84223. }
  84224. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRing";
  84225. }
  84226. /**
  84227. * @function LevelRenderer.Shape.SmicRing.prototype.destroy
  84228. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  84229. */
  84230. destroy() {
  84231. this.type = null;
  84232. super.destroy();
  84233. }
  84234. /**
  84235. * @function LevelRenderer.Shape.SmicRing.prototype.buildPath
  84236. * @description 创建圆环路径。
  84237. *
  84238. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  84239. * @param {Object} style - style。
  84240. *
  84241. */
  84242. buildPath(ctx, style) {
  84243. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  84244. this.refOriginalPosition = [0, 0];
  84245. }
  84246. var __OP = this.refOriginalPosition;
  84247. // 非零环绕填充优化
  84248. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, false);
  84249. ctx.moveTo((style.x + __OP[0]) + style.r0, style.y + __OP[1]);
  84250. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r0, 0, Math.PI * 2, true);
  84251. return;
  84252. }
  84253. /**
  84254. * @function LevelRenderer.Shape.SmicRing.prototype.getRect
  84255. * @description 计算返回圆环包围盒矩阵
  84256. *
  84257. * @param {Object} style - style
  84258. * @return {Object} 边框对象。包含属性:x,y,width,height。
  84259. */
  84260. getRect(style) {
  84261. if (style.__rect) {
  84262. return style.__rect;
  84263. }
  84264. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  84265. this.refOriginalPosition = [0, 0];
  84266. }
  84267. var __OP = this.refOriginalPosition;
  84268. var lineWidth;
  84269. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  84270. lineWidth = style.lineWidth || 1;
  84271. } else {
  84272. lineWidth = 0;
  84273. }
  84274. style.__rect = {
  84275. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  84276. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  84277. width: style.r * 2 + lineWidth,
  84278. height: style.r * 2 + lineWidth
  84279. };
  84280. return style.__rect;
  84281. }
  84282. }
  84283. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicStar.js
  84284. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84285. * This program are made available under the terms of the Apache License, Version 2.0
  84286. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84287. /**
  84288. * @private
  84289. * @class LevelRenderer.Shape.SmicStar
  84290. * @category Visualization Theme
  84291. * @classdesc n 角星(n>3)。
  84292. * @extends LevelRenderer.Shape
  84293. * @example
  84294. * var shape = new LevelRenderer.Shape.SmicStar({
  84295. * style: {
  84296. * x: 200,
  84297. * y: 100,
  84298. * r: 150,
  84299. * n: 5,
  84300. * text: '五角星'
  84301. * }
  84302. * });
  84303. * levelRenderer.addShape(shape);
  84304. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  84305. *
  84306. */
  84307. class SmicStar extends (/* unused pure expression or super */ null && (Shape)) {
  84308. constructor(options) {
  84309. super(options);
  84310. /**
  84311. * @member {string} LevelRenderer.Shape.SmicStar.prototype.type
  84312. * @description 图形类型。
  84313. */
  84314. this.type = 'smicstar';
  84315. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  84316. this.refOriginalPosition = [0, 0];
  84317. }
  84318. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicStar";
  84319. }
  84320. /**
  84321. * @function LevelRenderer.Shape.SmicStar.prototype.destroy
  84322. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  84323. */
  84324. destroy() {
  84325. this.type = null;
  84326. super.destroy();
  84327. }
  84328. /**
  84329. * @function LevelRenderer.Shape.SmicStar.prototype.buildPath
  84330. * @description 创建n 角星(n>3)路径。
  84331. *
  84332. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  84333. * @param {Object} style - style。
  84334. *
  84335. */
  84336. buildPath(ctx, style) {
  84337. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  84338. this.refOriginalPosition = [0, 0];
  84339. }
  84340. var __OP = this.refOriginalPosition;
  84341. var n = style.n;
  84342. if (!n || n < 2) {
  84343. return;
  84344. }
  84345. var sin = SUtil.Util_math.sin;
  84346. var cos = SUtil.Util_math.cos;
  84347. var PI = Math.PI;
  84348. var x = style.x + __OP[0];
  84349. var y = style.y + __OP[1];
  84350. var r = style.r;
  84351. var r0 = style.r0;
  84352. // 如果未指定内部顶点外接圆半径,则自动计算
  84353. if (r0 == null) {
  84354. r0 = n > 4
  84355. // 相隔的外部顶点的连线的交点,
  84356. // 被取为内部交点,以此计算r0
  84357. ? r * cos(2 * PI / n) / cos(PI / n)
  84358. // 二三四角星的特殊处理
  84359. : r / 3;
  84360. }
  84361. var dStep = PI / n;
  84362. var deg = -PI / 2;
  84363. var xStart = x + r * cos(deg);
  84364. var yStart = y + r * sin(deg);
  84365. deg += dStep;
  84366. // 记录边界点,用于判断inside
  84367. var pointList = style.pointList = [];
  84368. pointList.push([xStart, yStart]);
  84369. for (var i = 0, end = n * 2 - 1, ri; i < end; i++) {
  84370. ri = i % 2 === 0 ? r0 : r;
  84371. pointList.push([x + ri * cos(deg), y + ri * sin(deg)]);
  84372. deg += dStep;
  84373. }
  84374. pointList.push([xStart, yStart]);
  84375. // 绘制
  84376. ctx.moveTo(pointList[0][0], pointList[0][1]);
  84377. for (let i = 0; i < pointList.length; i++) {
  84378. ctx.lineTo(pointList[i][0], pointList[i][1]);
  84379. }
  84380. ctx.closePath();
  84381. return;
  84382. }
  84383. /**
  84384. * @function LevelRenderer.Shape.SmicStar.prototype.getRect
  84385. * @description 返回 n 角星包围盒矩形。
  84386. *
  84387. * @param {Object} style - style
  84388. * @return {Object} 边框对象。包含属性:x,y,width,height。
  84389. */
  84390. getRect(style) {
  84391. if (style.__rect) {
  84392. return style.__rect;
  84393. }
  84394. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  84395. this.refOriginalPosition = [0, 0];
  84396. }
  84397. var __OP = this.refOriginalPosition;
  84398. var lineWidth;
  84399. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  84400. lineWidth = style.lineWidth || 1;
  84401. } else {
  84402. lineWidth = 0;
  84403. }
  84404. style.__rect = {
  84405. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  84406. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  84407. width: style.r * 2 + lineWidth,
  84408. height: style.r * 2 + lineWidth
  84409. };
  84410. return style.__rect;
  84411. }
  84412. }
  84413. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/index.js
  84414. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84415. * This program are made available under the terms of the Apache License, Version 2.0
  84416. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84417. ;// CONCATENATED MODULE: ./src/common/overlay/index.js
  84418. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84419. * This program are made available under the terms of the Apache License, Version 2.0
  84420. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84421. ;// CONCATENATED MODULE: ./src/common/components/CommonTypes.js
  84422. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84423. * This program are made available under the terms of the Apache License, Version 2.0
  84424. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84425. /**
  84426. * @description 该文件用于存储一些公用常量
  84427. * @private
  84428. */
  84429. const CommonTypes_FileTypes = {
  84430. EXCEL: "EXCEL",
  84431. CSV: "CSV",
  84432. ISERVER: "ISERVER",
  84433. GEOJSON: "GEOJSON",
  84434. JSON: 'JSON'
  84435. };
  84436. const CommonTypes_FileConfig = {
  84437. fileMaxSize: 10 * 1024 * 1024
  84438. };
  84439. ;// CONCATENATED MODULE: ./src/common/components/openfile/FileModel.js
  84440. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84441. * This program are made available under the terms of the Apache License, Version 2.0
  84442. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84443. /**
  84444. * @class FileModel
  84445. * @deprecatedclass SuperMap.FileModel
  84446. * @description 文件数据组件数据模型,用于存储一些文件数据或状态,todo 结构待完善
  84447. * @category Components OpenFile
  84448. * @private
  84449. */
  84450. class FileModel {
  84451. constructor(options) {
  84452. this.FileTypes = FileTypes;
  84453. this.FileConfig = FileConfig;
  84454. this.loadFileObject = options && options.loadFileObject ? options.loadFileObject : [];
  84455. }
  84456. /**
  84457. * @function FileModel.prototype.set
  84458. * @description 设置属性值
  84459. * @param {string} key - 属性名称
  84460. * @param {string|Object} value - 属性值
  84461. */
  84462. set(key, value) {
  84463. this[key] = value;
  84464. }
  84465. /**
  84466. * @function FileModel.prototype.get
  84467. * @description 获取数据值
  84468. * @param {string} key - 属性名称
  84469. * @returns {string|Object} value - 返回属性值
  84470. */
  84471. get(key) {
  84472. return this[key];
  84473. }
  84474. }
  84475. ;// CONCATENATED MODULE: ./src/common/components/messagebox/MessageBox.js
  84476. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84477. * This program are made available under the terms of the Apache License, Version 2.0
  84478. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84479. /**
  84480. * @class MessageBox
  84481. * @aliasclass Components.MessageBox
  84482. * @deprecatedclass SuperMap.Components.MessageBox
  84483. * @version 9.1.1
  84484. * @classdesc 组件信息提示框。
  84485. * @category Components Common
  84486. * @usage
  84487. */
  84488. class MessageBox {
  84489. constructor() {
  84490. this._initView();
  84491. }
  84492. _initView() {
  84493. //原生js形式
  84494. const messageBoxContainer = document.createElement("div");
  84495. messageBoxContainer.hidden = true;
  84496. messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
  84497. //图标
  84498. const iconContainer = document.createElement("div");
  84499. iconContainer.setAttribute("class", "icon");
  84500. this.icon = document.createElement("span");
  84501. this.icon.setAttribute("class", "supermapol-icons-message-warning");
  84502. iconContainer.appendChild(this.icon);
  84503. messageBoxContainer.appendChild(iconContainer);
  84504. //内容:
  84505. const messageBox = document.createElement("div");
  84506. messageBox.setAttribute("class", "component-messagebox");
  84507. messageBox.innerHTML = "";
  84508. messageBoxContainer.appendChild(messageBox);
  84509. this.messageBox = messageBox;
  84510. //关闭按钮
  84511. const cancelContainer = document.createElement("div");
  84512. cancelContainer.setAttribute("class", "component-messagebox__cancelbtncontainer");
  84513. const cancelBtn = document.createElement("button");
  84514. cancelBtn.setAttribute("class", "component-messagebox__cancelBtn");
  84515. cancelBtn.innerHTML = "x";
  84516. cancelBtn.onclick = this.closeView.bind(this);
  84517. cancelContainer.appendChild(cancelBtn);
  84518. messageBoxContainer.appendChild(cancelContainer);
  84519. this.messageBoxContainer = messageBoxContainer;
  84520. document.body.appendChild(this.messageBoxContainer);
  84521. }
  84522. /**
  84523. * @function MessageBox.prototype.closeView
  84524. * @description 关闭提示框。
  84525. */
  84526. closeView() {
  84527. this.messageBoxContainer.hidden = true;
  84528. }
  84529. /**
  84530. * @function MessageBox.prototype.showView
  84531. * @description 显示提示框。
  84532. * @param {string} message - 提示框显示内容。
  84533. * @param {string}[type="warring"] 提示框类型,如 "warring", "failure", "success"。
  84534. */
  84535. showView(message, type = 'warring') {
  84536. //设置提示框的样式:
  84537. if (type === "success") {
  84538. this.icon.setAttribute("class", "supermapol-icons-message-success");
  84539. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-green");
  84540. } else if (type === "failure") {
  84541. this.icon.setAttribute("class", "supermapol-icons-message-failure");
  84542. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-red");
  84543. } else if (type === "warring") {
  84544. this.icon.setAttribute("class", "supermapol-icons-message-warning");
  84545. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
  84546. }
  84547. this.messageBox.innerHTML = message;
  84548. this.messageBoxContainer.hidden = false;
  84549. }
  84550. }
  84551. ;// CONCATENATED MODULE: external "function(){try{return echarts}catch(e){return {}}}()"
  84552. const external_function_try_return_echarts_catch_e_return_namespaceObject = function(){try{return echarts}catch(e){return {}}}();
  84553. ;// CONCATENATED MODULE: ./src/common/lang/locales/en-US.js
  84554. 
  84555. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84556. * This program are made available under the terms of the Apache License, Version 2.0
  84557. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84558. /**
  84559. * Namespace: SuperMap.Lang["en"]
  84560. * Dictionary for English. Keys for entries are used in calls to
  84561. * <SuperMap.Lang.translate>. Entry bodies are normal strings or
  84562. * strings formatted for use with <SuperMap.String.format> calls.
  84563. */
  84564. let en = {
  84565. 'title_dataFlowService': 'Data Flow Service',
  84566. 'title_distributedAnalysis': 'Distributed Analysis',
  84567. 'title_clientComputing': 'Client Computing',
  84568. 'title_dataServiceQuery': 'Data Service Query',
  84569. 'title_searchCity':'Search city',
  84570. 'title_searchLayer':' Search layer',
  84571. 'text_input_value_inputDataFlowUrl': 'Please enter the data stream service address such as: ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
  84572. 'text_displayFeaturesInfo': 'Display feature information',
  84573. 'text_subscribe': 'subscribe',
  84574. 'text_cancelSubscribe': 'unsubscribe',
  84575. 'text_densityAnalysis': 'Density Analysis',
  84576. 'text_CalculateTheValuePerUnitArea': 'Calculate the value per unit area within the neighborhood shape',
  84577. 'text_option_selectDataset':'Please select a dataset',
  84578. 'text_label_dataset': 'Dataset',
  84579. 'text_option_simplePointDensityAnalysis': 'Simple point density analysis',
  84580. 'text_option_nuclearDensityAnalysis': 'Nuclear density analysis',
  84581. 'text_label_analyticalMethod': 'Analytical method',
  84582. 'text_option_quadrilateral': 'Quadrilateral',
  84583. 'text_option_hexagon': 'hexagon',
  84584. 'text_label_meshType': 'Mesh type',
  84585. 'text_option_notSet': 'Not set',
  84586. 'text_label_weightField': 'Weight field',
  84587. 'text_label_gridSizeInMeters': 'Grid size',
  84588. 'text_label_searchRadius': 'Search radius',
  84589. 'text_label_queryRange': 'Scope of analysis',
  84590. 'text_label_areaUnit': 'Area unit',
  84591. 'text_option_equidistantSegmentation': 'Equidistant segmentation',
  84592. 'text_option_logarithm': 'Logarithm',
  84593. 'text_option_equalCountingSegment': 'Equal counting segment',
  84594. 'text_option_squareRootSegmentation': 'Square root segmentation',
  84595. 'text_label_thematicMapSegmentationMode': 'Thematic map segmentation mode',
  84596. 'text_label_thematicMapSegmentationParameters': 'Thematic map segmentation parameters',
  84597. 'text_option_greenOrangePurpleGradient': 'Green orange purple gradient',
  84598. 'text_option_greenOrangeRedGradient': 'Green orange red gradient',
  84599. 'text_option_rainbowGradient': 'Rainbow gradient',
  84600. 'text_option_spectralGradient': 'Spectral gradient',
  84601. 'text_option_terrainGradient': 'Terrain gradient',
  84602. 'text_label_thematicMapColorGradientMode': 'Thematic map color gradient mode',
  84603. 'text_label_resultLayerName': 'Result layer name',
  84604. 'text_chooseFile': 'Open File',
  84605. 'text_isoline': 'Isoline',
  84606. 'text_extractDiscreteValue': 'Extract discrete value generation curve',
  84607. 'text_buffer': 'Buffer',
  84608. 'text_specifyTheDistance': 'Specify the distance to create the surrounding area',
  84609. 'text_label_analysisLayer': 'Analysis layer',
  84610. 'text_label_extractField': 'Extract field',
  84611. 'text_label_extractedValue': 'Extracted value',
  84612. 'text_label_distanceAttenuation': 'Distance attenuation',
  84613. 'text_label_gridSize': 'gridSize',
  84614. 'text_label_bufferRadius': 'Buffer radius',
  84615. 'text_label_defaultkilometers': 'Default 10 kilometers',
  84616. 'text_label_kilometer': 'kilometer',
  84617. 'text_label_unit': 'unit',
  84618. 'text_retainOriginal': 'Retain original object field',
  84619. 'text_mergeBuffer': 'Merge buffer',
  84620. 'text_label_color': 'Color',
  84621. 'text_label_buffer': '[Buffer]',
  84622. 'text_label_isolines': '[Isolines]',
  84623. 'text_label_queryRangeTips': 'The default is the full range of input data. Example: -74.050, 40.650, -73.850, 40.850',
  84624. 'text_label_queryModel': 'Query mode',
  84625. 'text_label_IDArrayOfFeatures': 'ID array of features',
  84626. 'text_label_maxFeatures': 'The maximum number of features that can be returned',
  84627. 'text_label_bufferDistance': 'Buffer distance',
  84628. 'text_label_queryRange1': 'Query range',
  84629. 'text_label_spatialQueryMode': 'Spatial query mode',
  84630. 'text_label_featureFilter': 'Feature filter',
  84631. 'text_label_geometricObject': 'Geometric object',
  84632. 'text_label_queryMode': 'Query mode',
  84633. 'text_label_searchTips': 'Search for city locations or layer features',
  84634. 'text_label_chooseSearchLayers': 'Select a query layer',
  84635. 'text_loadSearchCriteria': 'Load search criteria',
  84636. 'text_saveSearchCriteria': 'Save search criteria',
  84637. "btn_analyze": "Analyze",
  84638. "btn_analyzing": "Analyzing",
  84639. "btn_emptyTheAnalysisLayer": "Empty the analysis layer",
  84640. "btn_cancelAnalysis": "Cancel",
  84641. "btn_query": "Query",
  84642. "btn_querying": "Querying",
  84643. "btn_emptyTheRresultLayer": "Clear all result layers",
  84644. 'msg_dataReturnedIsEmpty.': 'The request is successful and the data returned by the query is empty.',
  84645. 'msg_dataFlowServiceHasBeenSubscribed': 'The data stream service has been subscribed to.',
  84646. 'msg_inputDataFlowUrlFirst': 'Please enter the data stream service address first.',
  84647. 'msg_datasetOrMethodUnsupport': 'This dataset does not support this analysis type. Please reselect the dataset.',
  84648. 'msg_selectDataset': 'Please select a data set!',
  84649. 'msg_setTheWeightField': 'Please set the weight field!',
  84650. 'msg_theFieldNotSupportAnalysis': 'The field you currently select does not support analysis!',
  84651. 'msg_resultIsEmpty': 'The result of the analysis is empty!',
  84652. 'msg_openFileFail': 'Failed to open file!',
  84653. 'msg_fileTypeUnsupported': 'File format is not supported!',
  84654. 'msg_fileSizeExceeded': 'File size exceeded! The file size should not exceed 10M!',
  84655. 'msg_dataInWrongGeoJSONFormat': 'Wrong data format! Non standard GEOJSON format data!',
  84656. 'msg_dataInWrongFormat': 'Wrong data format! Non standard EXCEL, CSV or GEOJSON format data!',
  84657. 'msg_searchKeywords': "Search keywords cannot be empty. Please enter your search criteria.",
  84658. 'msg_searchGeocodeField':"Did not match the address matching service data!",
  84659. 'msg_cityGeocodeField':"The address matching service of the current city is not configured.",
  84660. 'msg_getFeatureField':"No related vector features found!",
  84661. 'msg_dataflowservicesubscribed':'The data stream service has been subscribed to.',
  84662. 'msg_subscribesucceeded':'The data stream service subscription was successful.',
  84663. 'msg_crsunsupport':'Does not support the coordinate system of the current map',
  84664. 'msg_tilematrixsetunsupport':'Incoming TileMatrixSet is not supported',
  84665. 'msg_jsonResolveFiled': 'JSON format parsing failure!',
  84666. 'msg_requestContentFiled': 'Failed to request data through iportal!',
  84667. 'msg_getdatafailed': 'Failed to get data!'
  84668. };
  84669. ;// CONCATENATED MODULE: ./src/common/lang/locales/zh-CN.js
  84670. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84671. * This program are made available under the terms of the Apache License, Version 2.0
  84672. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84673. /**
  84674. * Namespace: SuperMap.Lang["zh-CN"]
  84675. * Dictionary for Simplified Chinese. Keys for entries are used in calls to
  84676. * <SuperMap.Lang.translate>. Entry bodies are normal strings or
  84677. * strings formatted for use with <SuperMap.String.format> calls.
  84678. */
  84679. let zh = {
  84680. 'title_dataFlowService': '数据流服务',
  84681. 'title_distributedAnalysis': '分布式分析',
  84682. 'title_clientComputing': '客户端计算',
  84683. 'title_dataServiceQuery': '数据服务查询',
  84684. 'title_searchCity':'搜索城市',
  84685. 'title_searchLayer':'搜索图层',
  84686. 'text_input_value_inputDataFlowUrl': '请输入数据流服务地址如:ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
  84687. 'text_displayFeaturesInfo': '显示要素信息',
  84688. 'text_subscribe': '订阅',
  84689. 'text_cancelSubscribe': '取消订阅',
  84690. 'text_densityAnalysis': '密度分析',
  84691. 'text_CalculateTheValuePerUnitArea': '计算点指定邻域形状内的每单位面积量值',
  84692. 'text_option_selectDataset':'请选择数据集',
  84693. 'text_label_dataset': '数据集',
  84694. 'text_option_simplePointDensityAnalysis': '简单点密度分析',
  84695. 'text_option_nuclearDensityAnalysis': '核密度分析',
  84696. 'text_label_analyticalMethod': '分析方法',
  84697. 'text_option_quadrilateral': '四边形',
  84698. 'text_option_hexagon': '六边形',
  84699. 'text_label_meshType': '网格面类型',
  84700. 'text_option_notSet': '未设置',
  84701. 'text_label_weightField': '权重字段',
  84702. 'text_label_gridSizeInMeters': '网格大小',
  84703. 'text_label_searchRadius': '搜索半径',
  84704. 'text_label_queryRange': '分析范围',
  84705. 'text_label_areaUnit': '面积单位',
  84706. 'text_option_equidistantSegmentation': '等距离分段',
  84707. 'text_option_logarithm': '对数',
  84708. 'text_option_equalCountingSegment': '等计数分段',
  84709. 'text_option_squareRootSegmentation': '平方根分段',
  84710. 'text_label_thematicMapSegmentationMode': '专题图分段模式',
  84711. 'text_label_thematicMapSegmentationParameters': '专题图分段参数',
  84712. 'text_option_greenOrangePurpleGradient': '绿橙紫渐变',
  84713. 'text_option_greenOrangeRedGradient': '绿橙红渐变',
  84714. 'text_option_rainbowGradient': '彩虹渐变',
  84715. 'text_option_spectralGradient': '光谱渐变',
  84716. 'text_option_terrainGradient': '地形渐变',
  84717. 'text_label_thematicMapColorGradientMode': '专题图颜色渐变模式',
  84718. 'text_label_resultLayerName': '结果图层名称',
  84719. 'text_chooseFile': '选择文件',
  84720. 'text_isoline': '等值线',
  84721. 'text_extractDiscreteValue': '提取离散值生成曲线',
  84722. 'text_buffer': '缓冲区',
  84723. 'text_specifyTheDistance': '指定距离创建周边区域',
  84724. 'text_label_analysisLayer': '分析图层',
  84725. 'text_label_extractField': '提取字段',
  84726. 'text_label_extractedValue': '提取值',
  84727. 'text_label_distanceAttenuation': '距离衰减',
  84728. 'text_label_gridSize': '栅格大小',
  84729. 'text_label_bufferRadius': '缓冲半径',
  84730. 'text_label_defaultkilometers': '默认10千米',
  84731. 'text_option_kilometer': '千米',
  84732. 'text_label_unit': '单位',
  84733. 'text_retainOriginal': '保留原对象字段属性',
  84734. 'text_mergeBuffer': '合并缓冲区',
  84735. 'text_label_color': '颜色',
  84736. 'text_label_buffer': '[缓冲区]',
  84737. 'text_label_isolines': '[等值线]',
  84738. 'text_label_queryRangeTips': '默认为输入数据的全幅范围。范例:-74.050,40.650,-73.850,40.850',
  84739. 'text_label_IDArrayOfFeatures': '要素 ID 数组',
  84740. 'text_label_maxFeatures': '最多可返回的要素数量',
  84741. 'text_label_bufferDistance': '缓冲区距离',
  84742. 'text_label_queryRange1': '查询范围',
  84743. 'text_label_spatialQueryMode': '空间查询模式',
  84744. 'text_label_featureFilter': '要素过滤器',
  84745. 'text_label_geometricObject': '几何对象',
  84746. 'text_label_queryMode': '查询模式',
  84747. 'text_label_searchTips': '搜索城市地点或图层要素',
  84748. 'text_label_chooseSearchLayers': '选择查询图层',
  84749. 'text_loadSearchCriteria': '加载搜索条件',
  84750. 'text_saveSearchCriteria': '保存搜索条件',
  84751. "btn_analyze": "分析",
  84752. "btn_analyzing": "分析中",
  84753. "btn_emptyTheAnalysisLayer": "清空分析图层",
  84754. "btn_cancelAnalysis": "取消",
  84755. "btn_query": "查询",
  84756. "btn_querying": "查询中",
  84757. "btn_emptyTheRresultLayer": "清除所有结果图层",
  84758. 'msg_dataFlowServiceHasBeenSubscribed': '已订阅该数据流服务。',
  84759. 'msg_inputDataFlowUrlFirst': '请先输入数据流服务地址。',
  84760. 'msg_datasetOrMethodUnsupport': '该数据集不支持本分析类型,请重新选择数据集',
  84761. 'msg_selectDataset': '请选择数据集!',
  84762. 'msg_setTheWeightField': '请设置权重字段!',
  84763. 'msg_theFieldNotSupportAnalysis': '您当前选择的字段不支持分析!',
  84764. 'msg_resultIsEmpty': '分析的结果为空!',
  84765. 'msg_dataReturnedIsEmpty': '请求成功,查询返回的数据为空。',
  84766. 'msg_openFileFail': '打开文件失败!',
  84767. 'msg_fileTypeUnsupported': '不支持该文件格式!',
  84768. 'msg_fileSizeExceeded': '文件大小超限!文件大小不得超过 10M!',
  84769. 'msg_dataInWrongGeoJSONFormat': '数据格式错误!非标准的 GEOJSON 格式数据!',
  84770. 'msg_dataInWrongFormat': '数据格式错误!非标准的 EXCEL, CSV 或 GEOJSON 格式数据!',
  84771. 'msg_searchKeywords': "搜索关键字不能为空,请输入搜索条件。",
  84772. 'msg_searchGeocodeField':"未匹配到地址匹配服务数据!",
  84773. 'msg_cityGeocodeField':"未配置当前城市的地址匹配服务。",
  84774. 'msg_getFeatureField':"未查找到相关矢量要素!",
  84775. 'msg_dataflowservicesubscribed':'已订阅该数据流服务。',
  84776. 'msg_subscribesucceeded':'数据流服务订阅成功。',
  84777. 'msg_crsunsupport':'不支持当前地图的坐标系',
  84778. 'msg_tilematrixsetunsupport':'不支持传入的TileMatrixSet',
  84779. 'msg_jsonResolveFiled': 'json格式解析失败!',
  84780. 'msg_requestContentFiled': '通过iportal请求数据失败!',
  84781. 'msg_getdatafailed': '获取数据失败!'
  84782. };
  84783. ;// CONCATENATED MODULE: ./src/common/lang/Lang.js
  84784. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84785. * This program are made available under the terms of the Apache License, Version 2.0
  84786. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84787. /**
  84788. * @name Lang
  84789. * @namespace
  84790. * @category BaseTypes Internationalization
  84791. * @description 国际化的命名空间,包含多种语言和方法库来设置和获取当前的语言。
  84792. * @usage
  84793. * ```
  84794. * // 浏览器
  84795. * <script type="text/javascript" src="{cdn}"></script>
  84796. * <script>
  84797. * const result = {namespace}.Lang.getCode();
  84798. *
  84799. * // 弃用的写法
  84800. * const result = SuperMap.Lang.getCode();
  84801. *
  84802. * </script>
  84803. *
  84804. * // ES6 Import
  84805. * import { Lang } from '{npm}';
  84806. *
  84807. * const result = Lang.getCode();
  84808. *
  84809. * ```
  84810. */
  84811. let Lang = {
  84812. 'en-US': en,
  84813. "zh-CN": zh,
  84814. /**
  84815. * @member {string} Lang.code
  84816. * @description 当前所使用的语言类型。
  84817. */
  84818. code: null,
  84819. /**
  84820. * @member {string} [Lang.defaultCode='en-US']
  84821. * @description 默认使用的语言类型。
  84822. */
  84823. defaultCode: "en-US",
  84824. /**
  84825. * @function Lang.getCode
  84826. * @description 获取当前的语言代码。
  84827. * @returns {string} 当前的语言代码。
  84828. */
  84829. getCode: function () {
  84830. if (!Lang.code) {
  84831. Lang.setCode();
  84832. }
  84833. return Lang.code;
  84834. },
  84835. /**
  84836. * @function Lang.setCode
  84837. * @description 设置语言代码。
  84838. * @param {string} code - 此参数遵循IETF规范。
  84839. */
  84840. setCode: function () {
  84841. var lang = this.getLanguageFromCookie();
  84842. if (!lang) {
  84843. lang = Lang.defaultCode;
  84844. if (navigator.appName === 'Netscape') {
  84845. lang = navigator.language;
  84846. } else {
  84847. lang = navigator.browserLanguage;
  84848. }
  84849. }
  84850. if (lang.indexOf('zh') === 0) {
  84851. lang = 'zh-CN';
  84852. }
  84853. if (lang.indexOf('en') === 0) {
  84854. lang = 'en-US';
  84855. }
  84856. Lang.code = lang;
  84857. },
  84858. /**
  84859. * @function Lang.getLanguageFromCookie
  84860. * @description 从 cookie 中获取语言类型。
  84861. */
  84862. getLanguageFromCookie() {
  84863. var name = 'language=';
  84864. var ca = document.cookie.split(';');
  84865. for (var i = 0; i < ca.length; i++) {
  84866. var c = ca[i];
  84867. while (c.charAt(0) === ' ') {
  84868. c = c.substring(1)
  84869. }
  84870. if (c.indexOf(name) !== -1) {
  84871. return c.substring(name.length, c.length)
  84872. }
  84873. }
  84874. return "";
  84875. },
  84876. /**
  84877. * @function Lang.i18n
  84878. * @description 从当前语言字符串的字典查找 key。
  84879. * @param {string} key - 字典中 i18n 字符串值的关键字。
  84880. * @returns {string} 国际化的字符串。
  84881. */
  84882. i18n: function (key) {
  84883. var dictionary = Lang[Lang.getCode()];
  84884. var message = dictionary && dictionary[key];
  84885. if (!message) {
  84886. // Message not found, fall back to message key
  84887. message = key;
  84888. }
  84889. return message;
  84890. }
  84891. };
  84892. ;// CONCATENATED MODULE: external "function(){try{return XLSX}catch(e){return {}}}()"
  84893. const external_function_try_return_XLSX_catch_e_return_namespaceObject = function(){try{return XLSX}catch(e){return {}}}();
  84894. ;// CONCATENATED MODULE: ./src/common/components/util/FileReaderUtil.js
  84895. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84896. * This program are made available under the terms of the Apache License, Version 2.0
  84897. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84898. /**
  84899. * @name FileReaderUtil
  84900. * @namespace
  84901. * @category Components OpenFile
  84902. * @description 组件读取文件工具类。
  84903. * @version 9.1.1
  84904. * @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(*, *=))}}
  84905. * @usage
  84906. * ```
  84907. * // 浏览器
  84908. * <script type="text/javascript" src="{cdn}"></script>
  84909. * <script>
  84910. * const result = {namespace}.Components.FileReaderUtil.isXField(data);
  84911. *
  84912. * // 弃用的写法
  84913. * const result = SuperMap.Components.FileReaderUtil.isXField(data);
  84914. *
  84915. * </script>
  84916. *
  84917. * // ES6 Import
  84918. * import { FileReaderUtil } from '{npm}';
  84919. *
  84920. * const result = FileReaderUtil.isXField(data);
  84921. * ```
  84922. */
  84923. let FileReaderUtil = {
  84924. rABS: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsBinaryString,
  84925. rABF: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsArrayBuffer,
  84926. rAT: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsText,
  84927. /**
  84928. * @function FileReaderUtil.prototype.readFile
  84929. * @description 读取文件。
  84930. * @param {string} fileType - 当前读取的文件类型。
  84931. *
  84932. * @param {Object} file - 读取回来的文件内容对象。
  84933. * @param {function} success - 读取文件成功回调函数。
  84934. * @param {function} failed - 读取文件失败回调函数。
  84935. * @param {Object} context - 回调重定向对象。
  84936. */
  84937. readFile(fileType, file, success, failed, context) {
  84938. if (CommonTypes_FileTypes.JSON === fileType || CommonTypes_FileTypes.GEOJSON === fileType) {
  84939. this.readTextFile(file, success, failed, context)
  84940. } else if (CommonTypes_FileTypes.EXCEL === fileType || CommonTypes_FileTypes.CSV === fileType) {
  84941. this.readXLSXFile(file, success, failed, context)
  84942. }
  84943. },
  84944. /**
  84945. * @description 读取文本文件。
  84946. * @param {Object} file 文件内容对象。
  84947. * @param {function} success 读取文件成功回调函数。
  84948. * @param {function} failed 读取文件失败回调函数。
  84949. * @param {Object} context - 回调重定向对象。
  84950. */
  84951. readTextFile(file, success, failed, context) {
  84952. let reader = new FileReader();
  84953. reader.onloadend = function (evt) {
  84954. success && success.call(context, evt.target.result);
  84955. };
  84956. reader.onerror = function (error) {
  84957. failed && failed.call(context, error)
  84958. };
  84959. this.rAT ? reader.readAsText(file.file, 'utf-8') : reader.readAsBinaryString(file.file);
  84960. },
  84961. /**
  84962. * @description 读取excel或csv文件。
  84963. * @param {Object} file 文件内容对象。
  84964. * @param {function} success 读取文件成功回调函数。
  84965. * @param {function} failed 读取文件失败回调函数。
  84966. * @param {Object} context - 回调重定向对象。
  84967. */
  84968. readXLSXFile(file, success, failed, context) {
  84969. let reader = new FileReader();
  84970. reader.onloadend = function (evt) {
  84971. let xLSXData = new Uint8Array(evt.target.result);
  84972. let workbook = external_function_try_return_XLSX_catch_e_return_namespaceObject.read(xLSXData, {type: "array"});
  84973. try {
  84974. if (workbook && workbook.SheetNames && workbook.SheetNames.length > 0) {
  84975. //暂时只读取第一个sheets的内容
  84976. let sheetName = workbook.SheetNames[0];
  84977. let xLSXCSVString = external_function_try_return_XLSX_catch_e_return_namespaceObject.utils.sheet_to_csv(workbook.Sheets[sheetName]);
  84978. success && success.call(context, xLSXCSVString);
  84979. }
  84980. } catch (error) {
  84981. failed && failed.call(context, error);
  84982. }
  84983. };
  84984. reader.onerror = function (error) {
  84985. failed && failed.call(context, error)
  84986. };
  84987. this.rABF && reader.readAsArrayBuffer(file.file);
  84988. },
  84989. /**
  84990. * @function FileReaderUtil.prototype.processDataToGeoJson
  84991. * @description 将读取回来得数据统一处理为 GeoJSON 格式。
  84992. * @param {string} type - 文件类型。
  84993. * @param {Object} data - 读取返回的数据对象。
  84994. * @param {function} success - 数据处理成功的回调。
  84995. * @param {function} failed - 数据处理失败的回调。
  84996. * @param {Object} context - 回调重定向对象。
  84997. * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据。
  84998. * @private
  84999. */
  85000. processDataToGeoJson(type, data, success, failed, context) {
  85001. let geojson = null;
  85002. if (type === "EXCEL" || type === "CSV") {
  85003. geojson = this.processExcelDataToGeoJson(data);
  85004. success && success.call(context, geojson);
  85005. } else if (type === 'JSON' || type === 'GEOJSON') {
  85006. let result = data;
  85007. //geojson、json未知,通过类容来判断
  85008. if ((typeof result) === "string") {
  85009. result = JSON.parse(result);
  85010. }
  85011. if (result.type === 'ISERVER') {
  85012. geojson = result.data.recordsets[0].features;
  85013. } else if (result.type === 'FeatureCollection') {
  85014. //geojson
  85015. geojson = result;
  85016. } else {
  85017. //不支持数据
  85018. failed && failed.call(context, Lang.i18n('msg_dataInWrongGeoJSONFormat'));
  85019. }
  85020. success && success.call(context, geojson);
  85021. } else {
  85022. failed && failed.call(context, Lang.i18n('msg_dataInWrongFormat'));
  85023. }
  85024. },
  85025. /**
  85026. * @function FileReaderUtil.prototype.processExcelDataToGeoJson
  85027. * @description 表格文件数据处理。
  85028. * @param {Object} data - 读取的表格文件数据。
  85029. * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据。
  85030. * @private
  85031. */
  85032. processExcelDataToGeoJson(data) {
  85033. //处理为对象格式转化
  85034. let dataContent = this.string2Csv(data);
  85035. let fieldCaptions = dataContent.colTitles;
  85036. //位置属性处理
  85037. let xfieldIndex = -1,
  85038. yfieldIndex = -1;
  85039. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  85040. if (this.isXField(fieldCaptions[i])) {
  85041. xfieldIndex = i;
  85042. }
  85043. if (this.isYField(fieldCaptions[i])) {
  85044. yfieldIndex = i;
  85045. }
  85046. }
  85047. // feature 构建后期支持坐标系 4326/3857
  85048. let features = [];
  85049. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  85050. let row = dataContent.rows[i];
  85051. //if (featureFrom === "LonLat") {
  85052. let x = Number(row[xfieldIndex]),
  85053. y = Number(row[yfieldIndex]);
  85054. //属性信息
  85055. let attributes = {};
  85056. for (let index in dataContent.colTitles) {
  85057. let key = dataContent.colTitles[index];
  85058. attributes[key] = dataContent.rows[i][index];
  85059. }
  85060. //目前csv 只支持处理点,所以先生成点类型的 geojson
  85061. let feature = {
  85062. "type": "Feature",
  85063. "geometry": {
  85064. "type": "Point",
  85065. "coordinates": [x, y]
  85066. },
  85067. "properties": attributes
  85068. };
  85069. features.push(feature);
  85070. }
  85071. return features;
  85072. },
  85073. /**
  85074. * @description 判断是否地理X坐标。
  85075. * @param {string} data 字段名。
  85076. */
  85077. isXField(data) {
  85078. var lowerdata = data.toLowerCase();
  85079. return (lowerdata === "x" || lowerdata === "smx" ||
  85080. lowerdata === "jd" || lowerdata === "经度" || lowerdata === "东经" || lowerdata === "longitude" ||
  85081. lowerdata === "lot" || lowerdata === "lon" || lowerdata === "lng" || lowerdata === "x坐标");
  85082. },
  85083. /**
  85084. * @description 判断是否地理Y坐标。
  85085. * @param {string} data 字段名。
  85086. */
  85087. isYField(data) {
  85088. var lowerdata = data.toLowerCase();
  85089. return (lowerdata === "y" || lowerdata === "smy" ||
  85090. lowerdata === "wd" || lowerdata === "纬度" || lowerdata === "北纬" ||
  85091. lowerdata === "latitude" || lowerdata === "lat" || lowerdata === "y坐标");
  85092. },
  85093. /**
  85094. * @description 字符串转为dataEditor 支持的csv格式数据。
  85095. * @param {string} string 待转化的字符串。
  85096. * @param {boolean} withoutTitle 是否需要列标题。
  85097. */
  85098. string2Csv(string, withoutTitle) {
  85099. // let rows = string.split('\r\n');
  85100. let rows = string.split('\n');
  85101. let result = {};
  85102. if (!withoutTitle) {
  85103. result["colTitles"] = rows[0].split(',');
  85104. } else {
  85105. result["colTitles"] = [];
  85106. }
  85107. result['rows'] = [];
  85108. for (let i = (withoutTitle) ? 0 : 1; i < rows.length; i++) {
  85109. rows[i] && result['rows'].push(rows[i].split(','));
  85110. }
  85111. return result;
  85112. }
  85113. };
  85114. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartModel.js
  85115. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  85116. * This program are made available under the terms of the Apache License, Version 2.0
  85117. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85118. /**
  85119. * @class ChartModel
  85120. * @classdesc 图表组件数据模型
  85121. * @private
  85122. * @param {Object} datasets - 数据来源。
  85123. * @category Components Chart
  85124. * @fires ChartModel#getdatafailed
  85125. */
  85126. class ChartModel {
  85127. constructor(datasets) {
  85128. this.datasets = datasets;
  85129. this.EVENT_TYPES = ['getdatafailed'];
  85130. this.events = new Events(this, null, this.EVENT_TYPES);
  85131. }
  85132. /**
  85133. * @private
  85134. * @function ChartModel.prototype.getDatasetInfo
  85135. * @description 获得数据集数据。
  85136. * @param {string} datasetUrl - 数据集资源地址。
  85137. */
  85138. getDatasetInfo(success) {
  85139. let datasetUrl = this.datasets.url;
  85140. let me = this;
  85141. FetchRequest.get(datasetUrl)
  85142. .then(function (response) {
  85143. return response.json();
  85144. })
  85145. .then(function (results) {
  85146. if (results.datasetInfo) {
  85147. let datasetInfo = results.datasetInfo;
  85148. me.datasetsInfo = {
  85149. dataSourceName: datasetInfo.dataSourceName,
  85150. datasetName: datasetInfo.name,
  85151. mapName: results.name
  85152. };
  85153. success({
  85154. result: me.datasetsInfo
  85155. });
  85156. }
  85157. })
  85158. .catch(function (error) {
  85159. console.log(error);
  85160. me._fireFailedEvent(error);
  85161. });
  85162. }
  85163. /**
  85164. * @private
  85165. * @function ChartModel.prototype.getDataFeatures
  85166. * @description 请求数据集的数据信息
  85167. * @param {Object} results - 数据集信息。
  85168. * @param {function} success - 成功回调函数。
  85169. */
  85170. getDataFeatures(results, success) {
  85171. let datasetsInfo = results.result;
  85172. let getFeatureParam, getFeatureBySQLParams, getFeatureBySQLService;
  85173. let params = {
  85174. name: datasetsInfo.datasetName + '@' + datasetsInfo.dataSourceName
  85175. };
  85176. Object.assign(params, this.datasets.queryInfo);
  85177. getFeatureParam = new FilterParameter(params);
  85178. getFeatureBySQLParams = new GetFeaturesBySQLParameters({
  85179. queryParameter: getFeatureParam,
  85180. datasetNames: [datasetsInfo.dataSourceName + ':' + datasetsInfo.datasetName],
  85181. fromIndex: 0,
  85182. toIndex: 100000
  85183. });
  85184. getFeatureBySQLService = new GetFeaturesBySQLService(datasetsInfo.dataUrl, {
  85185. eventListeners: {
  85186. processCompleted: success,
  85187. processFailed: function () {}
  85188. }
  85189. });
  85190. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  85191. }
  85192. /**
  85193. * @private
  85194. * @function ChartModel.prototype.getLayerFeatures
  85195. * @description 请求图层要素的数据信息
  85196. * @param {Object} results - 数据集信息。
  85197. * @param {Callbacks} success - 成功回调函数。
  85198. */
  85199. getLayerFeatures(results, success) {
  85200. let datasetsInfo = results.result;
  85201. let queryParam, queryBySQLParams, queryBySQLService;
  85202. let params = {
  85203. name: datasetsInfo.mapName
  85204. };
  85205. Object.assign(params, this.datasets.queryInfo);
  85206. queryParam = new FilterParameter(params);
  85207. queryBySQLParams = new QueryBySQLParameters({
  85208. queryParams: [queryParam],
  85209. expectCount: 100000
  85210. });
  85211. queryBySQLService = new QueryBySQLService(datasetsInfo.dataUrl, {
  85212. eventListeners: {
  85213. processCompleted: success,
  85214. processFailed: function () {}
  85215. }
  85216. });
  85217. queryBySQLService.processAsync(queryBySQLParams);
  85218. }
  85219. /**
  85220. * @private
  85221. * @function ChartModel.prototype.getDataInfoByIptl
  85222. * @description 用dataId获取iportal的数据。
  85223. * @param {Callbacks} success - 成功回调函数。
  85224. *
  85225. */
  85226. getDataInfoByIptl(success) {
  85227. // success是chart的回调
  85228. this.getServiceInfo(this.datasets.url, success);
  85229. }
  85230. /**
  85231. * @private
  85232. * @function ChartModel.prototype.getServiceInfo
  85233. * @description 用iportal获取dataItemServices。
  85234. * @param {string} url
  85235. * @param {Callbacks} success - 成功回调函数。
  85236. * */
  85237. getServiceInfo(url, success) {
  85238. let me = this;
  85239. FetchRequest.get(url, null, {
  85240. withCredentials: this.datasets.withCredentials
  85241. })
  85242. .then((response) => {
  85243. return response.json();
  85244. })
  85245. .then((data) => {
  85246. if (data.succeed === false) {
  85247. //请求失败
  85248. me._fireFailedEvent(data);
  85249. return;
  85250. }
  85251. // 是否有rest服务
  85252. if (data.dataItemServices && data.dataItemServices.length > 0) {
  85253. let dataItemServices = data.dataItemServices,
  85254. resultData;
  85255. dataItemServices.forEach((item) => {
  85256. // 如果有restdata并且发布成功,就请求restdata服务
  85257. // 如果有restmap并且发布成功,就请求restmap服务
  85258. // 其他情况就请求iportal/content.json
  85259. if (item.serviceType === 'RESTDATA' && item.serviceStatus === 'PUBLISHED') {
  85260. resultData = item;
  85261. } else if (item.serviceType === 'RESTMAP' && item.serviceStatus === 'PUBLISHED') {
  85262. resultData = item;
  85263. } else {
  85264. me.getDatafromContent(url, success);
  85265. return;
  85266. }
  85267. });
  85268. // 如果有服务,获取数据源和数据集, 然后请求rest服务
  85269. resultData && me.getDatafromRest(resultData.serviceType, resultData.address, success);
  85270. } else {
  85271. me.getDatafromContent(url, success);
  85272. return;
  85273. }
  85274. })
  85275. .catch((error) => {
  85276. console.log(error);
  85277. me._fireFailedEvent(error);
  85278. });
  85279. }
  85280. /**
  85281. * @private
  85282. * @function ChartModel.prototype.getDatafromURL
  85283. * @description 用iportal获取数据。(通过固定的url来请求,但是不能请求工作空间的数据)
  85284. * @param {string} url
  85285. * @param {Callbacks} success - 成功回调函数。
  85286. */
  85287. getDatafromContent(url, success) {
  85288. // 成功回调传入的results
  85289. let results = {
  85290. result: {}
  85291. },
  85292. me = this;
  85293. url += '/content.json?pageSize=9999999&currentPage=1';
  85294. // 获取图层数据
  85295. FetchRequest.get(url, null, {
  85296. withCredentials: this.datasets.withCredentials
  85297. })
  85298. .then((response) => {
  85299. return response.json();
  85300. })
  85301. .then((data) => {
  85302. if (data.succeed === false) {
  85303. //请求失败
  85304. me._fireFailedEvent(data);
  85305. return;
  85306. }
  85307. if (data.type) {
  85308. if (data.type === 'JSON' || data.type === 'GEOJSON') {
  85309. // 将字符串转换成json
  85310. data.content = JSON.parse(data.content.trim());
  85311. // 如果是json文件 data.content = {type:'fco', features},格式不固定
  85312. if (!data.content.features) {
  85313. //json格式解析失败
  85314. console.log(Lang.i18n('msg_jsonResolveFiled'));
  85315. return;
  85316. }
  85317. let features = this._formatGeoJSON(data.content);
  85318. results.result.features = {
  85319. type: data.content.type,
  85320. features
  85321. };
  85322. } else if (data.type === 'EXCEL' || data.type === 'CSV') {
  85323. let features = this._excelData2Feature(data.content);
  85324. results.result.features = {
  85325. type: 'FeatureCollection',
  85326. features
  85327. };
  85328. }
  85329. success(results, 'content');
  85330. }
  85331. }, this)
  85332. .catch((error) => {
  85333. console.log(error);
  85334. me._fireFailedEvent(error);
  85335. });
  85336. }
  85337. /**
  85338. * @private
  85339. * @function ChartModel.prototype._getDataSource
  85340. * @description 获取数据源名和数据集名。
  85341. * @param {string} serviceType 服务类型
  85342. * @param {string} address 地址
  85343. * @param {Callbacks} success - 成功回调函数。
  85344. * @return {Array.<string>} ["数据源名:数据集名"]
  85345. * @return {string} 图层名
  85346. */
  85347. getDatafromRest(serviceType, address, success) {
  85348. let me = this,
  85349. withCredentials = this.datasets.withCredentials;
  85350. if (serviceType === 'RESTDATA') {
  85351. let url = `${address}/data/datasources`,
  85352. sourceName,
  85353. datasetName;
  85354. // 请求获取数据源名
  85355. FetchRequest.get(url, null, {
  85356. withCredentials
  85357. })
  85358. .then((response) => {
  85359. return response.json();
  85360. })
  85361. .then((data) => {
  85362. sourceName = data.datasourceNames[0];
  85363. url = `${address}/data/datasources/${sourceName}/datasets`;
  85364. // 请求获取数据集名
  85365. FetchRequest.get(url, null, {
  85366. withCredentials
  85367. })
  85368. .then((response) => {
  85369. return response.json();
  85370. })
  85371. .then((data) => {
  85372. datasetName = data.datasetNames[0];
  85373. // 请求restdata服务
  85374. me.getDatafromRestData(`${address}/data`, [sourceName + ':' + datasetName], success);
  85375. return [sourceName + ':' + datasetName];
  85376. })
  85377. .catch(function (error) {
  85378. me._fireFailedEvent(error);
  85379. });
  85380. })
  85381. .catch(function (error) {
  85382. me._fireFailedEvent(error);
  85383. });
  85384. } else {
  85385. // 如果是地图服务
  85386. let url = `${address}/maps`,
  85387. mapName,
  85388. layerName,
  85389. path;
  85390. // 请求获取地图名
  85391. FetchRequest.get(url, null, {
  85392. withCredentials
  85393. })
  85394. .then((response) => {
  85395. return response.json();
  85396. })
  85397. .then((data) => {
  85398. mapName = data[0].name;
  85399. path = data[0].path;
  85400. url = url = `${address}/maps/${mapName}/layers`;
  85401. // 请求获取图层名
  85402. FetchRequest.get(url, null, {
  85403. withCredentials
  85404. })
  85405. .then((response) => {
  85406. return response.json();
  85407. })
  85408. .then((data) => {
  85409. layerName = data[0].subLayers.layers[0].caption;
  85410. // 请求restmap服务
  85411. me.getDatafromRestMap(layerName, path, success);
  85412. return layerName;
  85413. })
  85414. .catch(function (error) {
  85415. me._fireFailedEvent(error);
  85416. });
  85417. })
  85418. .catch(function (error) {
  85419. me._fireFailedEvent(error);
  85420. });
  85421. }
  85422. }
  85423. /**
  85424. * @private
  85425. * @function ChartModel.prototype.getDatafromRestData
  85426. * @description 请求restdata服务
  85427. * @param {string} url
  85428. * @param {Array<string>} dataSource [数据源名:数据集名]
  85429. * @param {Callbacks} success - 成功回调函数。
  85430. */
  85431. getDatafromRestData(url, dataSource, success) {
  85432. let me = this;
  85433. this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'SmID>0';
  85434. this._getFeatureBySQL(
  85435. url,
  85436. dataSource,
  85437. this.datasets.queryInfo,
  85438. (results) => {
  85439. // 此时的features已经处理成geojson了
  85440. success(results, 'RESTDATA');
  85441. },
  85442. (error) => {
  85443. console.log(error);
  85444. me._fireFailedEvent(error);
  85445. }
  85446. );
  85447. }
  85448. /**
  85449. * @private
  85450. * @function ChartModel.prototype.getDatafromRestMap
  85451. * @description 请求restmap服务
  85452. * @param {string} dataSource layerName
  85453. * @param {string} path - map服务地址。
  85454. * @param {Callbacks} success - 成功回调函数。
  85455. */
  85456. getDatafromRestMap(dataSource, path, success) {
  85457. let me = this;
  85458. this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'smid=1';
  85459. this._queryFeatureBySQL(
  85460. path,
  85461. dataSource,
  85462. this.datasets.queryInfo,
  85463. null,
  85464. null,
  85465. (results) => {
  85466. // let features = result.result.recordsets[0].features;
  85467. success(results, 'RESTMAP');
  85468. },
  85469. (error) => {
  85470. console.log(error);
  85471. me._fireFailedEvent(error);
  85472. }
  85473. );
  85474. }
  85475. /**
  85476. * @private
  85477. * @function ChartModel.prototype._getFeatureBySQL
  85478. * @description 通过 sql 方式查询数据。
  85479. */
  85480. _getFeatureBySQL(url, datasetNames, queryInfo, processCompleted, processFaild) {
  85481. let getFeatureParam, getFeatureBySQLService, getFeatureBySQLParams;
  85482. let params = {
  85483. name: datasetNames.join().replace(':', '@')
  85484. };
  85485. Object.assign(params, queryInfo);
  85486. getFeatureParam = new FilterParameter(params);
  85487. getFeatureBySQLParams = new GetFeaturesBySQLParameters({
  85488. queryParameter: getFeatureParam,
  85489. datasetNames: datasetNames,
  85490. fromIndex: 0,
  85491. toIndex: 100000,
  85492. returnContent: true
  85493. });
  85494. let options = {
  85495. eventListeners: {
  85496. processCompleted: (getFeaturesEventArgs) => {
  85497. processCompleted && processCompleted(getFeaturesEventArgs);
  85498. },
  85499. processFailed: (e) => {
  85500. processFaild && processFaild(e);
  85501. }
  85502. }
  85503. };
  85504. getFeatureBySQLService = new GetFeaturesBySQLService(url, options);
  85505. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  85506. }
  85507. /**
  85508. * @private
  85509. * @function ChartModel.prototype._queryFeatureBySQL
  85510. * @description 通过 sql 方式查询数据。
  85511. */
  85512. _queryFeatureBySQL(
  85513. url,
  85514. layerName,
  85515. queryInfo,
  85516. fields,
  85517. epsgCode,
  85518. processCompleted,
  85519. processFaild,
  85520. startRecord,
  85521. recordLength,
  85522. onlyAttribute
  85523. ) {
  85524. var queryParam, queryBySQLParams;
  85525. var filterParams = {
  85526. name: layerName
  85527. };
  85528. Object.assign(filterParams, queryInfo);
  85529. queryParam = new FilterParameter(filterParams);
  85530. if (fields) {
  85531. queryParam.fields = fields;
  85532. }
  85533. var params = {
  85534. queryParams: [queryParam]
  85535. };
  85536. if (onlyAttribute) {
  85537. params.queryOption = QueryOption.ATTRIBUTE;
  85538. }
  85539. startRecord && (params.startRecord = startRecord);
  85540. recordLength && (params.expectCount = recordLength);
  85541. if (epsgCode) {
  85542. params.prjCoordSys = {
  85543. epsgCode: epsgCode
  85544. };
  85545. }
  85546. queryBySQLParams = new QueryBySQLParameters(params);
  85547. this._queryBySQL(url, queryBySQLParams, (data) => {
  85548. data.type === 'processCompleted' ? processCompleted(data) : processFaild(data);
  85549. });
  85550. }
  85551. /**
  85552. * @function ChartModel.prototype._queryBySQL
  85553. * @description SQL 查询服务。
  85554. * @param {QueryBySQLParameters} params - SQL 查询相关参数类。
  85555. * @param {RequestCallback} callback - 回调函数。
  85556. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 结果类型。
  85557. */
  85558. _queryBySQL(url, params, callback, resultFormat) {
  85559. var me = this;
  85560. var queryBySQLService = new QueryBySQLService(url, {
  85561. eventListeners: {
  85562. scope: me,
  85563. processCompleted: callback,
  85564. processFailed: callback
  85565. },
  85566. format: me._processFormat(resultFormat)
  85567. });
  85568. queryBySQLService.processAsync(params);
  85569. }
  85570. /**
  85571. * @function ChartModel.prototype._processFormat
  85572. * @description 将数据转换成geojson。
  85573. * @param {Object} resultFormat - 返回结果集。
  85574. * @return {Object} [resultFormat=DataFormat.GEOJSON] - 结果类型。
  85575. */
  85576. _processFormat(resultFormat) {
  85577. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  85578. }
  85579. /**
  85580. * @private
  85581. * @function ChartModel.prototype._formatGeoJSON
  85582. * @description 格式 GeoJSON。
  85583. * @param {GeoJSON} data - GeoJSON 数据。
  85584. */
  85585. _formatGeoJSON(data) {
  85586. let features = data.features;
  85587. features.forEach((row, index) => {
  85588. row.properties['index'] = index;
  85589. });
  85590. return features;
  85591. }
  85592. /**
  85593. * @private
  85594. * @description 将 csv 和 xls 文件内容转换成 geojson
  85595. * @function ChartModel.prototype._excelData2Feature
  85596. * @param content 文件内容
  85597. * @param layerInfo 图层信息
  85598. * @returns {Array} feature的数组集合
  85599. */
  85600. _excelData2Feature(dataContent) {
  85601. let fieldCaptions = dataContent.colTitles;
  85602. //位置属性处理
  85603. let xfieldIndex = -1,
  85604. yfieldIndex = -1;
  85605. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  85606. if (FileReaderUtil.isXField(fieldCaptions[i])) {
  85607. xfieldIndex = i;
  85608. }
  85609. if (FileReaderUtil.isYField(fieldCaptions[i])) {
  85610. yfieldIndex = i;
  85611. }
  85612. }
  85613. // feature 构建后期支持坐标系 4326/3857
  85614. let features = [];
  85615. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  85616. let row = dataContent.rows[i];
  85617. let x = Number(row[xfieldIndex]),
  85618. y = Number(row[yfieldIndex]);
  85619. //属性信息
  85620. let attributes = {};
  85621. for (let index in dataContent.colTitles) {
  85622. let key = dataContent.colTitles[index];
  85623. attributes[key] = dataContent.rows[i][index];
  85624. }
  85625. attributes['index'] = i + '';
  85626. //目前csv 只支持处理点,所以先生成点类型的 geojson
  85627. let feature = {
  85628. type: 'Feature',
  85629. geometry: {
  85630. type: 'Point',
  85631. coordinates: [x, y]
  85632. },
  85633. properties: attributes
  85634. };
  85635. features.push(feature);
  85636. }
  85637. return features;
  85638. }
  85639. /**
  85640. * @private
  85641. * @description 请求数据失败的事件
  85642. * @function ChartModel.prototype._fireFailedEvent
  85643. * @param {Object} error 错误信息
  85644. */
  85645. _fireFailedEvent(error) {
  85646. let errorData = error
  85647. ? {
  85648. error,
  85649. message: Lang.i18n('msg_getdatafailed')
  85650. }
  85651. : {
  85652. message: Lang.i18n('msg_getdatafailed')
  85653. };
  85654. /**
  85655. * @event ChartModel#getdatafailed
  85656. * @description 监听到获取数据失败事件后触发
  85657. * @property {Object} error - 事件对象。
  85658. */
  85659. this.events.triggerEvent('getdatafailed', errorData);
  85660. }
  85661. }
  85662. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartViewModel.js
  85663. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  85664. * This program are made available under the terms of the Apache License, Version 2.0
  85665. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85666. /**
  85667. * @class ChartViewModel
  85668. * @aliasclass Components.ChartViewModel
  85669. * @deprecatedclass SuperMap.Components.ChartViewModel
  85670. * @classdesc 图表组件功能类。
  85671. * @category Components Chart
  85672. * @version 10.0.0
  85673. * @param {Object} options - 可选参数。
  85674. * @param {string} options.type - 图表类型。
  85675. * @param {ChartView.Datasets} options.datasets - 数据来源。
  85676. * @param {Array.<Object>} options.chartOptions - 图表可选配置。
  85677. * @param {Array.<Object>} options.chartOptions.xAxis - X轴可选参数。
  85678. * @param {string} options.chartOptions.xAxis.field - X轴字段名。
  85679. * @param {string} options.chartOptions.xAxis.name - X轴名称。
  85680. * @param {Array.<Object>} options.chartOptions.yAxis - Y轴可选参数。
  85681. * @param {string} options.chartOptions.yAxis.field - Y轴字段名。
  85682. * @param {string} options.chartOptions.yAxis.name - Y轴名称。
  85683. * @fires ChartViewModel#getdatafailed
  85684. * @usage
  85685. */
  85686. class ChartViewModel {
  85687. constructor(options) {
  85688. this.datasets = options.datasets;
  85689. this.xField = [];
  85690. this.yField = [];
  85691. this.grid = {
  85692. top: "50px",
  85693. bottom: "50px",
  85694. left: "50px",
  85695. right: "60px"
  85696. };
  85697. this.chartType = options.type || "bar";
  85698. this._initXYField(options.chartOptions);
  85699. this.EVENT_TYPES = ["getdatafailed"];
  85700. this.events = new Events(this, null, this.EVENT_TYPES);
  85701. }
  85702. /**
  85703. * @function ChartViewModel.prototype._initXYField
  85704. * @description 初始化XY字段。
  85705. * @private
  85706. * @param {Object} chartOptions - options里的图表参数。
  85707. */
  85708. _initXYField(chartOptions) {
  85709. let me = this;
  85710. if (chartOptions && chartOptions.length > 0) {
  85711. chartOptions.forEach(function (option) {
  85712. if (option.xAxis) {
  85713. me.xField.push({
  85714. field: option.xAxis.field,
  85715. name: option.xAxis.name
  85716. });
  85717. }
  85718. if (option.yAxis) {
  85719. me.yField.push({
  85720. field: option.yAxis.field,
  85721. name: option.yAxis.name
  85722. });
  85723. }
  85724. });
  85725. }
  85726. }
  85727. /**
  85728. * @function ChartViewModel.prototype.getDatasetInfo
  85729. * @description 获得数据集数据。
  85730. * @param {function} success - 成功回调函数。
  85731. */
  85732. getDatasetInfo(success) {
  85733. this.createChart = success;
  85734. if (this.datasets && this._checkUrl(this.datasets.url)) {
  85735. this.chartModel = new ChartModel(this.datasets);
  85736. if(this.datasets.type === 'iServer'){
  85737. this.chartModel.getDatasetInfo(this._getDatasetInfoSuccess.bind(this));
  85738. }else if(this.datasets.type === 'iPortal'){
  85739. this.chartModel.getDataInfoByIptl(this._getDataInfoSuccess.bind(this));
  85740. }
  85741. /**
  85742. * @event ChartViewModel#getdatafailed
  85743. * @description 监听到获取数据失败事件后触发。
  85744. * @property {Object} error - 事件对象。
  85745. */
  85746. this.chartModel.events.on({"getdatafailed": (error) => {
  85747. this.events.triggerEvent("getdatafailed", error)
  85748. }});
  85749. }
  85750. }
  85751. /**
  85752. * @function ChartViewModel.prototype._getDatasetInfoSuccess
  85753. * @description 成功回调函数。
  85754. * @private
  85755. * @param {Object} results - 数据集信息。
  85756. */
  85757. _getDatasetInfoSuccess(results) {
  85758. let datasetUrl = this.datasets.url;
  85759. //判断服务为地图服务 或者 数据服务
  85760. let restIndex = datasetUrl.indexOf("rest");
  85761. if (restIndex > 0) {
  85762. let index = datasetUrl.indexOf("/", restIndex + 5);
  85763. let type = datasetUrl.substring(restIndex + 5, index);
  85764. let dataUrl = datasetUrl.substring(0, restIndex + 4) + "/data";
  85765. if (type === "maps") {
  85766. let mapIndex = datasetUrl.indexOf("/", index + 1);
  85767. let mapName = datasetUrl.substring(index + 1, mapIndex);
  85768. dataUrl = datasetUrl.substring(0, restIndex + 4) + "/maps/" + mapName;
  85769. results.result.dataUrl = dataUrl;
  85770. this._getLayerFeatures(results);
  85771. } else if (type === "data") {
  85772. results.result.dataUrl = dataUrl;
  85773. this._getDataFeatures(results);
  85774. }
  85775. }
  85776. }
  85777. /**
  85778. * @function ChartViewModel.prototype._getDataInfoSuccess
  85779. * @description 请求iportal数据成功之后的回调。
  85780. * @private
  85781. */
  85782. _getDataInfoSuccess(results, type) {
  85783. let me = this;
  85784. if(type === 'RESTMAP'){
  85785. me._getChartDatasFromLayer(results);
  85786. }else{
  85787. me._getChartDatas(results);
  85788. }
  85789. }
  85790. /**
  85791. * @function ChartViewModel.prototype._getDataFeatures
  85792. * @description 请求数据集的数据信息
  85793. * @private
  85794. * @param {Object} results - 数据集信息
  85795. */
  85796. _getDataFeatures(results) {
  85797. this.chartModel.getDataFeatures(results, this._getChartDatas.bind(this));
  85798. }
  85799. /**
  85800. * @function ChartViewModel.prototype._getLayerFeatures
  85801. * @description 请求图层的数据信息。
  85802. * @private
  85803. * @param {Object} results - 数据集信息。
  85804. */
  85805. _getLayerFeatures(results) {
  85806. this.chartModel.getLayerFeatures(results, this._getChartDatasFromLayer.bind(this));
  85807. }
  85808. /**
  85809. * @function ChartViewModel.prototype._getChartDatas
  85810. * @description 将请求回来的数据转换为图表所需的数据格式。
  85811. * @private
  85812. * @param {Object} results - 数据要素信息。
  85813. */
  85814. _getChartDatas(results) {
  85815. if (results) {
  85816. // 数据来自restdata---results.result.features
  85817. this.features = results.result.features;
  85818. let features = this.features.features;
  85819. let data = {};
  85820. if (features.length) {
  85821. let feature = features[0];
  85822. let attrFields = [],
  85823. itemTypes = [];
  85824. for (let attr in feature.properties) {
  85825. attrFields.push(attr);
  85826. itemTypes.push(this._getDataType(feature.properties[attr]));
  85827. }
  85828. data = {
  85829. features,
  85830. fieldCaptions: attrFields,
  85831. fieldTypes: itemTypes,
  85832. fieldValues: []
  85833. }
  85834. for (let m in itemTypes) {
  85835. let fieldValue = [];
  85836. for (let j in features) {
  85837. let feature = features[j];
  85838. let caption = data.fieldCaptions[m];
  85839. let value = feature.properties[caption];
  85840. fieldValue.push(value);
  85841. }
  85842. data.fieldValues.push(fieldValue);
  85843. }
  85844. this.createChart(data);
  85845. }
  85846. }
  85847. }
  85848. /**
  85849. * @function ChartViewModel.prototype._getChartDatasFromLayer
  85850. * @description 将请求回来的数据转换为图表所需的数据格式。
  85851. * @private
  85852. * @param {Object} results - 图层数据要素信息。
  85853. */
  85854. _getChartDatasFromLayer(results) {
  85855. if (results.result.recordsets) {
  85856. let recordsets = results.result.recordsets[0];
  85857. let features = recordsets.features.features;
  85858. this.features = recordsets.features;
  85859. let data = {};
  85860. if (features.length) {
  85861. data = {
  85862. features: recordsets.features,
  85863. fieldCaptions: recordsets.fieldCaptions,
  85864. fieldTypes: recordsets.fieldTypes,
  85865. fieldValues: []
  85866. }
  85867. for (let m in data.fieldCaptions) {
  85868. let fieldValue = [];
  85869. for (let j in features) {
  85870. let feature = features[j];
  85871. let caption = data.fieldCaptions[m];
  85872. let value = feature.properties[caption];
  85873. fieldValue.push(value);
  85874. }
  85875. data.fieldValues.push(fieldValue);
  85876. }
  85877. this.createChart(data);
  85878. }
  85879. }
  85880. }
  85881. /**
  85882. * @function ChartViewModel.prototype._createChartOptions
  85883. * @description 创建图表所需参数。
  85884. * @private
  85885. * @param {Object} data - 图表数据。
  85886. */
  85887. _createChartOptions(data) {
  85888. this.calculatedData = this._createChartDatas(data);
  85889. return this.updateChartOptions(this.chartType);
  85890. }
  85891. /**
  85892. * @function ChartViewModel.prototype.changeType
  85893. * @description 改变图表类型。
  85894. * @param {string} type - 图表类型。
  85895. */
  85896. changeType(type) {
  85897. if (type !== this.chartType) {
  85898. this.chartType = type;
  85899. return this.updateChartOptions(this.chartType);
  85900. }
  85901. }
  85902. /**
  85903. * @function ChartViewModel.prototype.updateData
  85904. * @description 改变图表类型。
  85905. * @param {ChartView.Datasets} datasets - 数据来源。
  85906. * @param {function} success 成功回调函数。
  85907. */
  85908. updateData(datasets, chartOption, success) {
  85909. this.updateChart = success;
  85910. this.xField = [];
  85911. this.yField = [];
  85912. this._initXYField(chartOption);
  85913. // type的设置默认值
  85914. datasets.type = datasets.type || 'iServer';
  85915. // withCredentials的设置默认值
  85916. datasets.withCredentials = datasets.withCredentials || false;
  85917. this.datasets = datasets;
  85918. this.getDatasetInfo(this._updateDataSuccess.bind(this));
  85919. }
  85920. /**
  85921. * @function ChartViewModel.prototype._updateDataSuccess
  85922. * @description 改变图表类型。
  85923. * @private
  85924. * @param {Object} data - 图表数据。
  85925. */
  85926. _updateDataSuccess(data) {
  85927. let options = this._createChartOptions(data);
  85928. this.updateChart(options);
  85929. }
  85930. /**
  85931. * @function ChartViewModel.prototype.updateChartOptions
  85932. * @description 更新图表所需参数。
  85933. * @param {string} type - 图表类型。
  85934. * @param {Object} style - 图表样式。
  85935. */
  85936. updateChartOptions(type, style) {
  85937. if (this.calculatedData) {
  85938. let grid = this.grid;
  85939. let series = this._createChartSeries(this.calculatedData, type);
  85940. let datas = [];
  85941. for (let i in this.calculatedData.XData) {
  85942. datas.push({
  85943. value: this.calculatedData.XData[i].fieldsData
  85944. });
  85945. }
  85946. let xAxis = {
  85947. type: "category",
  85948. name: this.xField[0].name || "X",
  85949. data: datas,
  85950. nameTextStyle: {
  85951. color: '#fff',
  85952. fontSize: 14
  85953. },
  85954. splitLine: {
  85955. show: false
  85956. },
  85957. axisLine: {
  85958. lineStyle: {
  85959. color: '#eee'
  85960. }
  85961. }
  85962. }
  85963. let yAxis = {
  85964. type: "value",
  85965. name: this.yFieldName || "Y",
  85966. data: {},
  85967. nameTextStyle: {
  85968. color: '#fff',
  85969. fontSize: 14
  85970. },
  85971. splitLine: {
  85972. show: false
  85973. },
  85974. axisLine: {
  85975. lineStyle: {
  85976. color: '#eee'
  85977. }
  85978. }
  85979. }
  85980. let tooltip = {
  85981. formatter: '{b0}: {c0}'
  85982. };
  85983. let backgroundColor = '#404a59';
  85984. if (style) {
  85985. if (style.grid) {
  85986. grid = style.grid;
  85987. }
  85988. if (style.tooltip) {
  85989. tooltip = style.tooltip;
  85990. }
  85991. if (style.backgroundColor) {
  85992. backgroundColor = style.backgroundColor;
  85993. }
  85994. }
  85995. return {
  85996. backgroundColor: backgroundColor,
  85997. grid: grid,
  85998. series: series,
  85999. xAxis: xAxis,
  86000. yAxis: yAxis,
  86001. tooltip: tooltip
  86002. }
  86003. }
  86004. }
  86005. /**
  86006. * @function ChartViewModel.prototype._createChartDatas
  86007. * @description 构建图表数据。
  86008. * @private
  86009. * @param {Object} data - 源数据。
  86010. */
  86011. _createChartDatas(data) {
  86012. let fieldIndex = 0, yfieldIndexs = [];
  86013. let fieldCaptions = data.fieldCaptions;
  86014. let me = this;
  86015. //X
  86016. fieldCaptions.forEach(function (field, index) {
  86017. if (me.xField[0] && field === me.xField[0].field) {
  86018. fieldIndex = index;
  86019. }
  86020. });
  86021. //Y
  86022. this.yFieldName = "";
  86023. this.yField.forEach(function (value, index) {
  86024. if (index !== 0) {
  86025. me.yFieldName = me.yFieldName + ",";
  86026. }
  86027. me.yFieldName = me.yFieldName + value.name;
  86028. fieldCaptions.forEach(function (field, index) {
  86029. if (field === value.field) {
  86030. yfieldIndexs.push(index);
  86031. }
  86032. });
  86033. })
  86034. let datas = this._getAttrData(data, fieldIndex);
  86035. let yDatas = [];
  86036. if (yfieldIndexs.length > 0) {
  86037. yfieldIndexs.forEach(function (yfieldIndex) {
  86038. let yData = [];
  86039. for (let i in data.fieldValues[yfieldIndex]) {
  86040. yData.push({
  86041. value: data.fieldValues[yfieldIndex][i]
  86042. });
  86043. }
  86044. yDatas.push(yData);
  86045. });
  86046. } else { //未指定Y字段时,y轴计数
  86047. let YData = [],
  86048. XData = [],
  86049. len = datas.length;
  86050. //计算X轴,Y轴数据,并去重
  86051. for (let i = 0; i < len; i++) {
  86052. let isSame = false;
  86053. for (let j = 0, leng = XData.length; j < leng; j++) {
  86054. if (datas[i].fieldsData === XData[j].fieldsData) {
  86055. YData[j].value++;
  86056. XData[j].recordIndexs.push(i);
  86057. isSame = true;
  86058. break;
  86059. }
  86060. }
  86061. if (!isSame) {
  86062. if (datas[i].fieldsData) {
  86063. XData.push({ fieldsData: datas[i].fieldsData, recordIndexs: [i] });
  86064. YData.push({ value: 1 });
  86065. }
  86066. }
  86067. }
  86068. datas = XData;
  86069. yDatas = [YData];
  86070. }
  86071. return {
  86072. XData: datas,
  86073. YData: yDatas
  86074. }
  86075. }
  86076. /**
  86077. * @function ChartViewModel.prototype._getAttrData
  86078. * @description 选中字段数据。
  86079. * @private
  86080. * @param {Object} datacontent - 图表数据。
  86081. * @param {number} index - 字段索引。
  86082. */
  86083. _getAttrData(datacontent, index) {
  86084. if (index === 0) {
  86085. this.xField = [{
  86086. field: datacontent.fieldCaptions[index],
  86087. name: datacontent.fieldCaptions[index]
  86088. }];
  86089. }
  86090. let fieldsDatas = [];
  86091. for (let i = 0, len = datacontent.fieldValues[index].length; i < len; i++) {
  86092. let value = datacontent.fieldValues[index][i];
  86093. fieldsDatas.push({
  86094. recordIndexs: i,
  86095. fieldsData: value
  86096. });
  86097. }
  86098. return fieldsDatas;
  86099. }
  86100. /**
  86101. * @function ChartViewModel.prototype._createChartSeries
  86102. * @description 图表数据。
  86103. * @private
  86104. * @param {Object} calculatedData - 图表数据。
  86105. * @param {string} chartType - 图表类型。
  86106. */
  86107. _createChartSeries(calculatedData, chartType) {
  86108. let series = [];
  86109. let yDatas = calculatedData.YData;
  86110. yDatas.forEach(function (yData) {
  86111. let value = 0;
  86112. let serieData = [];
  86113. for (let data of yData) {
  86114. value = data.value;
  86115. serieData.push({
  86116. value: value
  86117. });
  86118. }
  86119. let serie = {
  86120. type: chartType,
  86121. data: serieData,
  86122. name: "y"
  86123. };
  86124. series.push(serie);
  86125. });
  86126. return series;
  86127. }
  86128. /**
  86129. * @function ChartViewModel.prototype._isDate
  86130. * @description 判断是否为日期。
  86131. * @private
  86132. * @param {string} data - 字符串。
  86133. */
  86134. _isDate(data) {
  86135. 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;
  86136. return reg.test(data);
  86137. }
  86138. /**
  86139. * @function ChartViewModel.prototype._isNumber
  86140. * @description 判断是否为数值。
  86141. * @private
  86142. * @param {string} data - 字符串。
  86143. */
  86144. _isNumber(data) {
  86145. let mdata = Number(data);
  86146. if (mdata === 0) {
  86147. return true;
  86148. }
  86149. return !isNaN(mdata);
  86150. }
  86151. /**
  86152. * @function ChartViewModel.prototype._getDataType
  86153. * @description 判断数据的类型。
  86154. * @private
  86155. * @param {string} data - 字符串。
  86156. */
  86157. _getDataType(data) {
  86158. if (data !== null && data !== undefined && data !== '') {
  86159. if (this._isDate(data)) {
  86160. return "DATE";
  86161. }
  86162. if (this._isNumber(data)) {
  86163. return "NUMBER";
  86164. }
  86165. }
  86166. return "STRING";
  86167. }
  86168. /**
  86169. * @function ChartViewModel.prototype._checkUrl
  86170. * @description 检查url是否符合要求。
  86171. * @private
  86172. * @param {string} url。
  86173. */
  86174. _checkUrl(url) {
  86175. let match;
  86176. if (url === '' || !this._isMatchUrl(url)) {
  86177. match = false;
  86178. } else if (/^http[s]?:\/\/localhost/.test(url) || /^http[s]?:\/\/127.0.0.1/.test(url)) {
  86179. //不是实际域名
  86180. match = false;
  86181. } else {
  86182. match = true;
  86183. }
  86184. return match;
  86185. }
  86186. /**
  86187. * @function ChartViewModel.prototype._isMatchUrl
  86188. * @description 判断输入的地址是否符合地址格式。
  86189. * @private
  86190. * @param {string} str - url。
  86191. */
  86192. _isMatchUrl(str) {
  86193. var reg = new RegExp('(https?|http|file|ftp)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]');
  86194. return reg.test(str);
  86195. }
  86196. /**
  86197. * @function ChartViewModel.prototype.getStyle
  86198. * @description 获取图表样式。
  86199. */
  86200. getStyle() {
  86201. let style = {
  86202. grid: this.grid,
  86203. tooltip: this.tooltip,
  86204. backgroundColor: this.backgroundColor
  86205. }
  86206. return style;
  86207. }
  86208. /**
  86209. * @function ChartViewModel.prototype.getFeatures
  86210. * @description 获取地图服务,数据服务请求返回的数据。
  86211. */
  86212. getFeatures() {
  86213. return this.features;
  86214. }
  86215. /**
  86216. * @function ChartViewModel.prototype.setStyle
  86217. * @description 设置图表样式。
  86218. * @param {Object} style - 图表样式
  86219. */
  86220. setStyle(style) {
  86221. return this.updateChartOptions(this.chartType, style);
  86222. }
  86223. }
  86224. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartView.js
  86225. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  86226. * This program are made available under the terms of the Apache License, Version 2.0
  86227. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  86228. /**
  86229. * @class ChartView
  86230. * @aliasclass Components.ChartView
  86231. * @deprecatedclass SuperMap.Components.Chart
  86232. * @classdesc 图表组件。
  86233. * @modulecategory Components
  86234. * @version 9.1.2
  86235. * @param {string} domID - 图表dom元素ID。
  86236. * @param {Object} options - 可选参数。
  86237. * @param {string} options.type - 图表类型。
  86238. * @param {ChartView.Datasets} options.datasets - 数据来源。
  86239. * @param {Array.<Object>} options.chartOptions - 图表可选参数。
  86240. * @param {Array.<Object>} options.chartOptions.xAxis - 图表X轴。
  86241. * @param {string} options.chartOptions.xAxis.field - 图表X轴字段名。
  86242. * @param {string} options.chartOptions.xAxis.name - 图表X轴名称。
  86243. * @param {Array.<Object>} options.chartOptions.yAxis - 图表Y轴。
  86244. * @param {string} options.chartOptions.yAxis.field - 图表Y轴字段名。
  86245. * @param {string} options.chartOptions.yAxis.name - 图表Y轴名称。
  86246. * @category Components Chart
  86247. * @usage
  86248. */
  86249. /**
  86250. * @typedef {Object} ChartView.Datasets - 数据来源。
  86251. * @property {string} [type = 'iServer'] - 服务类型 iServer, iPortal。
  86252. * @property {string} url - 服务地址。
  86253. * @property {boolean} [withCredentials = false] - 设置请求是否带cookie。
  86254. * @property {FilterParameter} queryInfo - 查询条件。
  86255. */
  86256. class ChartView {
  86257. constructor(domID, options) {
  86258. this.domID = domID;
  86259. this.chartType = options.type || "bar";
  86260. // 设置options.datasets.type的默认值是iServer
  86261. options.datasets.type = options.datasets.type || 'iServer';
  86262. // 设置withCredentials的默认值为false
  86263. options.datasets.withCredentials = options.datasets.withCredentials || false;
  86264. this.viewModel = new ChartViewModel(options);
  86265. //添加控件。
  86266. this._fillDataToView();
  86267. }
  86268. /**
  86269. * @function ChartView.prototype.onAdd
  86270. * @description 创建图表之后成功回调。
  86271. * @param {function} addChart - 回调函数。
  86272. */
  86273. onAdd(addChart) {
  86274. this.addChart = addChart;
  86275. }
  86276. /**
  86277. * @function ChartView.prototype._fillDataToView
  86278. * @description 填充数据到 view。
  86279. * @private
  86280. */
  86281. _fillDataToView() {
  86282. let messageboxs = new MessageBox();
  86283. //iclient 绑定createChart事件成功回调
  86284. this.viewModel.getDatasetInfo(this._createChart.bind(this));
  86285. this.viewModel.events.on({
  86286. "getdatafailed": (error) => {
  86287. messageboxs.showView(error.message);
  86288. }
  86289. });
  86290. }
  86291. /**
  86292. * @function ChartView.prototype.getStyle
  86293. * @description 获取图表样式。
  86294. */
  86295. getStyle() {
  86296. return this.viewModel.getStyle()
  86297. }
  86298. /**
  86299. * @function ChartView.prototype.getFeatures
  86300. * @description 获取地图服务,数据服务请求返回的数据。
  86301. */
  86302. getFeatures() {
  86303. return this.viewModel.getFeatures();
  86304. }
  86305. /**
  86306. * @function ChartView.prototype.setStyle
  86307. * @description 设置图表样式。
  86308. * @param {Object} style - 图表样式,参考Echarts-options样式设置。
  86309. */
  86310. setStyle(style) {
  86311. let newOptions = this.viewModel.setStyle(style);
  86312. this._updateChart(newOptions);
  86313. }
  86314. /**
  86315. * @function ChartView.prototype.changeType
  86316. * @description 改变图表类型。
  86317. * @param {string} type - 图表类型。
  86318. */
  86319. changeType(type) {
  86320. if (this.chartType !== type) {
  86321. this.chartType = type;
  86322. let newOptions = this.viewModel.changeType(type);
  86323. this._updateChart(newOptions);
  86324. }
  86325. }
  86326. /**
  86327. * @function ChartView.prototype.updateData
  86328. * @description 更新图表数据。
  86329. * @param {ChartView.Datasets} datasets - 数据来源。
  86330. * @param {Object} chartOption - X,Y轴信息。
  86331. */
  86332. updateData(datasets, chartOption) {
  86333. let me = this;
  86334. this.viewModel.updateData(datasets, chartOption, function (options) {
  86335. me._updateChart(options);
  86336. if (me.addChart) {
  86337. me.addChart();
  86338. }
  86339. });
  86340. }
  86341. /**
  86342. * @function ChartView.prototype._createChart
  86343. * @description 创建图表。
  86344. * @private
  86345. * @param {Object} data - 图表数据。
  86346. */
  86347. _createChart(data) {
  86348. this.echart = external_function_try_return_echarts_catch_e_return_namespaceObject.init(
  86349. document.getElementById(this.domID),
  86350. null, {
  86351. renderer: "canvas"
  86352. }
  86353. )
  86354. let options = this.viewModel._createChartOptions(data);
  86355. this.echart.setOption(options);
  86356. if (this.addChart) {
  86357. this.addChart();
  86358. }
  86359. }
  86360. /**
  86361. * @function ChartView.prototype._updateChart
  86362. * @description 更新图表。
  86363. * @private
  86364. * @param {Object} options - 图表参数。
  86365. */
  86366. _updateChart(options) {
  86367. if (this.echart) {
  86368. this.echart.clear();
  86369. this.echart.setOption(options);
  86370. }
  86371. }
  86372. }
  86373. ;// CONCATENATED MODULE: ./src/common/components/templates/TemplateBase.js
  86374. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  86375. * This program are made available under the terms of the Apache License, Version 2.0
  86376. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  86377. /**
  86378. * @class TemplateBase
  86379. * @aliasclass Components.TemplateBase
  86380. * @deprecatedclass SuperMap.Components.TemplateBase
  86381. * @classdesc 组件公用组件父类,用于约束统一封装的公用组件结构。
  86382. * @version 9.1.1
  86383. * @param {Object} options - 组件配置参数。
  86384. * @param {string} options.id - 组件 dom 元素 id。
  86385. * @category Components Common
  86386. * @usage
  86387. */
  86388. class TemplateBase {
  86389. constructor(options) {
  86390. options = options ? options : {};
  86391. /**
  86392. * @member {string} [TemplateBase.prototype.id=null]
  86393. * @description 组件 dom 元素 id。
  86394. */
  86395. this.id = options.id ? options.id : null;
  86396. /**
  86397. * @member {HTMLElement} [TemplateBase.prototype.rootContainer=null]
  86398. * @description 组件 dom 元素对象。
  86399. */
  86400. this.rootContainer = null;
  86401. }
  86402. /**
  86403. * @function TemplateBase.prototype.getElement
  86404. * @description 获取当前组件元素对象。
  86405. * @return {HTMLElement} 组件 dom 元素对象
  86406. */
  86407. getElement() {
  86408. //todo 其实感觉再这里给组件设置不太合理
  86409. if (this.id) {
  86410. this.rootContainer.id = this.id;
  86411. }
  86412. return this.rootContainer;
  86413. }
  86414. /**
  86415. * @function TemplateBase.prototype._initView
  86416. * @private
  86417. * @description 初始化模板。
  86418. */
  86419. _initView() {
  86420. //子类实现此方法
  86421. }
  86422. /**
  86423. * @function TemplateBase.prototype.showView
  86424. * @description 显示组件。
  86425. */
  86426. showView() {
  86427. this.rootContainer.hidden = false;
  86428. }
  86429. /**
  86430. * @function TemplateBase.prototype.closeView
  86431. * @description 隐藏组件。
  86432. */
  86433. closeView() {
  86434. this.rootContainer.hidden = true;
  86435. }
  86436. }
  86437. ;// CONCATENATED MODULE: ./src/common/components/templates/CommonContainer.js
  86438. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  86439. * This program are made available under the terms of the Apache License, Version 2.0
  86440. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  86441. /**
  86442. * @class CommonContainer
  86443. * @aliasclass Components.CommonContainer
  86444. * @deprecatedclass SuperMap.Components.CommonContainer
  86445. * @classdesc 组件统一外框。
  86446. * @version 9.1.1
  86447. * @param {Object} options - 组件配置参数。
  86448. * @param {string} options.id - 组件 dom 元素 id。
  86449. * @param {string} options.title - 标题。
  86450. * @category Components Common
  86451. * @extends {TemplateBase}
  86452. * @usage
  86453. */
  86454. class CommonContainer extends TemplateBase {
  86455. constructor(options) {
  86456. super(options);
  86457. let title = options.title ? options.title : "";
  86458. this._initView(title);
  86459. }
  86460. /**
  86461. * @private
  86462. * @override
  86463. */
  86464. _initView(title) {
  86465. const container = document.createElement("div");
  86466. container.setAttribute("class", "component-container");
  86467. //title
  86468. const titleContainer = document.createElement("div");
  86469. titleContainer.setAttribute("class", "component-title");
  86470. const titleContent = document.createElement("div");
  86471. titleContent.innerHTML = title;
  86472. titleContainer.appendChild(titleContent);
  86473. container.appendChild(titleContainer);
  86474. //container
  86475. const componentContent = document.createElement("div");
  86476. componentContent.setAttribute("class", "component-content");
  86477. container.appendChild(componentContent);
  86478. this.content = componentContent;
  86479. this.rootContainer = container;
  86480. return container;
  86481. }
  86482. /**
  86483. * @function CommonContainer.prototype.getContentElement
  86484. * @description 获取内容元素容器。
  86485. */
  86486. getContentElement() {
  86487. return this.content;
  86488. }
  86489. /**
  86490. * @function CommonContainer.prototype.appendContent
  86491. * @description 填充内容元素。
  86492. */
  86493. appendContent(element) {
  86494. this.content.appendChild(element);
  86495. }
  86496. }
  86497. ;// CONCATENATED MODULE: ./src/common/components/templates/Select.js
  86498. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  86499. * This program are made available under the terms of the Apache License, Version 2.0
  86500. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  86501. /**
  86502. * @class Select
  86503. * @aliasclass Components.Select
  86504. * @deprecatedclass SuperMap.Components.Select
  86505. * @classdesc 组件统一的文字下拉框。
  86506. * @version 9.1.1
  86507. * @param {Array.<string|Array>} options - 组件配置参数数组。
  86508. * @param {string} options.id - 组件 dom 元素 id。
  86509. * @param {string} [options.labelName] - label 名称。
  86510. * @param {Array.<string>} options.optionsArr - 需要创建的 option 数据数组。
  86511. * @param {function} [options.optionsClickCb] - option 点击事件回调函数。
  86512. * @extends {TemplateBase}
  86513. * @category Components Common
  86514. * @usage
  86515. */
  86516. class Select extends TemplateBase {
  86517. constructor(options) {
  86518. super(options);
  86519. this._initView(options);
  86520. }
  86521. _initView(options) {
  86522. let selectTool = this._createElement('div', "component-selecttool");
  86523. if (options.labelName) {
  86524. let label = this._createElement('label', 'component-selecttool__lable--describe', selectTool);
  86525. label.innerHTML = options.labelName;
  86526. }
  86527. let chartSelect = this._createElement('div', 'component-selecttool--chart', selectTool);
  86528. chartSelect.setAttribute('tabindex', '1');
  86529. let selectName = this._createElement('div', "component-selecttool__name", chartSelect);
  86530. selectName.title = options.optionsArr[0];
  86531. selectName.innerHTML = options.optionsArr[0];
  86532. let chartTriangleBtn = this._createElement('div', 'component-selecttool__trianglebtn--chart', chartSelect);
  86533. let triangleBtn = this._createElement('div', 'component-triangle-down-img', chartTriangleBtn);
  86534. let selectContent = this._createElement('div', 'component-selecttool__content', chartSelect);
  86535. let scrollarea = this._createElement('div', 'component-selecttool__content--chart', selectContent);
  86536. let scrollareaContent = this._createElement('div', 'component-selecttool__scrollarea__content', scrollarea);
  86537. scrollareaContent.setAttribute('tabindex', '1');
  86538. this.createOptions(scrollareaContent, options.optionsArr);
  86539. this.optionClickEvent(scrollareaContent, selectName, options.optionsClickCb);
  86540. // 下拉框显示 & 隐藏事件
  86541. this._selectClickEvent(chartSelect, selectContent, triangleBtn);
  86542. this.rootContainer = selectTool;
  86543. }
  86544. /**
  86545. * @function Select.prototype.createOptions
  86546. * @description 创建所属下拉框选项。
  86547. */
  86548. createOptions(container, optionsArr) {
  86549. for (let i in optionsArr) {
  86550. let option = this._createElement('div', 'component-selecttool__option', container);
  86551. option.title = optionsArr[i];
  86552. option.innerHTML = optionsArr[i];
  86553. }
  86554. }
  86555. /**
  86556. * @function Select.prototype._selectClickEvent
  86557. * @description select 点击显示&隐藏事件。
  86558. * @private
  86559. */
  86560. _selectClickEvent(eventElement, contentElement, triangleBtn) {
  86561. eventElement.onclick = function (e) {
  86562. if (contentElement.style.display === "block") {
  86563. contentElement.style.display = "none";
  86564. triangleBtn.className = "component-triangle-down-img";
  86565. } else {
  86566. contentElement.style.display = "block";
  86567. triangleBtn.className = "triangle-up-img";
  86568. }
  86569. e.preventDefault();
  86570. e.stopPropagation();
  86571. };
  86572. eventElement.onmousedown = function (evt) {
  86573. //console.log('dropdownbox onmousedown '+evt.target.className);
  86574. if (evt.target !== this) {
  86575. this.focus();
  86576. evt.preventDefault();
  86577. evt.stopPropagation()
  86578. }
  86579. };
  86580. eventElement.onblur = function () {
  86581. contentElement.style.display = "none";
  86582. triangleBtn.className = "component-triangle-down-img";
  86583. }
  86584. }
  86585. /**
  86586. * @function Select.prototype._createElement
  86587. * @description 通用创建元素。
  86588. * @private
  86589. */
  86590. _createElement(tagName, className, parentEle) {
  86591. let ele = document.createElement(tagName || 'div');
  86592. className && (ele.className = className);
  86593. parentEle && parentEle.appendChild(ele);
  86594. return ele;
  86595. }
  86596. /**
  86597. * @function Select.prototype.optionClickEvent
  86598. * @description 下拉框的 option 的点击事件。
  86599. */
  86600. optionClickEvent(optionEleArr, selectNameEle, optionsClickCb) {
  86601. for (let i = 0; i < optionEleArr.children.length; i++) {
  86602. let childEle = optionEleArr.children[i];
  86603. childEle.onclick = function () {
  86604. selectNameEle.innerHTML = childEle.innerHTML;
  86605. selectNameEle.title = childEle.title;
  86606. if (childEle.getAttribute('data-value')) {
  86607. selectNameEle.setAttribute('data-value', childEle.getAttribute('data-value'))
  86608. }
  86609. optionsClickCb && optionsClickCb(childEle);
  86610. }
  86611. }
  86612. }
  86613. }
  86614. ;// CONCATENATED MODULE: ./src/common/components/templates/DropDownBox.js
  86615. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  86616. * This program are made available under the terms of the Apache License, Version 2.0
  86617. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  86618. /**
  86619. * @class DropDownBox
  86620. * @aliasclass Components.DropDownBox
  86621. * @deprecatedclass SuperMap.Components.DropDownBox
  86622. * @classdesc 组件统一的图片下拉框。
  86623. * @version 9.1.1
  86624. * @param {Array.<Object>} options - 组件配置参数数组。
  86625. * @param {string} options.id - 组件 dom 元素 id。
  86626. * @param {string} options.title - 下拉框 title。
  86627. * @param {string} options.remark - 下拉框解释标记文本。
  86628. * @param {string} [options.dataValue] - 下拉框 attribute 名为 data-value 的值 。
  86629. * @param {string} [options.icon] - 下拉框图标。
  86630. * @param {string} [options.icon.className] - 下拉框图标类名。
  86631. * @param {string} [options.icon.background] - 下拉框图标背景 url。
  86632. * @category Components Common
  86633. * @extends {TemplateBase}
  86634. * @usage
  86635. */
  86636. class DropDownBox extends TemplateBase {
  86637. constructor(optionsArr) {
  86638. super(optionsArr);
  86639. this._initView(optionsArr);
  86640. }
  86641. /**
  86642. * @function DropDownBox.prototype._initView
  86643. * @description 初始化下拉框。
  86644. * @private
  86645. * @override
  86646. */
  86647. _initView(optionsArr) {
  86648. let dropDownContainer = document.createElement('div');
  86649. dropDownContainer.className = 'component-dropdownbox--container';
  86650. let dropDownBox = document.createElement('div');
  86651. dropDownBox.setAttribute('tabindex', '1');
  86652. dropDownBox.className = "component-dropdownbox";
  86653. dropDownContainer.appendChild(dropDownBox);
  86654. let dropDownTopContainer = document.createElement('div');
  86655. dropDownBox.appendChild(dropDownTopContainer);
  86656. this._createDropDownOption(optionsArr[0], dropDownTopContainer);
  86657. let triangleBtnContainer = document.createElement('div');
  86658. triangleBtnContainer.className = 'component-dropdownbox__triangle-btn';
  86659. dropDownBox.appendChild(triangleBtnContainer);
  86660. let triangleBtn = document.createElement('div');
  86661. triangleBtn.className = 'component-triangle-down-img';
  86662. triangleBtnContainer.appendChild(triangleBtn);
  86663. let createDropDownBoxParam = {
  86664. "parentEle": dropDownBox,
  86665. "dropDownContent": ['component-dropdownbox__content component-dropdownbox__content--chart', 'dropDownContent'],
  86666. "scrollareaContent": 'component-selecttool__scrollarea__content',
  86667. "optionsArr": optionsArr,
  86668. "triangleBtn": triangleBtn,
  86669. "dropDownTopContainer": dropDownTopContainer
  86670. };
  86671. this._createDropDownBox(createDropDownBoxParam);
  86672. this.rootContainer = dropDownContainer;
  86673. }
  86674. /**
  86675. * @function DropDownBox.prototype._createDropDownBox
  86676. * @description 创建下拉框。
  86677. * @private
  86678. */
  86679. _createDropDownBox(createDropDownBoxParam) {
  86680. let dropDownBox = createDropDownBoxParam.parentEle;
  86681. let dropDownTopContainer = createDropDownBoxParam.dropDownTopContainer;
  86682. let dropDownContent = document.createElement('div');
  86683. dropDownContent.className = createDropDownBoxParam.dropDownContent[0];
  86684. dropDownBox.appendChild(dropDownContent);
  86685. let scrollareaContent = document.createElement('div');
  86686. scrollareaContent.className = createDropDownBoxParam.scrollareaContent;
  86687. dropDownContent.appendChild(scrollareaContent);
  86688. let optionsArr = createDropDownBoxParam.optionsArr;
  86689. for (let i = 0; i < optionsArr.length; i++) {
  86690. this._createDropDownOption(optionsArr[i], scrollareaContent)
  86691. }
  86692. // 下拉框显示 & 隐藏事件
  86693. let triangleBtn = createDropDownBoxParam.triangleBtn;
  86694. this._dropDownClickEvent(dropDownBox, dropDownContent, triangleBtn);
  86695. this._eleOnblur(dropDownBox, dropDownContent, triangleBtn);
  86696. // 下拉框 options 点击事件
  86697. let scrollareaOptions = scrollareaContent.children;
  86698. for (let i = 0; i < scrollareaOptions.length; i++) {
  86699. scrollareaOptions[i].onclick = function () {
  86700. dropDownTopContainer.innerHTML = scrollareaOptions[i].outerHTML;
  86701. //evt.stopPropagation();
  86702. }
  86703. }
  86704. }
  86705. /**
  86706. * @function DropDownBox.prototype._createDropDownOption
  86707. * @description 创建下拉框子元素。
  86708. * @private
  86709. */
  86710. _createDropDownOption(data, parentElement) {
  86711. let ele = document.createElement('div');
  86712. ele.className = 'component-dropdownbox__item';
  86713. let dataItem = data;
  86714. if (dataItem['dataValue']) {
  86715. ele.setAttribute('data-value', dataItem['dataValue']);
  86716. }
  86717. parentElement.appendChild(ele);
  86718. let imgContainer = document.createElement('div');
  86719. imgContainer.className = 'component-dropdownbox__item__img';
  86720. ele.appendChild(imgContainer);
  86721. let img = document.createElement('div');
  86722. if (dataItem.icon.className) {
  86723. img.className = dataItem.icon.className;
  86724. }
  86725. if (dataItem.icon.background) {
  86726. img.style.background = dataItem.icon.background;
  86727. }
  86728. imgContainer.appendChild(img);
  86729. let title = document.createElement('div');
  86730. title.className = 'component-dropdownbox__item__title';
  86731. title.title = dataItem.title;
  86732. title.innerHTML = dataItem.title;
  86733. ele.appendChild(title);
  86734. let remark = document.createElement('div');
  86735. remark.className = 'component-dropdownbox__item__remark';
  86736. remark.title = dataItem.remark;
  86737. remark.innerHTML = dataItem.remark;
  86738. ele.appendChild(remark);
  86739. }
  86740. /**
  86741. * @function DropDownBox.prototype._dropDownClickEvent
  86742. * @description 下拉框点击事件。
  86743. * @private
  86744. */
  86745. _dropDownClickEvent(eventElement, contentElement, triangleBtn) {
  86746. eventElement.onclick = function (e) {
  86747. if (contentElement.style.display === "block") {
  86748. contentElement.style.display = "none";
  86749. triangleBtn.className = "component-triangle-down-img";
  86750. } else {
  86751. contentElement.style.display = "block";
  86752. triangleBtn.className = "triangle-up-img";
  86753. }
  86754. e.preventDefault();
  86755. e.stopPropagation()
  86756. };
  86757. eventElement.onmousedown = function (evt) {
  86758. //console.log('dropdownbox onmousedown '+evt.target.className);
  86759. if (evt.target !== this) {
  86760. this.focus();
  86761. evt.preventDefault();
  86762. evt.stopPropagation()
  86763. }
  86764. }
  86765. }
  86766. /**
  86767. * @function DropDownBox.prototype._eleOnblur
  86768. * @description 下拉框失焦事件。
  86769. * @private
  86770. */
  86771. _eleOnblur(eventElement, contentElement, triangleBtn) {
  86772. eventElement.onblur = function () {
  86773. contentElement.style.display = "none";
  86774. triangleBtn.className = "component-triangle-down-img";
  86775. }
  86776. }
  86777. /**
  86778. * @function DropDownBox.prototype._createElement
  86779. * @description 通用创建元素。
  86780. * @private
  86781. */
  86782. _createElement(tagName, className, parentEle) {
  86783. let ele = document.createElement(tagName || 'div');
  86784. className && (ele.className = className);
  86785. parentEle && parentEle.appendChild(ele);
  86786. return ele;
  86787. }
  86788. }
  86789. ;// CONCATENATED MODULE: ./src/common/components/templates/PopContainer.js
  86790. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  86791. * This program are made available under the terms of the Apache License, Version 2.0
  86792. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  86793. /**
  86794. * @class PopContainer
  86795. * @aliasclass Components.PopContainer
  86796. * @deprecatedclass SuperMap.Components.PopContainer
  86797. * @classdesc 弹框组件。
  86798. * @version 9.1.1
  86799. * @param {Object} options - 组件配置参数。
  86800. * @param {string} options.id - 组件 dom 元素 id。
  86801. * @param {string} options.title - 弹框组件名称。
  86802. * @extends {TemplateBase}
  86803. * @category Components Common
  86804. * @usage
  86805. */
  86806. class PopContainer extends TemplateBase {
  86807. constructor(options) {
  86808. options = options ? options : {};
  86809. super(options);
  86810. options.title = options.title ? options.title : "";
  86811. this._initView(options.title);
  86812. }
  86813. /**
  86814. * @private
  86815. * @override
  86816. */
  86817. _initView(titile) {
  86818. const container = document.createElement("div");
  86819. container.setAttribute("class", "component-popcontainer");
  86820. //header
  86821. const header = document.createElement("div");
  86822. header.setAttribute("class", "component-popcontainer__header");
  86823. const title = document.createElement("label");
  86824. title.setAttribute("class", "component-popcontainer__header__title");
  86825. title.innerHTML = titile;
  86826. header.appendChild(title);
  86827. const closeBtn = document.createElement("span");
  86828. closeBtn.setAttribute("class", "supermapol-icons-clear component-popcontainer__header__close");
  86829. closeBtn.onclick = this.closeView.bind(this);
  86830. container.appendChild(closeBtn);
  86831. container.appendChild(header);
  86832. //content
  86833. const content = document.createElement("div");
  86834. content.setAttribute("class", "component-popcontainer__content");
  86835. this.content = content;
  86836. container.appendChild(content);
  86837. this.rootContainer = container;
  86838. }
  86839. /**
  86840. * @function PopContainer.prototype.appendContent
  86841. * @description 追加内容。
  86842. * @param {HTMLElement} dom - 内容元素。
  86843. */
  86844. appendContent(dom) {
  86845. this.content.appendChild(dom);
  86846. }
  86847. }
  86848. ;// CONCATENATED MODULE: ./src/common/components/templates/AttributesPopContainer.js
  86849. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  86850. * This program are made available under the terms of the Apache License, Version 2.0
  86851. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  86852. /**
  86853. * @class AttributesPopContainer
  86854. * @aliasclass Components.AttributesPopContainer
  86855. * @deprecatedclass SuperMap.Components.AttributesPopContainer
  86856. * @classdesc 属性弹框组件
  86857. * @version 9.1.1
  86858. * @param {Object} options - 组件配置参数。
  86859. * @param {string} options.id - 组件 dom 元素 id。
  86860. * @param {Object} options.title - 属性弹框组件名称。
  86861. * @param {Object} options.attributes - 组件需要显示的属性内容。
  86862. * @extends {PopContainer}
  86863. * @category Components Common
  86864. * @usage
  86865. */
  86866. class AttributesPopContainer extends PopContainer {
  86867. constructor(options) {
  86868. //默认为属性:
  86869. options.title = options.title ? options.title : "属性";
  86870. super(options);
  86871. this.rootContainer.firstChild.hidden = true;
  86872. options.attributes = options.attributes ? options.attributes : [];
  86873. this._createAttributesTable(options.attributes);
  86874. }
  86875. _createAttributesTable(attributes) {
  86876. const table = document.createElement("table");
  86877. table.setAttribute("class", "component-popcontainer__content__table");
  86878. const tbody = document.createElement("tbody");
  86879. let single = true;
  86880. for (let name in attributes) {
  86881. const tr = document.createElement("tr");
  86882. if (single) {
  86883. tr.setAttribute("class", "component-popcontainer__content__td--color");
  86884. }
  86885. const title = document.createElement("td");
  86886. const titleSpan = document.createElement("Span");
  86887. titleSpan.innerHTML = name;
  86888. title.appendChild(titleSpan);
  86889. const value = document.createElement("td");
  86890. value.innerHTML = attributes[name];
  86891. tr.appendChild(title);
  86892. tr.appendChild(value);
  86893. tbody.appendChild(tr);
  86894. single = !single;
  86895. }
  86896. table.appendChild(tbody);
  86897. this.appendContent(table);
  86898. }
  86899. }
  86900. ;// CONCATENATED MODULE: ./src/common/components/templates/IndexTabsPageContainer.js
  86901. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  86902. * This program are made available under the terms of the Apache License, Version 2.0
  86903. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  86904. /**
  86905. * @class IndexTabsPageContainer
  86906. * @aliasclass Components.IndexTabsPageContainer
  86907. * @deprecatedclass SuperMap.Components.IndexTabsPageContainer
  86908. * @classdesc 标签索引组件。
  86909. * @version 9.1.1
  86910. * @param {Object} options - 组件配置参数。
  86911. * @param {string} options.id - 组件 dom 元素 id。
  86912. * @category Components Common
  86913. * @extends {TemplateBase}
  86914. * @usage
  86915. */
  86916. class IndexTabsPageContainer extends TemplateBase {
  86917. constructor(options) {
  86918. super(options);
  86919. this._initView();
  86920. }
  86921. /**
  86922. * @private
  86923. * @override
  86924. */
  86925. _initView() {
  86926. const container = document.createElement("div");
  86927. container.setAttribute("class", "component-tabpage");
  86928. const header = document.createElement("ul");
  86929. this.header = header;
  86930. const content = document.createElement("div");
  86931. content.setAttribute("class", "component-tabpage__content");
  86932. this.content = content;
  86933. container.appendChild(header);
  86934. container.appendChild(content);
  86935. this.rootContainer = container;
  86936. }
  86937. /**
  86938. * @function IndexTabsPageContainer.prototype.setTabs
  86939. * @description 设置标签元素。
  86940. * @param {Array.<HTMLElement>} tabs
  86941. */
  86942. setTabs(tabs) {
  86943. this.removeAllTabs();
  86944. this.appendTabs(tabs);
  86945. }
  86946. /**
  86947. * @function IndexTabsPageContainer.prototype.appendTabs
  86948. * @description 追加标签元素。
  86949. * @param {Array.<HTMLElement>} tabs
  86950. */
  86951. appendTabs(tabs) {
  86952. for (let i = 0; i < tabs.length; i++) {
  86953. let title = document.createElement("span");
  86954. title.index = i;
  86955. title.appendChild(document.createTextNode(tabs[i].title));
  86956. //绑定标签切换对应页面:
  86957. title.onclick = this._changeTabsPage.bind(this);
  86958. let content = tabs[i].content;
  86959. content.index = i;
  86960. content.hidden = true;
  86961. this.header.appendChild(title);
  86962. this.content.appendChild(content);
  86963. }
  86964. //todo 确认是否两个子元素的 index 相互对应
  86965. //默认显示第一个标签对象
  86966. this.header.firstChild.setAttribute("class", "on");
  86967. this.content.firstChild.hidden = false;
  86968. }
  86969. /**
  86970. * @function IndexTabsPageContainer.prototype.removeTab
  86971. * @description 删除某个标签页面。
  86972. * @param {number} index - 标签索引号。
  86973. */
  86974. removeTab(index) {
  86975. this.header.removeChild(this.header.children[index]);
  86976. this.content.removeChild(this.content.children[index]);
  86977. }
  86978. /**
  86979. * @function IndexTabsPageContainer.prototype.removeAllTabs
  86980. * @description 删除所有标签。
  86981. */
  86982. removeAllTabs() {
  86983. for (let i = this.header.children.length; i > 0; i--) {
  86984. this.header.removeChild(this.header.children[i]);
  86985. this.content.removeChild(this.content.children[i]);
  86986. }
  86987. }
  86988. _changeTabsPage(e) {
  86989. const index = e.target.index;
  86990. for (let i = 0; i < this.header.children.length; i++) {
  86991. this.header.children[i].setAttribute("class", "");
  86992. this.content.children[i].hidden = true;
  86993. if (i === index) {
  86994. this.header.children[i].setAttribute("class", "on");
  86995. this.content.children[i].hidden = false;
  86996. }
  86997. }
  86998. }
  86999. }
  87000. ;// CONCATENATED MODULE: ./src/common/components/templates/CityTabsPage.js
  87001. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  87002. * This program are made available under the terms of the Apache License, Version 2.0
  87003. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87004. /**
  87005. * @class CityTabsPage
  87006. * @aliasclass Components.CityTabsPage
  87007. * @deprecatedclass SuperMap.Components.CityTabsPage
  87008. * @classdesc 城市地址匹配组件模板
  87009. * @version 9.1.1
  87010. * @param {Object} options - 组件配置参数。
  87011. * @param {string} options.id - 组件 dom 元素 id。
  87012. * @param {Object|Array.<string>} options.config - 城市名称配置列表,支持两种格式:{key1:{A:[],B:[]}, key2:{C:[],D:[]}} 或
  87013. * ["成都市","北京市"],用户可根据自己的项目需求进行配置
  87014. * @extends {IndexTabsPageContainer}
  87015. * @category Components Common
  87016. * @usage
  87017. */
  87018. class CityTabsPage extends IndexTabsPageContainer {
  87019. constructor(options) {
  87020. super(options);
  87021. //去掉默认的边框阴影样式:
  87022. this.rootContainer.classList.add("component-citytabpage--noneBoxShadow");
  87023. this.config = options.config;
  87024. //header,若 config为城市名称数组,则直接加载内容
  87025. if (Util_Util.isArray(this.config)) {
  87026. this.header.hidden = true;
  87027. this._createCityItem("城市", this.config);
  87028. this.content.style.border = "none";
  87029. } else {
  87030. this._createTabs();
  87031. this.header.onclick = (e) => {
  87032. //关闭所有元素 是否有更简化的写法?
  87033. for (let i = 0; i < this.header.children.length; i++) {
  87034. this.header.children[i].setAttribute("class", "");
  87035. }
  87036. //打开点击内容元素
  87037. e.target.setAttribute("class", "on");
  87038. this._createCityContent(e.target.innerHTML);
  87039. };
  87040. }
  87041. }
  87042. /**
  87043. * @function CityTabsPage.prototype._createTabs
  87044. * @description 创建 Tabs
  87045. * @private
  87046. */
  87047. _createTabs() {
  87048. //header
  87049. if (Util_Util.isArray(this.config)) {
  87050. for (let i = 0; i < this.config.length; i++) {
  87051. let innerHTML = "";
  87052. for (const key in this.config[i]) {
  87053. innerHTML += key;
  87054. }
  87055. let li = document.createElement("li");
  87056. li.innerHTML = innerHTML;
  87057. this.header.appendChild(li);
  87058. }
  87059. } else {
  87060. for (const key in this.config) {
  87061. let li = document.createElement("li");
  87062. li.innerHTML = key;
  87063. this.header.appendChild(li);
  87064. }
  87065. }
  87066. this.header.firstChild.setAttribute("class", "on");
  87067. this._createCityContent(this.header.firstChild.innerHTML);
  87068. }
  87069. /**
  87070. * @function CityTabsPage.prototype._createCityContent
  87071. * @description 创建列表容器
  87072. * @private
  87073. */
  87074. _createCityContent(keyName) {
  87075. //清除元素:
  87076. for (let i = this.content.children.length; i > 0; i--) {
  87077. this.content.removeChild(this.content.children[i - 1]);
  87078. }
  87079. //创建对应元素
  87080. const cities = this.config[keyName];
  87081. for (let key in cities) {
  87082. this._createCityItem(key, cities[key]);
  87083. }
  87084. }
  87085. /**
  87086. * @function CityTabsPage.prototype._createCityContent
  87087. * @description 创建列表容器
  87088. * @private
  87089. */
  87090. _createCityItem(key, cities) {
  87091. const city = document.createElement("div");
  87092. const cityClass = document.createElement("div");
  87093. cityClass.setAttribute("class", "component-citytabpag__py-key");
  87094. cityClass.innerHTML = key;
  87095. city.appendChild(cityClass);
  87096. const cityContent = document.createElement("div");
  87097. cityContent.setAttribute("class", "component-citytabpag__content");
  87098. for (let i = 0; i < cities.length; i++) {
  87099. let span = document.createElement("span");
  87100. span.innerHTML = cities[i];
  87101. cityContent.appendChild(span);
  87102. }
  87103. //HOT 元素长度单独微调:
  87104. if (key === "HOT") {
  87105. cityContent.style.width = "428px";
  87106. }
  87107. city.appendChild(cityContent);
  87108. this.content.appendChild(city);
  87109. }
  87110. }
  87111. ;// CONCATENATED MODULE: ./src/common/components/templates/NavTabsPage.js
  87112. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  87113. * This program are made available under the terms of the Apache License, Version 2.0
  87114. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87115. /**
  87116. * @class NavTabsPage
  87117. * @aliasclass Components.NavTabsPage
  87118. * @deprecatedclass SuperMap.Components.NavTabsPage
  87119. * @classdesc 标签页面组件。
  87120. * @version 9.1.1
  87121. * @param {Object} options - 组件配置参数。
  87122. * @param {string} options.id - 组件 dom 元素 id。
  87123. * @param {Array.<Object>} [options.tabs=[]] - 标签对象数组,形如:[{title: "",content: HTMLElement}],初始时,传入则创建页面。
  87124. * @extends {TemplateBase}
  87125. * @category Components Common
  87126. * @usage
  87127. */
  87128. // todo 思考拆分的控件应该以哪种方式使用
  87129. class NavTabsPage extends TemplateBase {
  87130. constructor(options) {
  87131. super(options);
  87132. this.navTabsTitle = null;
  87133. this.navTabsContent = null;
  87134. options.tabs = options.tabs ? options.tabs : [];
  87135. this._initView(options.tabs);
  87136. }
  87137. /**
  87138. * @override
  87139. * @private
  87140. */
  87141. _initView(tabs) {
  87142. const navTabsPage = document.createElement("div");
  87143. navTabsPage.setAttribute("class", "component-navtabspage");
  87144. //关闭按钮
  87145. const closeBtn = document.createElement("span");
  87146. closeBtn.setAttribute("class", "supermapol-icons-close");
  87147. closeBtn.onclick = this.closeView.bind(this);
  87148. navTabsPage.appendChild(closeBtn);
  87149. //标签
  87150. const navTabsTitle = document.createElement("div");
  87151. this.navTabsTitle = navTabsTitle;
  87152. navTabsTitle.setAttribute("class", "component-navtabspage__title");
  87153. navTabsPage.appendChild(navTabsTitle);
  87154. //内容
  87155. const navTabsContent = document.createElement("div");
  87156. this.navTabsContent = navTabsContent;
  87157. navTabsContent.setAttribute("class", "component-navtabspage__content");
  87158. navTabsPage.appendChild(navTabsContent);
  87159. //若 tabs 初始传入值,则
  87160. if (tabs.length > 0) {
  87161. this.appendTabs(tabs);
  87162. }
  87163. this.rootContainer = navTabsPage;
  87164. }
  87165. /**
  87166. * @function NavTabsPage.prototype.setTabs
  87167. * @description 设置标签。
  87168. * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
  87169. */
  87170. setTabs(tabs) {
  87171. this.removeAllTabs();
  87172. this.appendTabs(tabs);
  87173. }
  87174. /**
  87175. * @function NavTabsPage.prototype.appendTabs
  87176. * @description 添加标签页面。
  87177. * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
  87178. */
  87179. appendTabs(tabs) {
  87180. for (let i = 0; i < tabs.length; i++) {
  87181. let title = document.createElement("span");
  87182. title.index = i;
  87183. title.appendChild(document.createTextNode(tabs[i].title));
  87184. //绑定标签切换对应页面:
  87185. title.onclick = this._changeTabsPage.bind(this);
  87186. let content = tabs[i].content;
  87187. content.index = i;
  87188. content.hidden = true;
  87189. this.navTabsTitle.appendChild(title);
  87190. this.navTabsContent.appendChild(content);
  87191. }
  87192. //todo 确认是否两个子元素的 index 相互对应
  87193. //默认显示第一个标签对象
  87194. this.navTabsTitle.firstChild.setAttribute("class", "component-navtabspage__tabs--select");
  87195. this.navTabsContent.firstChild.hidden = false;
  87196. }
  87197. /**
  87198. * @function NavTabsPage.prototype.removeTab
  87199. * @description 删除某个标签页面。
  87200. * @param {number} index - 标签索引号。
  87201. */
  87202. removeTab(index) {
  87203. this.navTabsTitle.removeChild(this.navTabsTitle.children[index]);
  87204. this.navTabsContent.removeChild(this.navTabsContent.children[index]);
  87205. }
  87206. /**
  87207. * @function NavTabsPage.prototype.removeAllTabs
  87208. * @description 删除所有标签。
  87209. */
  87210. removeAllTabs() {
  87211. for (let i = this.navTabsTitle.children.length; i > 0; i--) {
  87212. this.navTabsTitle.removeChild(this.navTabsTitle.children[i]);
  87213. this.navTabsContent.removeChild(this.navTabsContent.children[i]);
  87214. }
  87215. }
  87216. _changeTabsPage(e) {
  87217. const index = e.target.index;
  87218. for (let i = 0; i < this.navTabsTitle.children.length; i++) {
  87219. this.navTabsTitle.children[i].setAttribute("class", "");
  87220. this.navTabsContent.children[i].hidden = true;
  87221. if (i === index) {
  87222. this.navTabsTitle.children[i].setAttribute("class", "component-navtabspage__tabs--select");
  87223. this.navTabsContent.children[i].hidden = false;
  87224. }
  87225. }
  87226. }
  87227. }
  87228. ;// CONCATENATED MODULE: ./src/common/components/templates/PaginationContainer.js
  87229. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  87230. * This program are made available under the terms of the Apache License, Version 2.0
  87231. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87232. /**
  87233. * @class PaginationContainer
  87234. * @aliasclass Components.PaginationContainer
  87235. * @deprecatedclass SuperMap.Components.PaginationContainer
  87236. * @classdesc 分页组件模板。
  87237. * @version 9.1.1
  87238. * @param {Object} options - 组件配置参数。
  87239. * @param {string} options.id - 组件 dom 元素 id。
  87240. * @param {HTMLElement} options.contents - 页面填充的 DOM 元素对象。
  87241. * @param {number} options.pageCounts - 页数。
  87242. * @extends {TemplateBase}
  87243. * @category Components Common
  87244. * @usage
  87245. */
  87246. class PaginationContainer extends TemplateBase {
  87247. constructor(options) {
  87248. options = options ? options : {};
  87249. super(options);
  87250. this.currentPage = 0;
  87251. this.pageNumberLis = [];
  87252. this.currentPageNumberLis = [];
  87253. this.linkageEvent = null;
  87254. options.contents = options.contents ? options.contents : null;
  87255. options.pageCounts = options.pageCounts ? options.pageCounts : 0;
  87256. this._initView(options.contents, options.pageCounts);
  87257. }
  87258. /**
  87259. * @function PaginationContainer.prototype.setLinkageEvent
  87260. * @description 设置页面联动方法。
  87261. * @param {function} linkageEvent - 联动方法,实现指定功能。
  87262. */
  87263. setLinkageEvent(linkageEvent) {
  87264. this.linkageEvent = linkageEvent;
  87265. }
  87266. /**
  87267. * @private
  87268. * @override
  87269. */
  87270. _initView(contents, pageCounts) {
  87271. const container = document.createElement("div");
  87272. container.setAttribute("class", "component-pagination");
  87273. //content
  87274. const content = document.createElement("div");
  87275. content.setAttribute("class", "component-pagination__content");
  87276. container.appendChild(content);
  87277. this.content = content;
  87278. //link
  87279. const link = document.createElement("ul");
  87280. link.setAttribute("class", "component-pagination__link");
  87281. link.onclick = this._changePageEvent.bind(this);
  87282. container.appendChild(link);
  87283. this._createLink(link);
  87284. this.link = link;
  87285. //填充内容:
  87286. if (contents) {
  87287. this.setContent(contents);
  87288. }
  87289. if (pageCounts !== 0) {
  87290. this.setPageLink(pageCounts);
  87291. }
  87292. this.rootContainer = container;
  87293. }
  87294. /**---------以下是页面相关操作 **/
  87295. /**
  87296. * @function PaginationContainer.prototype.setContent
  87297. * @description 设置页面内容。
  87298. * @param {HTMLElement} element - 页面内容元素。
  87299. */
  87300. setContent(element) {
  87301. this.clearContent();
  87302. this.appendContent(element);
  87303. }
  87304. /**
  87305. * @function PaginationContainer.prototype.appendContent
  87306. * @description 追加内容。
  87307. * @param {HTMLElement} element - 页面内容元素。
  87308. */
  87309. appendContent(element) {
  87310. this.content.appendChild(element);
  87311. }
  87312. /**
  87313. * @function PaginationContainer.prototype.clearContent
  87314. * @description 清空内容元素。
  87315. */
  87316. clearContent() {
  87317. for (let i = this.content.children.length - 1; i >= 0; i--) {
  87318. this.content.removeChild(this.content.children[i]);
  87319. }
  87320. }
  87321. /** -----以下是页码相关的操作:**/
  87322. /**
  87323. * @function PaginationContainer.prototype.setPageLink
  87324. * @description 设置页码数。
  87325. * @param {number} pageNumber - 页码数。
  87326. */
  87327. setPageLink(pageNumber) {
  87328. //清空当前页码
  87329. this.pageNumberLis = [];
  87330. this.currentPageNumberLis = [];
  87331. this.clearPageLink();
  87332. //创建页码
  87333. this._createPageLi(pageNumber);
  87334. //添加页码到页码列表
  87335. this._appendPageLink();
  87336. }
  87337. /**
  87338. * @description 创建页码。
  87339. * @param pageNumber
  87340. * @private
  87341. */
  87342. _createPageLi(pageNumber) {
  87343. for (let i = 0; i < pageNumber; i++) {
  87344. const pageLi = document.createElement("li");
  87345. pageLi.innerHTML = i + 1;
  87346. /*const liContent = document.createElement("span");
  87347. liContent.innerHTML = i + 1;*/
  87348. // pageLi.appendChild(liContent);
  87349. this.pageNumberLis.push(pageLi);
  87350. }
  87351. this.pageNumberLis[0].setAttribute("class", "active");
  87352. this.currentPage = 1;
  87353. if (pageNumber < 5) {
  87354. this.currentPageNumberLis = this.pageNumberLis;
  87355. } else {
  87356. for (let i = 0; i < 5; i++) {
  87357. this.currentPageNumberLis.push(this.pageNumberLis[i]);
  87358. }
  87359. }
  87360. }
  87361. /**
  87362. * @description 添加页码到页码列表。
  87363. * @private
  87364. */
  87365. _appendPageLink() {
  87366. //todo 如何插入中间
  87367. for (let i = 0; i < this.currentPageNumberLis.length; i++) {
  87368. this.link.insertBefore(this.currentPageNumberLis[i], this.link.childNodes[this.link.children.length - 2]);
  87369. }
  87370. for (let i = 0; i < this.currentPageNumberLis.length; i++) {
  87371. //清空 active 状态
  87372. this.currentPageNumberLis[i].setAttribute("class", "");
  87373. //给当前选中的 li 赋值 active 状态
  87374. if (Number(this.currentPageNumberLis[i].innerHTML) === this.currentPage) {
  87375. this.currentPageNumberLis[i].setAttribute("class", "active");
  87376. }
  87377. }
  87378. //根据 currentPage 改变按钮状态
  87379. this._changeDisableState();
  87380. if (this.linkageEvent) {
  87381. this.linkageEvent(this.currentPage);
  87382. }
  87383. }
  87384. /**
  87385. * @function PaginationContainer.prototype.clearPageLink
  87386. * @description 清除页码列表。
  87387. */
  87388. clearPageLink() {
  87389. for (let i = this.link.children.length - 3; i > 1; i--) {
  87390. this.link.removeChild(this.link.children[i]);
  87391. }
  87392. }
  87393. /**
  87394. * @description 创建页码按钮。
  87395. * @param ul
  87396. * @private
  87397. */
  87398. _createLink(ul) {
  87399. for (let i = 0; i < 4; i++) {
  87400. const li = document.createElement("li");
  87401. li.setAttribute("class", "disable");
  87402. const liContent = document.createElement("span");
  87403. li.appendChild(liContent);
  87404. if (i === 0) {
  87405. liContent.id = "first";
  87406. liContent.setAttribute("class", "supermapol-icons-first");
  87407. } else if (i === 1) {
  87408. liContent.id = "prev";
  87409. liContent.setAttribute("class", "supermapol-icons-prev");
  87410. } else if (i === 2) {
  87411. liContent.id = "next";
  87412. liContent.setAttribute("class", "supermapol-icons-next");
  87413. } else if (i === 3) {
  87414. liContent.id = "last";
  87415. liContent.setAttribute("class", "supermapol-icons-last");
  87416. }
  87417. ul.appendChild(li);
  87418. }
  87419. }
  87420. /**
  87421. * @description 点击页码事件。
  87422. * @param e
  87423. * @private
  87424. */
  87425. _changePageEvent(e) {
  87426. //todo
  87427. const trigger = e.target;
  87428. //若列表禁用,点击无效
  87429. if (trigger.parentElement.classList[0] === "disable") {
  87430. return;
  87431. }
  87432. let targetLi;
  87433. if (trigger.id) {
  87434. targetLi = trigger.id;
  87435. } else if (Number(trigger.innerHTML)) {
  87436. targetLi = Number(trigger.innerHTML);
  87437. } else {
  87438. return;
  87439. }
  87440. //页码预处理:
  87441. this._prePageNum(targetLi);
  87442. //根据 currentPageNumberLis 创建页码列表
  87443. this.clearPageLink();
  87444. this._appendPageLink();
  87445. }
  87446. /**
  87447. * @description 根据 currentPage 改变按钮状态。
  87448. * @private
  87449. */
  87450. _changeDisableState() {
  87451. this.link.children[0].setAttribute("class", "");
  87452. this.link.children[1].setAttribute("class", "");
  87453. this.link.children[this.link.children.length - 1].setAttribute("class", "");
  87454. this.link.children[this.link.children.length - 2].setAttribute("class", "");
  87455. if (this.currentPage === 1) {
  87456. this.link.children[0].setAttribute("class", "disable");
  87457. this.link.children[1].setAttribute("class", "disable");
  87458. }
  87459. if (this.currentPage === this.pageNumberLis.length) {
  87460. this.link.children[this.link.children.length - 1].setAttribute("class", "disable");
  87461. this.link.children[this.link.children.length - 2].setAttribute("class", "disable");
  87462. }
  87463. }
  87464. /**
  87465. * @description 根据点击页码列表事件准备需展现的页码列表。
  87466. * @param {string|number} targetLi - 被点击的列表对象 id 或 被点击的页码值。
  87467. * @private
  87468. */
  87469. _prePageNum(targetLi) {
  87470. const currentPageNumberLis = [];
  87471. if (targetLi === "first") {
  87472. this.currentPage = 1;
  87473. } else if (targetLi === "last") {
  87474. this.currentPage = this.pageNumberLis.length;
  87475. } else if (targetLi === "prev") {
  87476. this.currentPage = this.currentPage - 1;
  87477. } else if (targetLi === "next") {
  87478. this.currentPage = this.currentPage + 1;
  87479. } else {
  87480. this.currentPage = targetLi;
  87481. }
  87482. if (this.pageNumberLis.length <= 5) {
  87483. for (let i = 0; i < this.pageNumberLis.length; i++) {
  87484. currentPageNumberLis.push(this.pageNumberLis[i]);
  87485. }
  87486. } else {
  87487. //当前点击前三,都取前五
  87488. if (this.currentPage <= 3) {
  87489. for (let i = 0; i < 5; i++) {
  87490. currentPageNumberLis.push(this.pageNumberLis[i]);
  87491. }
  87492. } else if (this.currentPage >= this.pageNumberLis.length - 3) {
  87493. //点击后三,都取后5
  87494. for (let i = this.pageNumberLis.length - 5; i < this.pageNumberLis.length; i++) {
  87495. currentPageNumberLis.push(this.pageNumberLis[i]);
  87496. }
  87497. } else {
  87498. //其他,取中间:
  87499. for (let i = this.currentPage - 3; i <= this.currentPage + 1; i++) {
  87500. currentPageNumberLis.push(this.pageNumberLis[i]);
  87501. }
  87502. }
  87503. }
  87504. if (currentPageNumberLis.length > 0) {
  87505. this.currentPageNumberLis = currentPageNumberLis;
  87506. }
  87507. }
  87508. }
  87509. ;// CONCATENATED MODULE: ./src/common/components/util/Util.js
  87510. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  87511. * This program are made available under the terms of the Apache License, Version 2.0
  87512. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87513. /**
  87514. * @name ComponentsUtil
  87515. * @namespace
  87516. * @category BaseTypes Util
  87517. * @description 获取文件类型工具类。
  87518. * @usage
  87519. * ```
  87520. * // 浏览器
  87521. * <script type="text/javascript" src="{cdn}"></script>
  87522. * <script>
  87523. * const result = {namespace}.ComponentsUtil.getFileType(fileName);
  87524. *
  87525. * </script>
  87526. * // ES6 Import
  87527. * import { ComponentsUtil } from '{npm}';
  87528. *
  87529. * const result = ComponentsUtil.getFileType(fileName);
  87530. * ```
  87531. */
  87532. let ComponentsUtil = {
  87533. /**
  87534. * @function ComponentsUtil.getFileType
  87535. * @description 获取上传文件类型。
  87536. * @param {string} fileName - 文件名称。
  87537. */
  87538. getFileType(fileName) {
  87539. let regCSV = /^.*\.(?:csv)$/i;
  87540. let regExcel = /^.*\.(?:xls|xlsx)$/i; //文件名可以带空格
  87541. let regGeojson = /^.*\.(?:geojson|json)$/i;
  87542. if (regExcel.test(fileName)) { //校验不通过
  87543. return CommonTypes_FileTypes.EXCEL;
  87544. } else if (regCSV.test(fileName)) {
  87545. return CommonTypes_FileTypes.CSV;
  87546. } else if (regGeojson.test(fileName)) {
  87547. return CommonTypes_FileTypes.GEOJSON;
  87548. }
  87549. return null;
  87550. }
  87551. };
  87552. ;// CONCATENATED MODULE: ./src/common/components/util/index.js
  87553. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  87554. * This program are made available under the terms of the Apache License, Version 2.0
  87555. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87556. ;// CONCATENATED MODULE: ./src/common/components/index.js
  87557. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  87558. * This program are made available under the terms of the Apache License, Version 2.0
  87559. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87560. //数据
  87561. //组件
  87562. //提示框组件
  87563. //图表组件
  87564. //公用模板:
  87565. //工具类
  87566. ;// CONCATENATED MODULE: ./src/common/lang/index.js
  87567. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  87568. * This program are made available under the terms of the Apache License, Version 2.0
  87569. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87570. ;// CONCATENATED MODULE: ./src/common/index.common.js
  87571. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  87572. * This program are made available under the terms of the Apache License, Version 2.0
  87573. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87574. ;// CONCATENATED MODULE: ./src/common/index.all.js
  87575. ;// CONCATENATED MODULE: ./src/common/namespace.js
  87576. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  87577. * This program are made available under the terms of the Apache License, Version 2.0
  87578. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87579. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  87580. * This program are made available under the terms of the Apache License, Version 2.0
  87581. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87582. // Lang
  87583. SuperMap.Lang = Lang;
  87584. SuperMap.i18n = SuperMap.Lang.i18n;
  87585. // CommonUtil
  87586. SuperMap.Util = { ...SuperMap.Util, ...Util_Util };
  87587. SuperMap.Browser = Browser;
  87588. SuperMap.INCHES_PER_UNIT = INCHES_PER_UNIT;
  87589. SuperMap.METERS_PER_INCH = METERS_PER_INCH;
  87590. SuperMap.DOTS_PER_INCH = DOTS_PER_INCH;
  87591. SuperMap.IS_GECKO = IS_GECKO;
  87592. // FetchRequest
  87593. SuperMap.setCORS = setCORS;
  87594. SuperMap.isCORS = isCORS;
  87595. SuperMap.setRequestTimeout = setRequestTimeout;
  87596. SuperMap.getRequestTimeout = getRequestTimeout;
  87597. SuperMap.FetchRequest = FetchRequest;
  87598. // commontypes
  87599. SuperMap.inherit = inheritExt;
  87600. SuperMap.mixin = mixinExt;
  87601. SuperMap.String = StringExt;
  87602. SuperMap.Number = NumberExt;
  87603. SuperMap.Function = FunctionExt;
  87604. SuperMap.Array = ArrayExt;
  87605. SuperMap.Date = DateExt;
  87606. SuperMap.Event = Event_Event;
  87607. SuperMap.Bounds = Bounds;
  87608. SuperMap.Credential = Credential;
  87609. SuperMap.Events = Events;
  87610. SuperMap.Feature = Feature_Feature;
  87611. SuperMap.Geometry = Geometry_Geometry;
  87612. SuperMap.Pixel = Pixel;
  87613. SuperMap.Size = Size;
  87614. SuperMap.Feature.Vector = Vector;
  87615. SuperMap.Geometry.Collection = Collection;
  87616. SuperMap.Geometry.Curve = Curve;
  87617. SuperMap.Geometry.GeoText = GeoText;
  87618. SuperMap.Geometry.LinearRing = LinearRing_LinearRing;
  87619. SuperMap.Geometry.LineString = LineString;
  87620. SuperMap.Geometry.MultiLineString = MultiLineString;
  87621. SuperMap.Geometry.MultiPoint = MultiPoint;
  87622. SuperMap.Geometry.MultiPolygon = MultiPolygon;
  87623. SuperMap.Geometry.Point = Point;
  87624. SuperMap.Geometry.Polygon = Polygon_Polygon;
  87625. SuperMap.Geometry.Rectangle = Rectangle;
  87626. // Components
  87627. SuperMap.Components.Chart = ChartView;
  87628. SuperMap.Components.ChartViewModel = ChartViewModel;
  87629. SuperMap.Components.MessageBox = MessageBox;
  87630. SuperMap.Components.AttributesPopContainer = AttributesPopContainer;
  87631. SuperMap.Components.CityTabsPage = CityTabsPage;
  87632. SuperMap.Components.CommonContainer = CommonContainer;
  87633. SuperMap.Components.DropDownBox = DropDownBox;
  87634. SuperMap.Components.IndexTabsPageContainer = IndexTabsPageContainer;
  87635. SuperMap.Components.NavTabsPage = NavTabsPage;
  87636. SuperMap.Components.PaginationContainer = PaginationContainer;
  87637. SuperMap.Components.PopContainer = PopContainer;
  87638. SuperMap.Components.Select = Select;
  87639. SuperMap.Components.TemplateBase = TemplateBase;
  87640. SuperMap.Components.FileReaderUtil = FileReaderUtil;
  87641. // control
  87642. SuperMap.TimeControlBase = TimeControlBase;
  87643. SuperMap.TimeFlowControl = TimeFlowControl;
  87644. // Format
  87645. SuperMap.Format = SuperMap.Format || Format;
  87646. SuperMap.Format.GeoJSON = GeoJSON;
  87647. SuperMap.Format.JSON = JSONFormat;
  87648. SuperMap.Format.WKT = WKT;
  87649. // iManager
  87650. SuperMap.iManager = IManager;
  87651. SuperMap.iManagerCreateNodeParam = IManagerCreateNodeParam;
  87652. SuperMap.iManagerServiceBase = IManagerServiceBase;
  87653. // iPortal
  87654. SuperMap.iPortal = IPortal;
  87655. SuperMap.iPortalAddDataParam = IPortalAddDataParam;
  87656. SuperMap.iPortalAddResourceParam = IPortalAddResourceParam;
  87657. SuperMap.iPortalDataConnectionInfoParam = IPortalDataConnectionInfoParam;
  87658. SuperMap.iPortalDataMetaInfoParam = IPortalDataMetaInfoParam;
  87659. SuperMap.iPortalDataStoreInfoParam = IPortalDataStoreInfoParam;
  87660. SuperMap.iPortalQueryParam = IPortalQueryParam;
  87661. SuperMap.iPortalQueryResult = IPortalQueryResult;
  87662. SuperMap.iPortalRegisterServiceParam = IPortalRegisterServiceParam;
  87663. SuperMap.iPortalResource = IPortalResource;
  87664. SuperMap.iPortalServiceBase = IPortalServiceBase;
  87665. SuperMap.iPortalShareEntity = IPortalShareEntity;
  87666. SuperMap.iPortalShareParam = IPortalShareParam;
  87667. SuperMap.iPortalUser = IPortalUser;
  87668. // iServer
  87669. SuperMap.AddressMatchService = AddressMatchService_AddressMatchService;
  87670. SuperMap.AggregationParameter = AggregationParameter;
  87671. SuperMap.AreaSolarRadiationParameters = AreaSolarRadiationParameters;
  87672. SuperMap.AreaSolarRadiationService = AreaSolarRadiationService;
  87673. SuperMap.BucketAggParameter = BucketAggParameter;
  87674. SuperMap.BufferAnalystParameters = BufferAnalystParameters;
  87675. SuperMap.BufferAnalystService = BufferAnalystService;
  87676. SuperMap.BufferDistance = BufferDistance;
  87677. SuperMap.BuffersAnalystJobsParameter = BuffersAnalystJobsParameter;
  87678. SuperMap.BuffersAnalystJobsService = BuffersAnalystJobsService;
  87679. SuperMap.BufferSetting = BufferSetting;
  87680. SuperMap.BurstPipelineAnalystParameters = BurstPipelineAnalystParameters;
  87681. SuperMap.BurstPipelineAnalystService = BurstPipelineAnalystService;
  87682. SuperMap.ChartFeatureInfoSpecsService = ChartFeatureInfoSpecsService;
  87683. SuperMap.ChartQueryFilterParameter = ChartQueryFilterParameter;
  87684. SuperMap.ChartQueryParameters = ChartQueryParameters;
  87685. SuperMap.ChartQueryService = ChartQueryService;
  87686. SuperMap.ClipParameter = ClipParameter;
  87687. SuperMap.ColorDictionary = ColorDictionary;
  87688. SuperMap.CommonServiceBase = CommonServiceBase;
  87689. SuperMap.ComputeWeightMatrixParameters = ComputeWeightMatrixParameters;
  87690. SuperMap.ComputeWeightMatrixService = ComputeWeightMatrixService;
  87691. SuperMap.CreateDatasetParameters = CreateDatasetParameters;
  87692. SuperMap.DataFlowService = DataFlowService_DataFlowService;
  87693. SuperMap.DataReturnOption = DataReturnOption;
  87694. SuperMap.DatasetBufferAnalystParameters = DatasetBufferAnalystParameters;
  87695. SuperMap.DatasetInfo = DatasetInfo;
  87696. SuperMap.DatasetOverlayAnalystParameters = DatasetOverlayAnalystParameters;
  87697. SuperMap.DatasetService = DatasetService_DatasetService;
  87698. SuperMap.DatasetSurfaceAnalystParameters = DatasetSurfaceAnalystParameters;
  87699. SuperMap.DatasetThiessenAnalystParameters = DatasetThiessenAnalystParameters;
  87700. SuperMap.DatasourceConnectionInfo = DatasourceConnectionInfo;
  87701. SuperMap.DatasourceService = DatasourceService_DatasourceService;
  87702. SuperMap.DensityAnalystService = DensityAnalystService;
  87703. SuperMap.DensityKernelAnalystParameters = DensityKernelAnalystParameters;
  87704. SuperMap.EditFeaturesParameters = EditFeaturesParameters;
  87705. SuperMap.EditFeaturesService = EditFeaturesService;
  87706. SuperMap.FacilityAnalyst3DParameters = FacilityAnalyst3DParameters;
  87707. SuperMap.FacilityAnalystSinks3DParameters = FacilityAnalystSinks3DParameters;
  87708. SuperMap.FacilityAnalystSinks3DService = FacilityAnalystSinks3DService;
  87709. SuperMap.FacilityAnalystSources3DParameters = FacilityAnalystSources3DParameters;
  87710. SuperMap.FacilityAnalystSources3DService = FacilityAnalystSources3DService;
  87711. SuperMap.FacilityAnalystStreamParameters = FacilityAnalystStreamParameters;
  87712. SuperMap.FacilityAnalystStreamService = FacilityAnalystStreamService;
  87713. SuperMap.FacilityAnalystTracedown3DParameters = FacilityAnalystTracedown3DParameters;
  87714. SuperMap.FacilityAnalystTracedown3DService = FacilityAnalystTracedown3DService;
  87715. SuperMap.FacilityAnalystTraceup3DParameters = FacilityAnalystTraceup3DParameters;
  87716. SuperMap.FacilityAnalystTraceup3DService = FacilityAnalystTraceup3DService;
  87717. SuperMap.FacilityAnalystUpstream3DParameters = FacilityAnalystUpstream3DParameters;
  87718. SuperMap.FacilityAnalystUpstream3DService = FacilityAnalystUpstream3DService;
  87719. SuperMap.FieldParameters = FieldParameters;
  87720. SuperMap.FieldsFilter = FieldsFilter;
  87721. SuperMap.FieldStatisticService = FieldStatisticService;
  87722. SuperMap.FieldStatisticsParameters = FieldStatisticsParameters;
  87723. SuperMap.FilterParameter = FilterParameter;
  87724. SuperMap.FindClosestFacilitiesParameters = FindClosestFacilitiesParameters;
  87725. SuperMap.FindClosestFacilitiesService = FindClosestFacilitiesService;
  87726. SuperMap.FindLocationParameters = FindLocationParameters;
  87727. SuperMap.FindLocationService = FindLocationService;
  87728. SuperMap.FindMTSPPathsParameters = FindMTSPPathsParameters;
  87729. SuperMap.FindMTSPPathsService = FindMTSPPathsService;
  87730. SuperMap.FindPathParameters = FindPathParameters;
  87731. SuperMap.FindPathService = FindPathService;
  87732. SuperMap.FindServiceAreasParameters = FindServiceAreasParameters;
  87733. SuperMap.FindServiceAreasService = FindServiceAreasService;
  87734. SuperMap.FindTSPPathsParameters = FindTSPPathsParameters;
  87735. SuperMap.FindTSPPathsService = FindTSPPathsService;
  87736. SuperMap.GenerateSpatialDataParameters = GenerateSpatialDataParameters;
  87737. SuperMap.GenerateSpatialDataService = GenerateSpatialDataService;
  87738. SuperMap.GeoCodingParameter = GeoCodingParameter;
  87739. SuperMap.GeoDecodingParameter = GeoDecodingParameter;
  87740. SuperMap.GeoHashGridAggParameter = GeoHashGridAggParameter;
  87741. SuperMap.GeometryBatchAnalystService = GeometryBatchAnalystService;
  87742. SuperMap.GeometryBufferAnalystParameters = GeometryBufferAnalystParameters;
  87743. SuperMap.GeometryOverlayAnalystParameters = GeometryOverlayAnalystParameters;
  87744. SuperMap.GeometrySurfaceAnalystParameters = GeometrySurfaceAnalystParameters;
  87745. SuperMap.GeometryThiessenAnalystParameters = GeometryThiessenAnalystParameters;
  87746. SuperMap.GeoprocessingService = GeoprocessingService_GeoprocessingService;
  87747. SuperMap.GeoRelationAnalystParameters = GeoRelationAnalystParameters;
  87748. SuperMap.GeoRelationAnalystService = GeoRelationAnalystService;
  87749. SuperMap.GetFeaturesByBoundsParameters = GetFeaturesByBoundsParameters;
  87750. SuperMap.GetFeaturesByBoundsService = GetFeaturesByBoundsService;
  87751. SuperMap.GetFeaturesByBufferParameters = GetFeaturesByBufferParameters;
  87752. SuperMap.GetFeaturesByBufferService = GetFeaturesByBufferService;
  87753. SuperMap.GetFeaturesByGeometryParameters = GetFeaturesByGeometryParameters;
  87754. SuperMap.GetFeaturesByGeometryService = GetFeaturesByGeometryService;
  87755. SuperMap.GetFeaturesByIDsParameters = GetFeaturesByIDsParameters;
  87756. SuperMap.GetFeaturesByIDsService = GetFeaturesByIDsService;
  87757. SuperMap.GetFeaturesBySQLParameters = GetFeaturesBySQLParameters;
  87758. SuperMap.GetFeaturesBySQLService = GetFeaturesBySQLService;
  87759. SuperMap.GetFeaturesParametersBase = GetFeaturesParametersBase;
  87760. SuperMap.GetFeaturesServiceBase = GetFeaturesServiceBase;
  87761. SuperMap.GetFieldsService = GetFieldsService;
  87762. SuperMap.GetGridCellInfosParameters = GetGridCellInfosParameters;
  87763. SuperMap.GetGridCellInfosService = GetGridCellInfosService;
  87764. SuperMap.GetLayersInfoService = GetLayersInfoService;
  87765. SuperMap.Grid = Grid;
  87766. SuperMap.HillshadeParameter = HillshadeParameter;
  87767. SuperMap.Image = UGCImage;
  87768. SuperMap.ImageCollectionService = ImageCollectionService_ImageCollectionService;
  87769. SuperMap.ImageGFAspect = ImageGFAspect;
  87770. SuperMap.ImageGFHillShade = ImageGFHillShade;
  87771. SuperMap.ImageGFOrtho = ImageGFOrtho;
  87772. SuperMap.ImageGFSlope = ImageGFSlope;
  87773. SuperMap.ImageRenderingRule = ImageRenderingRule;
  87774. SuperMap.ImageSearchParameter = ImageSearchParameter;
  87775. SuperMap.ImageService = ImageService_ImageService;
  87776. SuperMap.ImageStretchOption = ImageStretchOption;
  87777. SuperMap.InterpolationAnalystParameters = InterpolationAnalystParameters;
  87778. SuperMap.InterpolationAnalystService = InterpolationAnalystService;
  87779. SuperMap.InterpolationDensityAnalystParameters = InterpolationDensityAnalystParameters;
  87780. SuperMap.InterpolationIDWAnalystParameters = InterpolationIDWAnalystParameters;
  87781. SuperMap.InterpolationKrigingAnalystParameters = InterpolationKrigingAnalystParameters;
  87782. SuperMap.InterpolationRBFAnalystParameters = InterpolationRBFAnalystParameters;
  87783. SuperMap.JoinItem = JoinItem;
  87784. SuperMap.KernelDensityJobParameter = KernelDensityJobParameter;
  87785. SuperMap.KernelDensityJobsService = KernelDensityJobsService;
  87786. SuperMap.LabelImageCell = LabelImageCell;
  87787. SuperMap.LabelMatrixCell = LabelMatrixCell;
  87788. SuperMap.LabelMixedTextStyle = LabelMixedTextStyle;
  87789. SuperMap.LabelSymbolCell = LabelSymbolCell;
  87790. SuperMap.LabelThemeCell = LabelThemeCell;
  87791. SuperMap.LayerStatus = LayerStatus;
  87792. SuperMap.LinkItem = LinkItem;
  87793. SuperMap.MappingParameters = MappingParameters;
  87794. SuperMap.MapService = MapService_MapService;
  87795. SuperMap.MathExpressionAnalysisParameters = MathExpressionAnalysisParameters;
  87796. SuperMap.MathExpressionAnalysisService = MathExpressionAnalysisService;
  87797. SuperMap.MeasureParameters = MeasureParameters;
  87798. SuperMap.MeasureService = MeasureService_MeasureService;
  87799. SuperMap.MetricsAggParameter = MetricsAggParameter;
  87800. SuperMap.NDVIParameter = NDVIParameter;
  87801. SuperMap.NetworkAnalystServiceBase = NetworkAnalystServiceBase;
  87802. SuperMap.OutputSetting = OutputSetting;
  87803. SuperMap.OverlapDisplayedOptions = OverlapDisplayedOptions;
  87804. SuperMap.OverlayAnalystParameters = OverlayAnalystParameters;
  87805. SuperMap.OverlayAnalystService = OverlayAnalystService;
  87806. SuperMap.OverlayGeoJobParameter = OverlayGeoJobParameter;
  87807. SuperMap.OverlayGeoJobsService = OverlayGeoJobsService;
  87808. SuperMap.PointWithMeasure = PointWithMeasure;
  87809. SuperMap.ProcessingServiceBase = ProcessingServiceBase;
  87810. SuperMap.QueryByBoundsParameters = QueryByBoundsParameters;
  87811. SuperMap.QueryByBoundsService = QueryByBoundsService;
  87812. SuperMap.QueryByDistanceParameters = QueryByDistanceParameters;
  87813. SuperMap.QueryByDistanceService = QueryByDistanceService;
  87814. SuperMap.QueryByGeometryParameters = QueryByGeometryParameters;
  87815. SuperMap.QueryByGeometryService = QueryByGeometryService;
  87816. SuperMap.QueryBySQLParameters = QueryBySQLParameters;
  87817. SuperMap.QueryBySQLService = QueryBySQLService;
  87818. SuperMap.QueryParameters = QueryParameters;
  87819. SuperMap.QueryService = QueryService_QueryService;
  87820. SuperMap.RasterFunctionParameter = RasterFunctionParameter;
  87821. SuperMap.Route = Route;
  87822. SuperMap.RouteCalculateMeasureParameters = RouteCalculateMeasureParameters;
  87823. SuperMap.RouteCalculateMeasureService = RouteCalculateMeasureService;
  87824. SuperMap.RouteLocatorParameters = RouteLocatorParameters;
  87825. SuperMap.RouteLocatorService = RouteLocatorService;
  87826. SuperMap.ServerColor = ServerColor;
  87827. SuperMap.ServerFeature = ServerFeature;
  87828. SuperMap.ServerGeometry = ServerGeometry;
  87829. SuperMap.ServerStyle = ServerStyle;
  87830. SuperMap.ServerTextStyle = ServerTextStyle;
  87831. SuperMap.ServerTheme = ServerTheme;
  87832. SuperMap.SetDatasourceParameters = SetDatasourceParameters;
  87833. SuperMap.SetLayerInfoParameters = SetLayerInfoParameters;
  87834. SuperMap.SetLayerInfoService = SetLayerInfoService;
  87835. SuperMap.SetLayersInfoParameters = SetLayersInfoParameters;
  87836. SuperMap.SetLayersInfoService = SetLayersInfoService;
  87837. SuperMap.SetLayerStatusParameters = SetLayerStatusParameters;
  87838. SuperMap.SetLayerStatusService = SetLayerStatusService;
  87839. SuperMap.SingleObjectQueryJobsParameter = SingleObjectQueryJobsParameter;
  87840. SuperMap.SingleObjectQueryJobsService = SingleObjectQueryJobsService;
  87841. SuperMap.Sortby = Sortby;
  87842. SuperMap.SpatialAnalystBase = SpatialAnalystBase;
  87843. SuperMap.StopQueryParameters = StopQueryParameters;
  87844. SuperMap.StopQueryService = StopQueryService;
  87845. SuperMap.SummaryAttributesJobsParameter = SummaryAttributesJobsParameter;
  87846. SuperMap.SummaryAttributesJobsService = SummaryAttributesJobsService;
  87847. SuperMap.SummaryMeshJobParameter = SummaryMeshJobParameter;
  87848. SuperMap.SummaryMeshJobsService = SummaryMeshJobsService;
  87849. SuperMap.SummaryRegionJobParameter = SummaryRegionJobParameter;
  87850. SuperMap.SummaryRegionJobsService = SummaryRegionJobsService;
  87851. SuperMap.SupplyCenter = SupplyCenter;
  87852. SuperMap.SurfaceAnalystParameters = SurfaceAnalystParameters;
  87853. SuperMap.SurfaceAnalystParametersSetting = SurfaceAnalystParametersSetting;
  87854. SuperMap.SurfaceAnalystService = SurfaceAnalystService;
  87855. SuperMap.TerrainCurvatureCalculationParameters = TerrainCurvatureCalculationParameters;
  87856. SuperMap.TerrainCurvatureCalculationService = TerrainCurvatureCalculationService;
  87857. SuperMap.Theme = Theme_Theme;
  87858. SuperMap.ThemeDotDensity = ThemeDotDensity;
  87859. SuperMap.ThemeFlow = ThemeFlow;
  87860. SuperMap.ThemeGraduatedSymbol = ThemeGraduatedSymbol;
  87861. SuperMap.ThemeGraduatedSymbolStyle = ThemeGraduatedSymbolStyle;
  87862. SuperMap.ThemeGraph = ThemeGraph;
  87863. SuperMap.ThemeGraphAxes = ThemeGraphAxes;
  87864. SuperMap.ThemeGraphItem = ThemeGraphItem;
  87865. SuperMap.ThemeGraphSize = ThemeGraphSize;
  87866. SuperMap.ThemeGraphText = ThemeGraphText;
  87867. SuperMap.ThemeGridRange = ThemeGridRange;
  87868. SuperMap.ThemeGridRangeItem = ThemeGridRangeItem;
  87869. SuperMap.ThemeGridUnique = ThemeGridUnique;
  87870. SuperMap.ThemeGridUniqueItem = ThemeGridUniqueItem;
  87871. SuperMap.ThemeLabel = ThemeLabel;
  87872. SuperMap.ThemeLabelAlongLine = ThemeLabelAlongLine;
  87873. SuperMap.ThemeLabelBackground = ThemeLabelBackground;
  87874. SuperMap.ThemeLabelItem = ThemeLabelItem;
  87875. SuperMap.ThemeLabelText = ThemeLabelText;
  87876. SuperMap.ThemeLabelUniqueItem = ThemeLabelUniqueItem;
  87877. SuperMap.ThemeMemoryData = ThemeMemoryData;
  87878. SuperMap.ThemeOffset = ThemeOffset;
  87879. SuperMap.ThemeParameters = ThemeParameters;
  87880. SuperMap.ThemeRange = ThemeRange;
  87881. SuperMap.ThemeRangeItem = ThemeRangeItem;
  87882. SuperMap.ThemeService = ThemeService_ThemeService;
  87883. SuperMap.ThemeUnique = ThemeUnique;
  87884. SuperMap.ThemeUniqueItem = ThemeUniqueItem;
  87885. SuperMap.ThiessenAnalystParameters = ThiessenAnalystParameters;
  87886. SuperMap.ThiessenAnalystService = ThiessenAnalystService;
  87887. SuperMap.TilesetsService = TilesetsService;
  87888. SuperMap.TopologyValidatorJobsParameter = TopologyValidatorJobsParameter;
  87889. SuperMap.TopologyValidatorJobsService = TopologyValidatorJobsService;
  87890. SuperMap.TransferLine = TransferLine;
  87891. SuperMap.TransferPathParameters = TransferPathParameters;
  87892. SuperMap.TransferPathService = TransferPathService;
  87893. SuperMap.TransferSolutionParameters = TransferSolutionParameters;
  87894. SuperMap.TransferSolutionService = TransferSolutionService;
  87895. SuperMap.TransportationAnalystParameter = TransportationAnalystParameter;
  87896. SuperMap.TransportationAnalystResultSetting = TransportationAnalystResultSetting;
  87897. SuperMap.UGCLayer = UGCLayer;
  87898. SuperMap.UGCMapLayer = UGCMapLayer;
  87899. SuperMap.UGCSubLayer = UGCSubLayer;
  87900. SuperMap.UpdateDatasetParameters = UpdateDatasetParameters;
  87901. SuperMap.UpdateEdgeWeightParameters = UpdateEdgeWeightParameters;
  87902. SuperMap.UpdateEdgeWeightService = UpdateEdgeWeightService;
  87903. SuperMap.UpdateTurnNodeWeightParameters = UpdateTurnNodeWeightParameters;
  87904. SuperMap.UpdateTurnNodeWeightService = UpdateTurnNodeWeightService;
  87905. SuperMap.Vector = iServer_Vector_Vector;
  87906. SuperMap.VectorClipJobsParameter = VectorClipJobsParameter;
  87907. SuperMap.VectorClipJobsService = VectorClipJobsService;
  87908. SuperMap.WebPrintingJobContent = WebPrintingJobContent;
  87909. SuperMap.WebPrintingJobCustomItems = WebPrintingJobCustomItems;
  87910. SuperMap.WebPrintingJobExportOptions = WebPrintingJobExportOptions;
  87911. SuperMap.WebPrintingJobImage = WebPrintingJobImage;
  87912. SuperMap.WebPrintingJobLayers = WebPrintingJobLayers;
  87913. SuperMap.WebPrintingJobLayoutOptions = WebPrintingJobLayoutOptions;
  87914. SuperMap.WebPrintingJobLegendOptions = WebPrintingJobLegendOptions;
  87915. SuperMap.WebPrintingJobLittleMapOptions = WebPrintingJobLittleMapOptions;
  87916. SuperMap.WebPrintingJobNorthArrowOptions = WebPrintingJobNorthArrowOptions;
  87917. SuperMap.WebPrintingJobParameters = WebPrintingJobParameters;
  87918. SuperMap.WebPrintingJobScaleBarOptions = WebPrintingJobScaleBarOptions;
  87919. SuperMap.WebPrintingService = WebPrintingService;
  87920. //Online
  87921. SuperMap.Online = Online;
  87922. SuperMap.OnlineData = OnlineData;
  87923. SuperMap.OnlineQueryDatasParameter = OnlineQueryDatasParameter;
  87924. SuperMap.ServiceStatus = ServiceStatus;
  87925. // 包含online中的DataItemType数据类型
  87926. SuperMap.DataItemType = DataItemType;
  87927. SuperMap.DataItemOrderBy = DataItemOrderBy;
  87928. SuperMap.FilterField = FilterField;
  87929. SuperMap.OnlineServiceBase = OnlineServiceBase;
  87930. // overlay
  87931. SuperMap.Feature = SuperMap.Feature || {};
  87932. SuperMap.Feature.Theme = Theme;
  87933. SuperMap.Feature.Theme.Bar = Bar;
  87934. SuperMap.Feature.Theme.Bar3D = Bar3D;
  87935. SuperMap.Feature.Theme.Circle = Circle;
  87936. SuperMap.Feature.Theme.Graph = Graph_Graph;
  87937. SuperMap.Feature.Theme.Line = Line;
  87938. SuperMap.Feature.Theme.Pie = Pie;
  87939. SuperMap.Feature.Theme.Point = overlay_Point_Point;
  87940. SuperMap.Feature.Theme.RankSymbol = RankSymbol_RankSymbol;
  87941. SuperMap.Feature.Theme.Ring = Ring;
  87942. SuperMap.Feature.Theme.ThemeVector = ThemeVector;
  87943. SuperMap.Feature.ShapeParameters = ShapeParameters;
  87944. SuperMap.Feature.ShapeParameters.Circle = Circle_Circle;
  87945. SuperMap.Feature.ShapeParameters.Image = Image_Image;
  87946. SuperMap.Feature.ShapeParameters.Label = Label;
  87947. SuperMap.Feature.ShapeParameters.Line = Line_Line;
  87948. SuperMap.Feature.ShapeParameters.Point = Point_Point;
  87949. SuperMap.Feature.ShapeParameters.Polygon = feature_Polygon_Polygon;
  87950. SuperMap.Feature.ShapeParameters.Rectangle = Rectangle_Rectangle;
  87951. SuperMap.Feature.ShapeParameters.Sector = Sector;
  87952. SuperMap.Feature.ShapeFactory = ShapeFactory;
  87953. // LevelRenderer
  87954. SuperMap.LevelRenderer = LevelRenderer;
  87955. // security
  87956. SuperMap.KeyServiceParameter = KeyServiceParameter;
  87957. SuperMap.SecurityManager = SecurityManager;
  87958. SuperMap.ServerInfo = ServerInfo;
  87959. SuperMap.TokenServiceParameter = TokenServiceParameter;
  87960. // style
  87961. SuperMap.ThemeStyle = ThemeStyle;
  87962. SuperMap.CartoCSS = CartoCSS;
  87963. // thirdparty
  87964. // SuperMap.BinaryClassification = BinaryClassification;
  87965. // SuperMap.LandcoverClassification = LandcoverClassification;
  87966. // SuperMap.ObjectDetection = ObjectDetection;
  87967. // SuperMap.WebMachineLearning = WebMachineLearning;
  87968. SuperMap.ElasticSearch = ElasticSearch;
  87969. // util
  87970. SuperMap.ArrayStatistic = ArrayStatistic;
  87971. SuperMap.ColorsPickerUtil = ColorsPickerUtil;
  87972. // REST
  87973. SuperMap.DataFormat = DataFormat;
  87974. SuperMap.ServerType = ServerType;
  87975. SuperMap.GeometryType = REST_GeometryType;
  87976. SuperMap.QueryOption = QueryOption;
  87977. SuperMap.JoinType = JoinType;
  87978. SuperMap.SpatialQueryMode = SpatialQueryMode;
  87979. SuperMap.SpatialRelationType = SpatialRelationType;
  87980. SuperMap.MeasureMode = MeasureMode;
  87981. SuperMap.Unit = Unit;
  87982. SuperMap.BufferRadiusUnit = BufferRadiusUnit;
  87983. SuperMap.EngineType = EngineType;
  87984. SuperMap.ThemeGraphTextFormat = ThemeGraphTextFormat;
  87985. SuperMap.ThemeGraphType = ThemeGraphType;
  87986. SuperMap.GraphAxesTextDisplayMode = GraphAxesTextDisplayMode;
  87987. SuperMap.GraduatedMode = GraduatedMode;
  87988. SuperMap.RangeMode = RangeMode;
  87989. SuperMap.ThemeType = ThemeType;
  87990. SuperMap.ColorGradientType = ColorGradientType;
  87991. SuperMap.TextAlignment = TextAlignment;
  87992. SuperMap.FillGradientMode = FillGradientMode;
  87993. SuperMap.AlongLineDirection = AlongLineDirection;
  87994. SuperMap.LabelBackShape = LabelBackShape;
  87995. SuperMap.LabelOverLengthMode = LabelOverLengthMode;
  87996. SuperMap.DirectionType = DirectionType;
  87997. SuperMap.OverlayOperationType = OverlayOperationType;
  87998. SuperMap.OutputType = OutputType;
  87999. SuperMap.SideType = SideType;
  88000. SuperMap.SupplyCenterType = SupplyCenterType;
  88001. SuperMap.TurnType = TurnType;
  88002. SuperMap.BufferEndType = BufferEndType;
  88003. SuperMap.SmoothMethod = SmoothMethod;
  88004. SuperMap.SurfaceAnalystMethod = SurfaceAnalystMethod;
  88005. SuperMap.DataReturnMode = DataReturnMode;
  88006. SuperMap.EditType = EditType;
  88007. SuperMap.TransferTactic = TransferTactic;
  88008. SuperMap.TransferPreference = TransferPreference;
  88009. SuperMap.GridType = GridType;
  88010. SuperMap.ColorSpaceType = ColorSpaceType;
  88011. SuperMap.LayerType = LayerType;
  88012. SuperMap.UGCLayerType = UGCLayerType;
  88013. SuperMap.StatisticMode = StatisticMode;
  88014. SuperMap.PixelFormat = PixelFormat;
  88015. SuperMap.SearchMode = SearchMode;
  88016. SuperMap.InterpolationAlgorithmType = InterpolationAlgorithmType;
  88017. SuperMap.VariogramMode = VariogramMode;
  88018. SuperMap.Exponent = Exponent;
  88019. SuperMap.ClientType = ClientType;
  88020. SuperMap.ChartType = ChartType;
  88021. SuperMap.ClipAnalystMode = ClipAnalystMode;
  88022. SuperMap.AnalystAreaUnit = AnalystAreaUnit;
  88023. SuperMap.AnalystSizeUnit = AnalystSizeUnit;
  88024. SuperMap.StatisticAnalystMode = StatisticAnalystMode;
  88025. SuperMap.SummaryType = SummaryType;
  88026. SuperMap.TopologyValidatorRule = TopologyValidatorRule;
  88027. SuperMap.BucketAggType = BucketAggType;
  88028. SuperMap.MetricsAggType = MetricsAggType;
  88029. SuperMap.GetFeatureMode = GetFeatureMode;
  88030. SuperMap.RasterFunctionType = RasterFunctionType;
  88031. SuperMap.ResourceType = ResourceType;
  88032. SuperMap.OrderBy = OrderBy;
  88033. SuperMap.OrderType = OrderType;
  88034. SuperMap.SearchType = SearchType;
  88035. SuperMap.AggregationTypes = AggregationTypes;
  88036. SuperMap.PermissionType = PermissionType;
  88037. SuperMap.EntityType = EntityType;
  88038. SuperMap.WebExportFormatType = WebExportFormatType;
  88039. SuperMap.WebScaleOrientationType = WebScaleOrientationType;
  88040. SuperMap.WebScaleType = WebScaleType;
  88041. SuperMap.WebScaleUnit = WebScaleUnit;
  88042. SuperMap.KnowledgeGraph = KnowledgeGraph
  88043. ;// CONCATENATED MODULE: ./src/common/util/FilterCondition.js
  88044. function getParseSpecialCharacter() {
  88045. // 特殊字符字典
  88046. const directory = ['(', ')', '(', ')', ',', ','];
  88047. const res = {};
  88048. directory.forEach((item, index) => {
  88049. res[item] = `$${index}`
  88050. });
  88051. return res;
  88052. }
  88053. function parseSpecialCharacter(str) {
  88054. const directory = getParseSpecialCharacter();
  88055. for (let key in directory) {
  88056. const replaceValue = directory[key];
  88057. const pattern = new RegExp(`\\${key}`, 'g');
  88058. // eslint-disable-next-line
  88059. while (pattern.test(str)) {
  88060. str = str.replace(pattern, replaceValue);
  88061. }
  88062. }
  88063. return str;
  88064. }
  88065. function parseCondition(filterCondition, keys) {
  88066. const str = filterCondition.replace(/&|\||>|<|=|!/g, ' ');
  88067. const arr = str.split(' ').filter((item) => item);
  88068. let result = filterCondition;
  88069. arr.forEach((item) => {
  88070. const key = keys.find((val) => val === item);
  88071. if (startsWithNumber(item) && key) {
  88072. result = result.replace(key, '$' + key);
  88073. }
  88074. if (key) {
  88075. const res = parseSpecialCharacter(key);
  88076. result = result.replace(key, res);
  88077. }
  88078. });
  88079. return result;
  88080. }
  88081. // 处理jsonsqlfeature, 加前缀
  88082. function parseConditionFeature(feature) {
  88083. let copyValue = {};
  88084. for (let key in feature) {
  88085. let copyKey = key;
  88086. if (startsWithNumber(key)) {
  88087. copyKey = '$' + key;
  88088. }
  88089. copyKey = parseSpecialCharacter(copyKey);
  88090. copyValue[copyKey] = feature[key];
  88091. }
  88092. return copyValue;
  88093. }
  88094. function startsWithNumber(str) {
  88095. return /^\d/.test(str);
  88096. }
  88097. ;// CONCATENATED MODULE: external "function(){try{return convert}catch(e){return {}}}()"
  88098. const external_function_try_return_convert_catch_e_return_namespaceObject = function(){try{return convert}catch(e){return {}}}();
  88099. var external_function_try_return_convert_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_convert_catch_e_return_namespaceObject);
  88100. ;// CONCATENATED MODULE: external "function(){try{return canvg}catch(e){return {}}}()"
  88101. const external_function_try_return_canvg_catch_e_return_namespaceObject = function(){try{return canvg}catch(e){return {}}}();
  88102. var external_function_try_return_canvg_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_canvg_catch_e_return_namespaceObject);
  88103. ;// CONCATENATED MODULE: ./src/mapboxgl/mapping/WebMap.js
  88104. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  88105. * This program are made available under the terms of the Apache License, Version 2.0
  88106. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  88107. const MB_SCALEDENOMINATOR_3857 = [
  88108. '559082264.0287178',
  88109. '279541132.0143589',
  88110. '139770566.0071794',
  88111. '69885283.00358972',
  88112. '34942641.50179486',
  88113. '17471320.75089743',
  88114. '8735660.375448715',
  88115. '4367830.1877224357',
  88116. '2183915.093862179',
  88117. '1091957.546931089',
  88118. '545978.7734655447',
  88119. '272989.7734655447',
  88120. '272989.3867327723',
  88121. '136494.6933663862',
  88122. '68247.34668319309',
  88123. '34123.67334159654',
  88124. '17061.83667079827',
  88125. '8530.918335399136',
  88126. '4265.459167699568',
  88127. '2132.729583849784'
  88128. ];
  88129. const MB_SCALEDENOMINATOR_4326 = [
  88130. '5.590822640287176E8',
  88131. '2.795411320143588E8',
  88132. '1.397705660071794E8',
  88133. '6.98852830035897E7',
  88134. '3.494264150179485E7',
  88135. '1.7471320750897426E7',
  88136. '8735660.375448713',
  88137. '4367830.187724357',
  88138. '2183915.0938621783',
  88139. '1091957.5469310891',
  88140. '545978.7734655446',
  88141. '272989.3867327723',
  88142. '136494.69336638614',
  88143. '68247.34668319307',
  88144. '34123.673341596535',
  88145. '17061.836670798268',
  88146. '8530.918335399134'
  88147. ];
  88148. const DEFAULT_WELLKNOWNSCALESET = ['GoogleCRS84Quad', 'GoogleMapsCompatible'];
  88149. /**
  88150. * @class WebMap
  88151. * @version 9.1.2
  88152. * @category iPortal/Online Resources Map
  88153. * @classdesc 对接 iPortal/Online 地图类。目前支持地图坐标系包括:'EPSG:3857','EPSG:4326','EPSG:4490','EPSG:4214','EPSG:4610'。
  88154. * <div style="padding: 20px;border: 1px solid #eee;border-left-width: 5px;border-radius: 3px;border-left-color: #ce4844;">
  88155. * <p style="color: #ce4844">Notice</p>
  88156. * <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>
  88157. * <p style="font-size: 13px">&lt;script type="text/javascript" src="https://iclient.supermap.io/web/libs/geostats/geostats.js"&gt;&lt;/script&gt;</p>
  88158. * <p style="font-size: 13px">&lt;script type="text/javascript" src="https://iclient.supermap.io/web/libs/jsonsql/jsonsql.js"&gt;&lt;/script&gt;</p>
  88159. * </div>
  88160. * @modulecategory Mapping
  88161. * @param {number} id - iPortal|Online 地图 ID。
  88162. * @param {Object} options - 参数。
  88163. * @param {string} [options.target='map'] - 地图容器 ID。
  88164. * @param {string} [options.server="https://www.supermapol.com"] - 地图的地址。
  88165. * @param {string} [options.credentialKey] - 凭证密钥。
  88166. * @param {string} [options.credentialValue] - 凭证值。
  88167. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  88168. * @param {boolean} [options.excludePortalProxyUrl] - 服务端传递过来的 URL 是否带有代理。
  88169. * @fires WebMap#getmapfailed
  88170. * @fires WebMap#getwmtsfailed
  88171. * @fires WebMap#getlayersfailed
  88172. * @fires WebMap#getfeaturesfailed
  88173. * @fires WebMap#addlayerssucceeded
  88174. * @extends {mapboxgl.Evented}
  88175. * @usage
  88176. */
  88177. class WebMap extends (external_mapboxgl_default()).Evented {
  88178. constructor(id, options) {
  88179. super();
  88180. this.mapId = id;
  88181. options = options || {};
  88182. this.server = options.server;
  88183. this.credentialKey = options.credentialKey;
  88184. this.credentialValue = options.credentialValue;
  88185. this.withCredentials = options.withCredentials || false;
  88186. this.target = options.target || 'map';
  88187. this._canvgsV = [];
  88188. this._createWebMap();
  88189. this.on('mapinitialized', () => {
  88190. this.map.on('remove', () => {
  88191. this._stopCanvg();
  88192. });
  88193. });
  88194. }
  88195. /**
  88196. * @function WebMap.prototype.resize
  88197. * @description 地图 resize。
  88198. */
  88199. resize() {
  88200. this.map.resize();
  88201. }
  88202. /**
  88203. * @function WebMap.prototype.setMapId
  88204. * @param {string} mapId - webMap 地图 ID。
  88205. * @description 设置 WebMap ID。
  88206. */
  88207. setMapId(mapId) {
  88208. this.mapId = mapId;
  88209. this._createWebMap();
  88210. }
  88211. /**
  88212. * @function WebMap.prototype.setWebMapOptions
  88213. * @param {Object} webMapOptions - webMap 参数。
  88214. * @description 设置 webMap 参数。
  88215. */
  88216. setWebMapOptions(webMapOptions) {
  88217. this.server = webMapOptions.server;
  88218. this._createWebMap();
  88219. }
  88220. /**
  88221. * @function WebMap.prototype.setMapOptions
  88222. * @param {Object} mapOptions - map 参数。
  88223. * @description 设置 map 参数。
  88224. */
  88225. setMapOptions(mapOptions) {
  88226. let { center, zoom, maxBounds, minZoom, maxZoom, isWorldCopy, bearing, pitch } = mapOptions;
  88227. center && center.length && this.map.setCenter(center);
  88228. zoom && this.map.setZoom(zoom);
  88229. maxBounds && this.map.setMaxBounds(maxBounds);
  88230. minZoom && this.map.setMinZoom(minZoom);
  88231. maxZoom && this.map.setMaxZoom(maxZoom);
  88232. isWorldCopy && this.map.setRenderWorldCopies(isWorldCopy);
  88233. bearing && this.map.setBearing(bearing);
  88234. pitch && this.map.setPitch(pitch);
  88235. }
  88236. /**
  88237. * @private
  88238. * @function WebMap.prototype._createWebMap
  88239. * @description 登陆窗口后添加地图图层。
  88240. */
  88241. _createWebMap() {
  88242. let urlArr = this.server.split('');
  88243. if (urlArr[urlArr.length - 1] !== '/') {
  88244. this.server += '/';
  88245. }
  88246. let mapUrl = this.server + 'web/maps/' + this.mapId + '/map';
  88247. if (this.credentialValue && this.credentialKey) {
  88248. mapUrl += '?' + this.credentialKey + '=' + this.credentialValue;
  88249. }
  88250. let filter = 'getUrlResource.json?url=';
  88251. if (this.excludePortalProxyUrl && this.server.indexOf(filter) > -1) {
  88252. //大屏需求,或者有加上代理的
  88253. let urlArray = this.server.split(filter);
  88254. if (urlArray.length > 1) {
  88255. mapUrl = urlArray[0] + filter + this.server + 'web/maps/' + this.mapId + '/map.json';
  88256. }
  88257. }
  88258. this._getMapInfo(mapUrl);
  88259. }
  88260. /**
  88261. * @private
  88262. * @function WebMap.prototype._createMap
  88263. * @description 创建地图。
  88264. */
  88265. _createMap(mapInfo) {
  88266. // 获取字体样式
  88267. let fonts = [];
  88268. let layers = mapInfo.layers;
  88269. // 获取 label 图层字体类型
  88270. if (layers && layers.length > 0) {
  88271. layers.forEach(layer => {
  88272. layer.labelStyle && fonts.push(layer.labelStyle.fontFamily);
  88273. }, this);
  88274. }
  88275. fonts.push("'supermapol-icons'");
  88276. let fontFamilys = fonts.join(',');
  88277. // zoom center
  88278. let oldcenter = mapInfo.center,
  88279. zoom = mapInfo.level || 0,
  88280. center,
  88281. zoomBase = 0;
  88282. // zoom = zoom === 0 ? 0 : zoom - 1;
  88283. if (mapInfo.minScale && mapInfo.maxScale) {
  88284. zoomBase = this._transformScaleToZoom(mapInfo.minScale, (external_mapboxgl_default()).CRS ? external_mapboxgl_default().CRS.get(this.baseProjection):'EPSG:3857');
  88285. } else {
  88286. const e =
  88287. this._getResolution(
  88288. (external_mapboxgl_default()).CRS
  88289. ? external_mapboxgl_default().CRS.get(this.baseProjection).getExtent()
  88290. : [-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892]
  88291. ) / this._getResolution(mapInfo.extent);
  88292. zoomBase = +Math.log(e) / Math.LN2.toFixed(2);
  88293. }
  88294. zoom += zoomBase;
  88295. center = oldcenter ? this._unproject([oldcenter.x, oldcenter.y]) : new (external_mapboxgl_default()).LngLat(0, 0);
  88296. // 初始化 map
  88297. this.map = new (external_mapboxgl_default()).Map({
  88298. container: this.target,
  88299. center: center,
  88300. zoom: zoom,
  88301. style: {
  88302. version: 8,
  88303. sources: {},
  88304. // "glyphs": 'https://iclient.supermap.io/iserver/services/map-beijing/rest/maps/beijingMap/tileFeature/sdffonts/{fontstack}/{range}.pbf',
  88305. layers: []
  88306. },
  88307. crs: this.baseProjection,
  88308. localIdeographFontFamily: fontFamilys || ''
  88309. });
  88310. this.fire('mapinitialized');
  88311. }
  88312. /**
  88313. * @private
  88314. * @function WebMap.prototype._getMapInfo
  88315. * @description 获取地图的 JSON 信息。
  88316. * @param {string} url - 请求地图的 url。
  88317. */
  88318. _getMapInfo(url) {
  88319. let mapUrl = url.indexOf('.json') === -1 ? `${url}.json` : url;
  88320. FetchRequest.get(mapUrl, null, { withCredentials: this.withCredentials })
  88321. .then(response => {
  88322. return response.json();
  88323. })
  88324. .then(mapInfo => {
  88325. this.baseProjection = mapInfo.projection;
  88326. //存储地图的名称以及描述等信息,返回给用户
  88327. this.mapParams = {
  88328. title: mapInfo.title,
  88329. description: mapInfo.description
  88330. };
  88331. const projectionMap = {
  88332. 'EPSG:4490': 'EPSG:4490',
  88333. 'EPSG:4214': 'EPSG:4214',
  88334. 'EPSG:4610': 'EPSG:4610',
  88335. 'EPSG:3857': 'EPSG:3857',
  88336. 'EPSG:4326': 'EPSG:4326'
  88337. }; // 坐标系异常处理
  88338. if (this.baseProjection in projectionMap) {
  88339. this._createMap(mapInfo, this.mapSetting);
  88340. let layers = mapInfo.layers;
  88341. this.map.on('load', () => {
  88342. this._addBaseMap(mapInfo);
  88343. if (!layers || layers.length === 0) {
  88344. this._sendMapToUser(0, 0);
  88345. } else {
  88346. this._addLayers(layers);
  88347. }
  88348. });
  88349. } else {
  88350. throw Error(Lang.i18n('msg_crsunsupport'));
  88351. }
  88352. })
  88353. .catch(error => {
  88354. /**
  88355. * @event WebMap#getmapfailed
  88356. * @description 获取地图信息失败。
  88357. * @property {Object} error - 失败原因。
  88358. */
  88359. this.fire('getmapfailed', { error: error });
  88360. });
  88361. }
  88362. /**
  88363. * @private
  88364. * @function WebMap.prototype._addBaseMap
  88365. * @description 添加底图。
  88366. * @param {Object} mapInfo - map 信息。
  88367. */
  88368. _addBaseMap(mapInfo) {
  88369. this._createBaseLayer(mapInfo);
  88370. }
  88371. /**
  88372. * @private
  88373. * @function WebMap.prototype._createBaseLayer
  88374. * @description 创建底图。
  88375. * @param {Object} mapInfo - map 信息。
  88376. */
  88377. _createBaseLayer(mapInfo) {
  88378. let layerInfo = mapInfo.baseLayer || mapInfo;
  88379. let layerType = layerInfo.layerType; //底图和rest地图兼容
  88380. if (
  88381. layerType.indexOf('TIANDITU_VEC') > -1 ||
  88382. layerType.indexOf('TIANDITU_IMG') > -1 ||
  88383. layerType.indexOf('TIANDITU_TER') > -1
  88384. ) {
  88385. layerType = layerType.substr(0, 12);
  88386. }
  88387. let mapUrls = {
  88388. CLOUD: 'http://t2.dituhui.com/FileService/image?map=quanguo&type=web&x={x}&y={y}&z={z}',
  88389. CLOUD_BLACK: 'http://t3.dituhui.com/MapService/getGdp?x={x}&y={y}&z={z}',
  88390. OSM: 'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png',
  88391. GOOGLE:
  88392. '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',
  88393. GOOGLE_CN: 'https://mt{0-3}.google.cn/vt/lyrs=m&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}',
  88394. JAPAN_STD: 'https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png',
  88395. JAPAN_PALE: 'https://cyberjapandata.gsi.go.jp/xyz/pale/{z}/{x}/{y}.png',
  88396. JAPAN_RELIEF: 'https://cyberjapandata.gsi.go.jp/xyz/relief/{z}/{x}/{y}.png',
  88397. JAPAN_ORT: 'https://cyberjapandata.gsi.go.jp/xyz/ort/{z}/{x}/{y}.jpg'
  88398. },
  88399. url;
  88400. switch (layerType) {
  88401. case 'TIANDITU_VEC':
  88402. case 'TIANDITU_IMG':
  88403. case 'TIANDITU_TER':
  88404. this._createTiandituLayer(mapInfo);
  88405. break;
  88406. case 'BING':
  88407. this._createBingLayer(layerInfo.name);
  88408. break;
  88409. case 'WMS':
  88410. this._createWMSLayer(layerInfo);
  88411. break;
  88412. case 'WMTS':
  88413. this._createWMTSLayer(layerInfo);
  88414. break;
  88415. case 'TILE':
  88416. case 'SUPERMAP_REST':
  88417. this._createDynamicTiledLayer(layerInfo);
  88418. break;
  88419. case 'CLOUD':
  88420. case 'CLOUD_BLACK':
  88421. case 'OSM':
  88422. case 'JAPAN_ORT':
  88423. case 'JAPAN_RELIEF':
  88424. case 'JAPAN_PALE':
  88425. case 'JAPAN_STD':
  88426. case 'GOOGLE_CN':
  88427. case 'GOOGLE':
  88428. url = mapUrls[layerType];
  88429. this._createXYZLayer(layerInfo, url);
  88430. break;
  88431. case 'MAPBOXSTYLE':
  88432. this._createMapboxStyle(layerInfo);
  88433. break;
  88434. default:
  88435. break;
  88436. }
  88437. }
  88438. /**
  88439. * @private
  88440. * @function WebMap.prototype._createMapboxStyle
  88441. * @description 创建 Mapbox 样式。
  88442. * @param {Object} mapInfo - map 信息。
  88443. */
  88444. _createMapboxStyle(mapInfo) {
  88445. let _this = this,
  88446. { dataSource = {} } = mapInfo,
  88447. { serverId, url } = dataSource,
  88448. styleUrl;
  88449. styleUrl = serverId !== undefined ? `${this.server}web/datas/${serverId}/download` : url;
  88450. FetchRequest.get(styleUrl, null, {
  88451. withCredentials: this.withCredentials,
  88452. withoutFormatSuffix: true,
  88453. headers: {
  88454. 'Content-Type': 'application/json;chartset=uft-8'
  88455. }
  88456. }).then(response => {
  88457. return response.json();
  88458. }).then(style => {
  88459. _this._matchStyleObject(style);
  88460. _this.map.setStyle(style);
  88461. })
  88462. }
  88463. /**
  88464. * @private
  88465. * @function WebMap.prototype._matchStyleObject
  88466. * @description 恢复 style 为标准格式。
  88467. * @param {Object} style - mapbox 样式。
  88468. */
  88469. _matchStyleObject(style) {
  88470. let { sprite, glyphs } = style;
  88471. if (sprite && typeof sprite === 'object'){
  88472. style.sprite = Object.values(sprite)[0];
  88473. }
  88474. if (glyphs && typeof glyphs === 'object'){
  88475. style.glyphs = Object.values(glyphs)[0];
  88476. }
  88477. }
  88478. /**
  88479. * @private
  88480. * @function WebMap.prototype._createTiandituLayer
  88481. * @description 创建天地图底图。
  88482. * @param {Object} mapInfo - map 信息。
  88483. */
  88484. _createTiandituLayer(mapInfo) {
  88485. let tiandituUrls = this._getTiandituUrl(mapInfo);
  88486. let layerType = mapInfo.baseLayer.layerType;
  88487. let isLabel = Boolean(mapInfo.baseLayer.labelLayerVisible);
  88488. let labelUrl = tiandituUrls['labelUrl'];
  88489. let tiandituUrl = tiandituUrls['tiandituUrl'];
  88490. this._addBaselayer(tiandituUrl, 'tianditu-layers-' + layerType);
  88491. isLabel && this._addBaselayer(labelUrl, 'tianditu-label-layers-' + layerType);
  88492. }
  88493. /**
  88494. * @private
  88495. * @function WebMap.prototype._createWMTSLayer
  88496. * @description 创建 WMTS 底图。
  88497. * @param {Object} mapInfo - map 信息。
  88498. */
  88499. _createWMTSLayer(layerInfo) {
  88500. let wmtsUrl = this._getWMTSUrl(layerInfo);
  88501. this._filterWMTSIsMatched(layerInfo, (isMatched, matchMaxZoom) => {
  88502. isMatched && this._addBaselayer([wmtsUrl], 'wmts-layers' + layerInfo.name, 0, matchMaxZoom);
  88503. });
  88504. }
  88505. /**
  88506. * @private
  88507. * @function WebMap.prototype._filterWMTSIsMatched
  88508. * @description 过滤能够跟mapboxgl匹配的wmts服务。
  88509. * @param {Object} mapInfo - map 信息。
  88510. * @callback matchedCallback
  88511. */
  88512. _filterWMTSIsMatched(mapInfo, matchedCallback) {
  88513. let isMatched = false,
  88514. matchMaxZoom = 22,
  88515. url = mapInfo.url;
  88516. let options = {
  88517. withCredentials: false,
  88518. withoutFormatSuffix: true
  88519. };
  88520. FetchRequest.get(url, null, options)
  88521. .then(response => {
  88522. return response.text();
  88523. })
  88524. .then(capabilitiesText => {
  88525. let converts = (external_function_try_return_convert_catch_e_return_default()) ? (external_function_try_return_convert_catch_e_return_default()) : window.convert;
  88526. let tileMatrixSet = JSON.parse(converts.xml2json(capabilitiesText, { compact: true, spaces: 4 }))
  88527. .Capabilities.Contents.TileMatrixSet;
  88528. if (!Array.isArray(tileMatrixSet)) {
  88529. tileMatrixSet = [tileMatrixSet];
  88530. }
  88531. for (let i = 0; i < tileMatrixSet.length; i++) {
  88532. if (
  88533. tileMatrixSet[i]['ows:Identifier'] &&
  88534. tileMatrixSet[i]['ows:Identifier']['_text'] === mapInfo.tileMatrixSet
  88535. ) {
  88536. if (DEFAULT_WELLKNOWNSCALESET.indexOf(tileMatrixSet[i]['WellKnownScaleSet']['_text']) > -1) {
  88537. isMatched = true;
  88538. } else if (
  88539. tileMatrixSet[i]['WellKnownScaleSet'] &&
  88540. tileMatrixSet[i]['WellKnownScaleSet']['_text'] === 'Custom'
  88541. ) {
  88542. let matchedScaleDenominator = [];
  88543. //坐标系判断
  88544. let defaultCRSScaleDenominators =
  88545. this.map.crs === 'EPSG:3857' ? MB_SCALEDENOMINATOR_3857 : MB_SCALEDENOMINATOR_4326;
  88546. for (let j = 0, len = defaultCRSScaleDenominators.length; j < len; j++) {
  88547. if (!tileMatrixSet[i].TileMatrix[j]) {
  88548. break;
  88549. }
  88550. if (
  88551. defaultCRSScaleDenominators[j] !==
  88552. tileMatrixSet[i].TileMatrix[j]['ScaleDenominator']['_text']
  88553. ) {
  88554. break;
  88555. }
  88556. matchedScaleDenominator.push(defaultCRSScaleDenominators[j]);
  88557. }
  88558. matchMaxZoom = matchedScaleDenominator.length - 1;
  88559. if (matchedScaleDenominator.length !== 0) {
  88560. isMatched = true;
  88561. } else {
  88562. throw Error(Lang.i18n('msg_tilematrixsetunsupport'));
  88563. }
  88564. } else {
  88565. throw Error(Lang.i18n('msg_tilematrixsetunsupport'));
  88566. }
  88567. }
  88568. }
  88569. matchedCallback(isMatched, matchMaxZoom);
  88570. })
  88571. .catch(error => {
  88572. /**
  88573. * @event WebMap#getwmtsfailed
  88574. * @description 获取 WMTS 图层信息失败。
  88575. * @property {Object} error - 失败原因。
  88576. * @property {mapboxgl.Map} map - MapBoxGL Map 对象。
  88577. */
  88578. this.fire('getwmtsfailed', { error: error, map: this.map });
  88579. });
  88580. }
  88581. /**
  88582. * @private
  88583. * @function WebMap.prototype._createBingLayer
  88584. * @description 创建 Bing 图层。
  88585. */
  88586. _createBingLayer(layerName) {
  88587. let bingUrl =
  88588. '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';
  88589. this.addLayer([bingUrl], 'bing-layers-' + layerName);
  88590. }
  88591. /**
  88592. * @private
  88593. * @function WebMap.prototype._createXYZLayer
  88594. * @description 创建 XYZ 底图。
  88595. * @param {string} url - url 地址。
  88596. */
  88597. _createXYZLayer(layerInfo, url) {
  88598. let urlArr = [];
  88599. if (layerInfo.layerType === 'OSM') {
  88600. let res = url.match(/\w\-\w/g)[0];
  88601. let start = res[0];
  88602. let end = res[2];
  88603. let alphabet = '';
  88604. for (let i = 97; i < 123; i++) {
  88605. alphabet += String.fromCharCode(i);
  88606. }
  88607. let alphabetArr = alphabet.split('');
  88608. let startIndex = alphabetArr.indexOf(start);
  88609. let endIndex = alphabetArr.indexOf(end);
  88610. let res3 = alphabetArr.slice(startIndex, endIndex + 1);
  88611. for (let i = 0; i < res3.length; i++) {
  88612. let replaceRes = url.replace(/{\w\-\w}/g, res3[i]);
  88613. urlArr.push(replaceRes);
  88614. }
  88615. } else if (layerInfo.layerType === 'GOOGLE_CN') {
  88616. let res = url.match(/\d\-\d/g)[0];
  88617. let start = res[0];
  88618. let end = res[2];
  88619. for (let i = start; i <= end; i++) {
  88620. let replaceRes = url.replace(/{\d\-\d}/g, i);
  88621. urlArr.push(replaceRes);
  88622. }
  88623. } else {
  88624. urlArr = [url];
  88625. }
  88626. this._addBaselayer(urlArr, 'XYZ-layers-' + layerInfo.name);
  88627. }
  88628. /**
  88629. * @private
  88630. * @function WebMap.prototype._createDynamicTiledLayer
  88631. * @description 创建 iserver 底图。
  88632. * @param {Object} layerInfo - 图层信息。
  88633. */
  88634. _createDynamicTiledLayer(layerInfo) {
  88635. let url = layerInfo.url;
  88636. const layerId = layerInfo.layerID || layerInfo.name;
  88637. const { minzoom, maxzoom } = layerInfo;
  88638. this._addBaselayer([url], layerId, minzoom, maxzoom, true);
  88639. }
  88640. /**
  88641. * @private
  88642. * @function WebMap.prototype._createWMSLayer
  88643. * @description 创建 WMS 图层。
  88644. * @param {Object} mapInfo - map 信息。
  88645. */
  88646. _createWMSLayer(layerInfo) {
  88647. let WMSUrl = this._getWMSUrl(layerInfo);
  88648. this._addBaselayer([WMSUrl], 'WMS-layers-' + layerInfo.name);
  88649. }
  88650. /**
  88651. * @private
  88652. * @function WebMap.prototype._createVectorLayer
  88653. * @description 创建 Vector 图层。
  88654. * @param {Object} layerInfo - map 信息。
  88655. * @param {Array} features - 属性 信息。
  88656. */
  88657. _createVectorLayer(layerInfo, features) {
  88658. let style = layerInfo.style;
  88659. let type = layerInfo.featureType;
  88660. let layerID = layerInfo.layerID;
  88661. let visible = layerInfo.visible;
  88662. let layerStyle = {};
  88663. layerStyle.style = this._transformStyleToMapBoxGl(style, type);
  88664. layerStyle.layout = { visibility: visible };
  88665. let source = {
  88666. type: 'geojson',
  88667. data: {
  88668. type: 'FeatureCollection',
  88669. features: features
  88670. }
  88671. };
  88672. this._addOverlayToMap(type, source, layerID, layerStyle);
  88673. // 如果面有边框
  88674. type === 'POLYGON' &&
  88675. style.strokeColor &&
  88676. this._addStrokeLineForPoly(style, source, layerID + '-strokeLine', visible);
  88677. }
  88678. /**
  88679. * @function WebMap.prototype._getTiandituUrl
  88680. * @private
  88681. * @description 创建天地图url;
  88682. * @param {Object} mapInfo - map 信息。
  88683. */
  88684. _getTiandituUrl(mapInfo) {
  88685. let re = /t0/gi;
  88686. let tiandituUrls = {};
  88687. let layerType = mapInfo.baseLayer.layerType.split('_')[1].toLowerCase();
  88688. let isLabel = Boolean(mapInfo.baseLayer.labelLayerVisible);
  88689. // let isLabel = true;
  88690. let url = 'https://t0.tianditu.gov.cn/{layer}_{proj}/wmts?';
  88691. let labelUrl = url;
  88692. let layerLabelMap = {
  88693. vec: 'cva',
  88694. ter: 'cta',
  88695. img: 'cia'
  88696. };
  88697. let tilematrixSet = this.baseProjection === 'EPSG:4326' ? 'c' : 'w';
  88698. let options = {
  88699. service: 'WMTS',
  88700. request: 'GetTile',
  88701. style: 'default',
  88702. version: '1.0.0',
  88703. layer: layerType,
  88704. tilematrixSet: tilematrixSet,
  88705. format: 'tiles',
  88706. width: 256,
  88707. height: 256
  88708. };
  88709. url += this._getParamString(options, url) + '&tilematrix={z}&tilerow={y}&tilecol={x}';
  88710. let tiandituUrl = url.replace('{layer}', layerType).replace('{proj}', tilematrixSet);
  88711. let tiandituUrlArr = [];
  88712. for (let i = 0; i < 8; i++) {
  88713. tiandituUrlArr.push(tiandituUrl.replace(re, `t${i}`));
  88714. }
  88715. tiandituUrls['tiandituUrl'] = tiandituUrlArr;
  88716. // 如果有 label 图层
  88717. if (isLabel) {
  88718. let labelLayer = layerLabelMap[layerType];
  88719. options.layer = labelLayer;
  88720. labelUrl += this._getParamString(options, labelUrl) + '&tilematrix={z}&tilerow={y}&tilecol={x}';
  88721. labelUrl = labelUrl.replace('{layer}', labelLayer).replace('{proj}', tilematrixSet);
  88722. let labelUrlArr = [];
  88723. for (let i = 0; i < 8; i++) {
  88724. labelUrlArr.push(labelUrl.replace(re, `t${i}`));
  88725. }
  88726. tiandituUrls['labelUrl'] = labelUrlArr;
  88727. }
  88728. return tiandituUrls;
  88729. }
  88730. /**
  88731. * @function WebMap.prototype._getWMSUrl
  88732. * @private
  88733. * @description 创建 WMS url;
  88734. * @param {Object} mapInfo - map 信息。
  88735. */
  88736. _getWMSUrl(mapInfo) {
  88737. let url = mapInfo.url;
  88738. url = url.split('?')[0];
  88739. let strArr = url.split('/');
  88740. let options = {
  88741. service: 'WMS',
  88742. request: 'GetMap',
  88743. layers: strArr[strArr.length - 1],
  88744. styles: '',
  88745. format: 'image/png',
  88746. transparent: 'true',
  88747. version: '1.1.1',
  88748. width: 256,
  88749. height: 256,
  88750. srs: this.baseProjection
  88751. };
  88752. let bbox = this.baseProjection === 'EPSG:4326' ? '{bbox-epsg-4326}' : '{bbox-epsg-3857}';
  88753. url += this._getParamString(options, url) + `&bbox=${bbox}`;
  88754. return url;
  88755. }
  88756. /**
  88757. * @private
  88758. * @function WebMap.prototype._addLayers
  88759. * @description 添加叠加图层。
  88760. * @param {Object} mapInfo - 图层信息。
  88761. */
  88762. _addLayers(layers) {
  88763. //存储地图上所有的图层对象
  88764. this.layers = layers;
  88765. let features,
  88766. layerAdded = 0,
  88767. len = layers.length;
  88768. layers.forEach((layer, index) => {
  88769. if ((layer.dataSource && layer.dataSource.serverId) || layer.layerType === 'MARKER') {
  88770. // 获取 serverID
  88771. let serverId = layer.dataSource ? layer.dataSource.serverId : layer.serverId;
  88772. let url = `${this.server}web/datas/${serverId}/content.json?pageSize=9999999&currentPage=1`;
  88773. // 获取图层数据
  88774. serverId &&
  88775. FetchRequest.get(url, null, { withCredentials: this.withCredentials })
  88776. .then(response => {
  88777. return response.json();
  88778. })
  88779. .then(data => {
  88780. if (data.succeed === false) {
  88781. //请求失败
  88782. layerAdded++;
  88783. this._sendMapToUser(layerAdded, len);
  88784. /**
  88785. * @event WebMap#getlayersfailed
  88786. * @description 获取图层信息失败。
  88787. * @property {Object} error - 失败原因。
  88788. * @property {mapboxgl.Map} map - MapBoxGL Map 对象。
  88789. */
  88790. this.fire('getlayersfailed', { error: data.error, map: this.map });
  88791. return;
  88792. }
  88793. if (data.type) {
  88794. if (data.type === 'JSON' || data.type === 'GEOJSON') {
  88795. data.content = JSON.parse(data.content.trim());
  88796. features = this._formatGeoJSON(data.content, layer);
  88797. } else if (data.type === 'EXCEL' || data.type === 'CSV') {
  88798. features = this._excelData2Feature(data.content, layer);
  88799. }
  88800. this._addLayer(layer, features, index);
  88801. layerAdded++;
  88802. this._sendMapToUser(layerAdded, len);
  88803. }
  88804. })
  88805. .catch(error => {
  88806. layerAdded++;
  88807. this._sendMapToUser(layerAdded, len);
  88808. this.fire('getlayersfailed', { error: error, map: this.map });
  88809. });
  88810. } else if (
  88811. layer.layerType === 'SUPERMAP_REST' ||
  88812. layer.layerType === 'TILE' ||
  88813. layer.layerType === 'WMS' ||
  88814. layer.layerType === 'WMTS'
  88815. ) {
  88816. this._createBaseLayer(layer);
  88817. layerAdded++;
  88818. this._sendMapToUser(layerAdded, len);
  88819. } else if (layer.dataSource && layer.dataSource.type === 'REST_DATA') {
  88820. let dataSource = layer.dataSource;
  88821. //从restData获取数据
  88822. this._getFeatureBySQL(
  88823. dataSource.url,
  88824. [dataSource.dataSourseName || layer.name],
  88825. result => {
  88826. features = this._parseGeoJsonData2Feature({
  88827. allDatas: { features: result.result.features.features },
  88828. fileCode: layer.projection,
  88829. featureProjection: this.baseProjection
  88830. });
  88831. this._addLayer(layer, features, index);
  88832. layerAdded++;
  88833. this._sendMapToUser(layerAdded, len);
  88834. },
  88835. err => {
  88836. layerAdded++;
  88837. this._sendMapToUser(layerAdded, len);
  88838. /**
  88839. * @event WebMap#getfeaturesfailed
  88840. * @description 获取图层要素失败。
  88841. * @property {Object} error - 失败原因。
  88842. */
  88843. this.fire('getfeaturesfailed', { error: err });
  88844. }
  88845. );
  88846. } else if (layer.dataSource && layer.dataSource.type === 'REST_MAP' && layer.dataSource.url) {
  88847. this._queryFeatureBySQL(
  88848. layer.dataSource.url,
  88849. layer.dataSource.layerName,
  88850. 'smid=1',
  88851. null,
  88852. null,
  88853. result => {
  88854. let recordsets = result && result.result.recordsets;
  88855. let recordset = recordsets && recordsets[0];
  88856. let attributes = recordset.fields;
  88857. if (recordset && attributes) {
  88858. let fileterAttrs = [];
  88859. for (let i in attributes) {
  88860. let value = attributes[i];
  88861. if (value.indexOf('Sm') !== 0 || value === 'SmID') {
  88862. fileterAttrs.push(value);
  88863. }
  88864. }
  88865. this._getFeatures(
  88866. fileterAttrs,
  88867. layer,
  88868. features => {
  88869. this._addLayer(layer, features, index);
  88870. layerAdded++;
  88871. this._sendMapToUser(layerAdded, len);
  88872. },
  88873. err => {
  88874. layerAdded++;
  88875. this.fire('getfeaturesfailed', { error: err, map: this.map });
  88876. }
  88877. );
  88878. }
  88879. },
  88880. err => {
  88881. this.fire('getlayersfailed', { error: err, map: this.map });
  88882. }
  88883. );
  88884. }
  88885. }, this);
  88886. }
  88887. /**
  88888. * @private
  88889. * @function WebMap.prototype._getFeatures
  88890. * @description 将单个图层添加到地图上。
  88891. * @param layerInfo 某个图层的图层信息
  88892. * @param {Array.<GeoJSON>} features - feature。
  88893. */
  88894. _getFeatures(fields, layerInfo, resolve, reject) {
  88895. let source = layerInfo.dataSource;
  88896. //示例数据
  88897. let fileCode = layerInfo.projection;
  88898. this._queryFeatureBySQL(
  88899. source.url,
  88900. source.layerName,
  88901. null,
  88902. fields,
  88903. null,
  88904. result => {
  88905. let recordsets = result.result.recordsets[0];
  88906. let features = recordsets.features.features;
  88907. let featuresObj = this._parseGeoJsonData2Feature(
  88908. {
  88909. allDatas: { features },
  88910. fileCode: fileCode,
  88911. featureProjection: this.baseProjection
  88912. },
  88913. 'JSON'
  88914. );
  88915. resolve(featuresObj);
  88916. },
  88917. err => {
  88918. reject(err);
  88919. }
  88920. );
  88921. }
  88922. /**
  88923. * @private
  88924. * @function WebMap.prototype._addLayer
  88925. * @description 将单个图层添加到地图上。
  88926. * @param layerInfo 某个图层的图层信息
  88927. * @param {Array.<GeoJSON>} features - feature。
  88928. */
  88929. _addLayer(layerInfo, features, index) {
  88930. let layerType = layerInfo.layerType;
  88931. layerInfo.layerID = layerType + '-' + layerInfo.name + '-' + index;
  88932. layerInfo.visible = layerInfo.visible ? 'visible' : 'none';
  88933. // mbgl 目前不能处理 geojson 复杂面情况
  88934. // mbgl isssue https://github.com/mapbox/mapbox-gl-js/issues/7023
  88935. if (features[0] && features[0].geometry.type === 'Polygon') {
  88936. features = this._handleMultyPolygon(features);
  88937. }
  88938. if (layerInfo.style && layerInfo.filterCondition) {
  88939. //将 feature 根据过滤条件进行过滤, 分段专题图和单值专题图因为要计算 styleGroup 所以暂时不过滤
  88940. if (layerType !== 'RANGE' && layerType !== 'UNIQUE') {
  88941. features = this._getFiterFeatures(layerInfo.filterCondition, features);
  88942. }
  88943. }
  88944. if (layerType === 'VECTOR') {
  88945. if (layerInfo.featureType === 'POINT') {
  88946. if (layerInfo.style.type === 'SYMBOL_POINT') {
  88947. this._createSymbolLayer(layerInfo, features);
  88948. } else {
  88949. this._createGraphicLayer(layerInfo, features);
  88950. }
  88951. } else {
  88952. //线和面
  88953. this._createVectorLayer(layerInfo, features);
  88954. }
  88955. } else if (layerType === 'UNIQUE') {
  88956. this._createUniqueLayer(layerInfo, features);
  88957. } else if (layerType === 'RANGE') {
  88958. this._createRangeLayer(layerInfo, features);
  88959. } else if (layerType === 'HEAT') {
  88960. this._createHeatLayer(layerInfo, features);
  88961. } else if (layerType === 'MARKER') {
  88962. this._createMarkerLayer(layerInfo, features);
  88963. }
  88964. if (layerInfo.labelStyle && layerInfo.labelStyle.labelField) {
  88965. // 存在标签专题图
  88966. this._addLabelLayer(layerInfo, features);
  88967. }
  88968. }
  88969. /**
  88970. * @private
  88971. * @function WebMap.prototype._addLabelLayer
  88972. * @description 添加标签图层。
  88973. * @param layerInfo 某个图层的图层信息。
  88974. * @param {Array.<GeoJSON>} features - feature。
  88975. */
  88976. _addLabelLayer(layerInfo, features) {
  88977. let labelStyle = layerInfo.labelStyle;
  88978. this.map.addLayer({
  88979. id: layerInfo.layerID + 'label',
  88980. type: 'symbol',
  88981. source: {
  88982. type: 'geojson',
  88983. data: {
  88984. type: 'FeatureCollection',
  88985. features: features
  88986. }
  88987. },
  88988. paint: {
  88989. 'text-color': labelStyle.fill
  88990. },
  88991. layout: {
  88992. 'text-field': `{${labelStyle.labelField}}`,
  88993. 'text-size': parseFloat(labelStyle.fontSize) || 12,
  88994. 'text-offset': labelStyle.offsetX
  88995. ? [labelStyle.offsetX / 10 || 0, labelStyle.offsetY / 10 || 0]
  88996. : [0, -1.5],
  88997. 'text-font': ['DIN Offc Pro Italic', 'Arial Unicode MS Regular'],
  88998. visibility: layerInfo.visible
  88999. }
  89000. });
  89001. }
  89002. /**
  89003. * @private
  89004. * @function WebMap.prototype._createSymbolLayer
  89005. * @description 添加 symbol 图层。
  89006. * @param layerInfo 某个图层的图层信息。
  89007. * @param {Array.<GeoJSON>} features - feature。
  89008. */
  89009. _createSymbolLayer(layerInfo, features) {
  89010. //用来请求symbol_point字体文件
  89011. let target = document.getElementById(`${this.target}`);
  89012. target.classList.add('supermapol-icons-map');
  89013. let style = layerInfo.style;
  89014. let unicode = layerInfo.style.unicode;
  89015. let text = String.fromCharCode(parseInt(unicode.replace(/^&#x/, ''), 16));
  89016. let layerID = layerInfo.layerID;
  89017. this.map.addSource(layerID + '-source', {
  89018. type: 'geojson',
  89019. data: {
  89020. type: 'FeatureCollection',
  89021. features: []
  89022. }
  89023. });
  89024. this.map.addLayer({
  89025. id: layerID,
  89026. type: 'symbol',
  89027. source: layerID + '-source',
  89028. paint: {
  89029. 'text-color': style.fillColor
  89030. },
  89031. layout: {
  89032. 'text-field': text,
  89033. 'text-font': ['DIN Offc Pro Italic', 'Arial Unicode MS Regular'],
  89034. visibility: layerInfo.visible
  89035. }
  89036. });
  89037. this.map.getSource(layerID + '-source').setData({
  89038. type: 'FeatureCollection',
  89039. features: features
  89040. });
  89041. }
  89042. /**
  89043. * @private
  89044. * @function WebMap.prototype._createGraphicLayer
  89045. * @description 创建 Graphic 图层。
  89046. * @param {Object} layerInfo - map 信息。
  89047. * @param {Array} features - 属性 信息。
  89048. */
  89049. _createGraphicLayer(layerInfo, features) {
  89050. let style = layerInfo.style;
  89051. let layerStyle = {};
  89052. let layerID = layerInfo.layerID;
  89053. let source = {
  89054. type: 'geojson',
  89055. data: {
  89056. type: 'FeatureCollection',
  89057. features: features
  89058. }
  89059. };
  89060. if (style.type === 'IMAGE_POINT') {
  89061. let imageInfo = style.imageInfo;
  89062. let imgDom = imageInfo.img;
  89063. if (!imgDom || !imgDom.src) {
  89064. //要组装成完整的url
  89065. imageInfo.url = this.server + imageInfo.url;
  89066. }
  89067. this.map.loadImage(imageInfo.url || imgDom.src, (error, image) => {
  89068. if (error) {
  89069. console.log(error);
  89070. }
  89071. let iconSize = Number.parseFloat((style.radius / image.height).toFixed(2)) * 2;
  89072. this.map.addImage('imageIcon', image);
  89073. this.map.addLayer({
  89074. id: layerID,
  89075. type: 'symbol',
  89076. source: source,
  89077. layout: {
  89078. 'icon-image': 'imageIcon',
  89079. 'icon-size': iconSize,
  89080. visibility: layerInfo.visible
  89081. }
  89082. });
  89083. });
  89084. } else if (style.type === 'SVG_POINT') {
  89085. let svg_url = style.url;
  89086. if (!this.svgDiv) {
  89087. this.svgDiv = document.createElement('div');
  89088. document.body.appendChild(this.svgDiv);
  89089. }
  89090. this._getCanvasFromSVG(svg_url, this.svgDiv, canvas => {
  89091. let imgUrl = canvas.toDataURL('img/png');
  89092. imgUrl &&
  89093. this.map.loadImage(
  89094. imgUrl,
  89095. (error, image) => {
  89096. if (error) {
  89097. console.log(error);
  89098. }
  89099. let iconSize = Number.parseFloat((style.radius / canvas.width).toFixed(2));
  89100. this.map.addImage('imageIcon', image);
  89101. this.map.addLayer({
  89102. id: layerID,
  89103. type: 'symbol',
  89104. source: source,
  89105. layout: {
  89106. 'icon-image': 'imageIcon',
  89107. 'icon-size': iconSize,
  89108. visibility: layerInfo.visible
  89109. }
  89110. });
  89111. },
  89112. this
  89113. );
  89114. });
  89115. } else {
  89116. layerStyle.style = this._transformStyleToMapBoxGl(style, layerInfo.featureType);
  89117. layerStyle.layout = { visibility: layerInfo.visible };
  89118. this._addOverlayToMap('POINT', source, layerID, layerStyle);
  89119. }
  89120. }
  89121. /**
  89122. * @private
  89123. * @function WebMap.prototype._createUniqueLayer
  89124. * @description 创建单值图层。
  89125. * @param layerInfo 某个图层的图层信息
  89126. * @param features 图层上的 feature
  89127. */
  89128. _createUniqueLayer(layerInfo, features) {
  89129. let styleGroup = this._getUniqueStyleGroup(layerInfo, features);
  89130. features = this._getFiterFeatures(layerInfo.filterCondition, features);
  89131. let style = layerInfo.style;
  89132. let layerStyle = {};
  89133. let themeField = layerInfo.themeSetting.themeField;
  89134. let type = layerInfo.featureType;
  89135. let expression = ['match', ['get', 'index']];
  89136. let layerID = layerInfo.layerID;
  89137. features.forEach(row => {
  89138. styleGroup.forEach(item => {
  89139. if (item.value === row.properties[themeField]) {
  89140. expression.push(row.properties['index'], item.color);
  89141. }
  89142. });
  89143. });
  89144. expression.push('#ffffff');
  89145. layerStyle.style = this._transformStyleToMapBoxGl(style, type, expression);
  89146. let visible = layerInfo.visible;
  89147. layerStyle.layout = { visibility: visible };
  89148. let source = {
  89149. type: 'geojson',
  89150. data: {
  89151. type: 'FeatureCollection',
  89152. features: features
  89153. }
  89154. };
  89155. this._addOverlayToMap(type, source, layerID, layerStyle);
  89156. type === 'POLYGON' &&
  89157. style.strokeColor &&
  89158. this._addStrokeLineForPoly(style, source, layerID + '-strokeLine', visible);
  89159. }
  89160. /**
  89161. * @private
  89162. * @function WebMap.prototype._getUniqueStyleGroup
  89163. * @description 获取单值的目标字段与颜色的对应数组。
  89164. * @param layerInfo 某个图层的图层信息
  89165. * @param features 图层上的 feature
  89166. */
  89167. _getUniqueStyleGroup(parameters, features) {
  89168. // 找出所有的单值
  89169. let featureType = parameters.featureType,
  89170. style = parameters.style,
  89171. themeSetting = parameters.themeSetting;
  89172. let fieldName = themeSetting.themeField,
  89173. colors = themeSetting.colors;
  89174. let names = [],
  89175. customSettings = themeSetting.customSettings;
  89176. for (let i in features) {
  89177. let properties = features[i].properties;
  89178. let name = properties[fieldName];
  89179. let isSaved = false;
  89180. for (let j in names) {
  89181. if (names[j] === name) {
  89182. isSaved = true;
  89183. break;
  89184. }
  89185. }
  89186. if (!isSaved) {
  89187. names.push(name);
  89188. }
  89189. }
  89190. //获取一定量的颜色
  89191. let curentColors = colors || this.defaultParameters.colors;
  89192. curentColors = ColorsPickerUtil.getGradientColors(curentColors, names.length);
  89193. //生成styleGroup
  89194. let styleGroup = [];
  89195. names.forEach((name, index) => {
  89196. let color = curentColors[index];
  89197. if (name in customSettings) {
  89198. color = customSettings[name];
  89199. }
  89200. if (featureType === 'LINE') {
  89201. style.strokeColor = color;
  89202. } else {
  89203. style.fillColor = color;
  89204. }
  89205. styleGroup.push({ color: color, value: name });
  89206. }, this);
  89207. return styleGroup;
  89208. }
  89209. /**
  89210. * @private
  89211. * @function WebMap.prototype._getWMTSUrl
  89212. * @description 根据传入的配置信息拼接wmts url。
  89213. * @param options 配置对象
  89214. */
  89215. _getWMTSUrl(options) {
  89216. let obj = {
  89217. service: 'WMTS',
  89218. request: 'GetTile',
  89219. version: '1.0.0',
  89220. style: 'default',
  89221. layer: options.layer,
  89222. tilematrixSet: options.tileMatrixSet,
  89223. format: 'image/png'
  89224. };
  89225. let url = options.url;
  89226. url += this._getParamString(obj, url) + '&tilematrix={z}&tilerow={y}&tilecol={x}';
  89227. return url;
  89228. }
  89229. /**
  89230. * @private
  89231. * @function WebMap.prototype._createMarkerLayer
  89232. * @description 添加标记图层。
  89233. * @param {Array.<GeoJSON>} features - feature。
  89234. */
  89235. _createMarkerLayer(layerInfo, features) {
  89236. features &&
  89237. features.forEach(feature => {
  89238. let geomType = feature.geometry.type.toUpperCase();
  89239. let defaultStyle = feature.dv_v5_markerStyle;
  89240. if (geomType === 'POINT' && defaultStyle.text) {
  89241. //说明是文字的feature类型
  89242. geomType = 'TEXT';
  89243. }
  89244. let featureInfo = this.setFeatureInfo(feature);
  89245. feature.properties['useStyle'] = defaultStyle;
  89246. feature.properties['featureInfo'] = featureInfo;
  89247. if (
  89248. geomType === 'POINT' &&
  89249. defaultStyle.src &&
  89250. (defaultStyle.src.indexOf('http://') === -1 && defaultStyle.src.indexOf('https://') === -1)
  89251. ) {
  89252. //说明地址不完整
  89253. defaultStyle.src = this.server + defaultStyle.src;
  89254. }
  89255. let source = {
  89256. type: 'geojson',
  89257. data: feature
  89258. };
  89259. let index = feature.properties.index;
  89260. let layerID = geomType + '-' + index;
  89261. // image-marker
  89262. geomType === 'POINT' &&
  89263. defaultStyle.src &&
  89264. defaultStyle.src.indexOf('svg') <= -1 &&
  89265. this.map.loadImage(
  89266. defaultStyle.src,
  89267. (error, image) => {
  89268. if (error) {
  89269. console.log(error);
  89270. }
  89271. this.map.addImage(index + '', image);
  89272. this.map.addLayer({
  89273. id: layerID,
  89274. type: 'symbol',
  89275. source: source,
  89276. layout: {
  89277. 'icon-image': index + '',
  89278. 'icon-size': defaultStyle.scale,
  89279. visibility: layerInfo.visible
  89280. }
  89281. });
  89282. },
  89283. this
  89284. );
  89285. // svg-marker
  89286. if (geomType === 'POINT' && defaultStyle.src && defaultStyle.src.indexOf('svg') > -1) {
  89287. if (!this.svgDiv) {
  89288. this.svgDiv = document.createElement('div');
  89289. document.body.appendChild(this.svgDiv);
  89290. }
  89291. this._getCanvasFromSVG(defaultStyle.src, this.svgDiv, canvas => {
  89292. let imgUrl = canvas.toDataURL('img/png');
  89293. imgUrl &&
  89294. this.map.loadImage(
  89295. imgUrl,
  89296. (error, image) => {
  89297. if (error) {
  89298. console.log(error);
  89299. }
  89300. this.map.addImage(index + '', image);
  89301. this.map.addLayer({
  89302. id: layerID,
  89303. type: 'symbol',
  89304. source: source,
  89305. layout: {
  89306. 'icon-image': index + '',
  89307. 'icon-size': defaultStyle.scale,
  89308. visibility: layerInfo.visible
  89309. }
  89310. });
  89311. },
  89312. this
  89313. );
  89314. });
  89315. }
  89316. // point-line-polygon-marker
  89317. if (!defaultStyle.src) {
  89318. let layeStyle = { layout: {} };
  89319. if (geomType === 'LINESTRING' && defaultStyle.lineCap) {
  89320. geomType = 'LINE';
  89321. layeStyle.layout = { 'line-cap': defaultStyle.lineCap };
  89322. }
  89323. let visible = layerInfo.visible;
  89324. layeStyle.layout.visibility = visible;
  89325. // get style
  89326. layeStyle.style = this._transformStyleToMapBoxGl(defaultStyle, geomType);
  89327. this._addOverlayToMap(geomType, source, layerID, layeStyle);
  89328. // 若面有边框
  89329. geomType === 'POLYGON' &&
  89330. defaultStyle.strokeColor &&
  89331. this._addStrokeLineForPoly(defaultStyle, source, layerID + '-strokeLine', visible);
  89332. }
  89333. }, this);
  89334. }
  89335. /**
  89336. * @private
  89337. * @function WebMap.prototype.setFeatureInfo
  89338. * @description 设置 feature 信息。
  89339. * @param {Array.<GeoJSON>} features - feature。
  89340. */
  89341. setFeatureInfo(feature) {
  89342. let featureInfo;
  89343. let info = feature.dv_v5_markerInfo;
  89344. if (info && info.dataViz_title) {
  89345. //有featureInfo信息就不需要再添加
  89346. featureInfo = info;
  89347. } else {
  89348. // featureInfo = this.getDefaultAttribute();
  89349. return info;
  89350. }
  89351. let properties = feature.properties;
  89352. for (let key in featureInfo) {
  89353. if (properties[key]) {
  89354. featureInfo[key] = properties[key];
  89355. delete properties[key];
  89356. }
  89357. }
  89358. return featureInfo;
  89359. }
  89360. /**
  89361. * @private
  89362. * @function WebMap.prototype._createHeatLayer
  89363. * @description 添加热力图。
  89364. * @param {Array.<GeoJSON>} features - feature。
  89365. */
  89366. _createHeatLayer(layerInfo, features) {
  89367. let style = layerInfo.themeSetting;
  89368. let layerOption = {};
  89369. layerOption.gradient = style.colors.slice();
  89370. layerOption.radius = parseInt(style.radius);
  89371. //自定义颜色
  89372. let customSettings = style.customSettings;
  89373. for (let i in customSettings) {
  89374. layerOption.gradient[i] = customSettings[i];
  89375. }
  89376. // 权重字段恢复
  89377. if (style.weight) {
  89378. this._changeWeight(features, style.weight);
  89379. }
  89380. let color = ['interpolate', ['linear'], ['heatmap-density']];
  89381. let length = layerOption.gradient.length;
  89382. let step = (1 / length).toFixed(2);
  89383. layerOption.gradient.forEach((item, index) => {
  89384. color.push(index * step);
  89385. if (index === 0) {
  89386. item = core_Util_Util.hexToRgba(item, 0);
  89387. }
  89388. color.push(item);
  89389. });
  89390. let paint = {
  89391. 'heatmap-color': color,
  89392. 'heatmap-radius': style.radius + 15,
  89393. 'heatmap-intensity': { base: 1, stops: [[0, 0.8], [22, 1]] }
  89394. };
  89395. if (features[0].weight && features.length >= 4) {
  89396. let weight = [];
  89397. features.forEach(item => {
  89398. weight.push(item.weight);
  89399. });
  89400. let max = ArrayStatistic.getMax(weight);
  89401. let min = ArrayStatistic.getMin(weight);
  89402. paint['heatmap-weight'] = ['interpolate', ['linear'], ['get', 'weight'], min, 0, max, 1];
  89403. }
  89404. this.map.addLayer({
  89405. id: layerInfo.layerID,
  89406. type: 'heatmap',
  89407. source: {
  89408. type: 'geojson',
  89409. data: {
  89410. type: 'FeatureCollection',
  89411. features: features
  89412. }
  89413. },
  89414. paint: paint
  89415. });
  89416. }
  89417. /**
  89418. * @private
  89419. * @function WebMap.prototype._changeWeight
  89420. * @description 改变当前权重字段
  89421. * @param {Array.<GeoJSON>} features - feature。
  89422. * @param {string} weightFeild - 权重字段
  89423. */
  89424. _changeWeight(features, weightFeild) {
  89425. this.fieldMaxValue = {};
  89426. this._getMaxValue(features, weightFeild);
  89427. let maxValue = this.fieldMaxValue[weightFeild];
  89428. features.forEach(feature => {
  89429. let attributes = feature.properties;
  89430. let value = attributes[weightFeild];
  89431. feature['weight'] = value / maxValue;
  89432. });
  89433. }
  89434. /**
  89435. * @private
  89436. * @function WebMap.prototype._getMaxValue
  89437. * @description 获取当前字段对应的最大值,用于计算权重。
  89438. * @param {Array.<GeoJSON>} features - feature。
  89439. * @param {string} weightFeild - 权重字段
  89440. */
  89441. _getMaxValue(features, weightField) {
  89442. let values = [],
  89443. attributes;
  89444. let field = weightField;
  89445. if (this.fieldMaxValue[field]) {
  89446. return;
  89447. }
  89448. features.forEach(feature => {
  89449. //收集当前权重字段对应的所有值
  89450. attributes = feature.properties;
  89451. attributes && parseFloat(attributes[field]) && values.push(parseFloat(attributes[field]));
  89452. });
  89453. this.fieldMaxValue[field] = ArrayStatistic.getArrayStatistic(values, 'Maximum');
  89454. }
  89455. /**
  89456. * @private
  89457. * @function WebMap.prototype._createRangeLayer
  89458. * @description 添加分段专题图。
  89459. * @param {Array.<GeoJSON>} features - feature。
  89460. */
  89461. _createRangeLayer(layerInfo, features) {
  89462. let fieldName = layerInfo.themeSetting.themeField;
  89463. let style = layerInfo.style;
  89464. let featureType = layerInfo.featureType;
  89465. let styleGroups = this._getRangeStyleGroup(layerInfo, features);
  89466. features = this._getFiterFeatures(layerInfo.filterCondition, features);
  89467. let source = {
  89468. type: 'geojson',
  89469. data: {
  89470. type: 'FeatureCollection',
  89471. features: features
  89472. }
  89473. };
  89474. // 获取 expression
  89475. let expression = ['match', ['get', 'index']];
  89476. features.forEach(row => {
  89477. let tartget = parseFloat(row.properties[fieldName]);
  89478. for (let i = 0; i < styleGroups.length; i++) {
  89479. if (styleGroups[i].start <= tartget && tartget < styleGroups[i].end) {
  89480. expression.push(row.properties['index'], styleGroups[i].color);
  89481. // return;
  89482. }
  89483. }
  89484. !tartget && expression.push(row.properties['index'], 'rgba(0, 0, 0, 0)');
  89485. }, this);
  89486. expression.push('rgba(0, 0, 0, 0)');
  89487. // 获取样式
  89488. let layerStyle = { layout: {} };
  89489. if (featureType === 'LINE' && style.lineCap) {
  89490. layerStyle.layout = { 'line-cap': style.lineCap };
  89491. }
  89492. let visible = layerInfo.visible;
  89493. layerStyle.layout.visibility = visible;
  89494. layerStyle.style = this._transformStyleToMapBoxGl(style, featureType, expression);
  89495. // 添加图层
  89496. let layerID = layerInfo.layerID;
  89497. this._addOverlayToMap(featureType, source, layerID, layerStyle);
  89498. // 如果面有边框
  89499. featureType === 'POLYGON' &&
  89500. style.strokeColor &&
  89501. this._addStrokeLineForPoly(style, source, layerID + '-strokeline', visible);
  89502. }
  89503. /**
  89504. * @private
  89505. * @function WebMap.prototype._getFiterFeatures
  89506. * @description 通过过滤条件查询满足的 feature。
  89507. * @param {string} filterCondition - 过滤条件。
  89508. * @param {Array} allFeatures - 图层上的 feature 集合
  89509. */
  89510. _getFiterFeatures(filterCondition, allFeatures) {
  89511. if (!filterCondition) {
  89512. return allFeatures;
  89513. }
  89514. let condition = this._replaceFilterCharacter(filterCondition);
  89515. let filterFeatures = [];
  89516. for (let i = 0; i < allFeatures.length; i++) {
  89517. let feature = allFeatures[i];
  89518. let filterResult = false;
  89519. try {
  89520. const properties = feature.properties;
  89521. const conditions = parseCondition(condition, Object.keys(properties));
  89522. const filterFeature = parseConditionFeature(properties);
  89523. const sql = 'select * from json where (' + conditions + ')';
  89524. filterResult = window.jsonsql.query(sql, { attr: filterFeature });
  89525. } catch (err) {
  89526. //必须把要过滤得内容封装成一个对象,主要是处理jsonsql(line : 62)中由于with语句遍历对象造成的问题
  89527. continue;
  89528. }
  89529. if (filterResult && filterResult.length > 0) {
  89530. //afterFilterFeatureIdx.push(i);
  89531. filterFeatures.push(feature);
  89532. }
  89533. }
  89534. return filterFeatures;
  89535. }
  89536. /**
  89537. * @private
  89538. * @function WebMap.prototype._replaceFilterCharacter
  89539. * @description 获取过滤字符串。
  89540. * @param {string} filterString - 过滤条件。
  89541. */
  89542. _replaceFilterCharacter(filterString) {
  89543. filterString = filterString
  89544. .replace(/=/g, '==')
  89545. .replace(/AND|and/g, '&&')
  89546. .replace(/or|OR/g, '||')
  89547. .replace(/<==/g, '<=')
  89548. .replace(/>==/g, '>=');
  89549. return filterString;
  89550. }
  89551. /**
  89552. * @private
  89553. * @function WebMap.prototype._getRangeStyleGroup
  89554. * @description 获取分段样式。
  89555. * @param {Array.<GeoJSON>} features - feature。
  89556. */
  89557. _getRangeStyleGroup(layerInfo, features) {
  89558. // 找出分段值
  89559. let featureType = layerInfo.featureType;
  89560. let style = layerInfo.style;
  89561. let values = [],
  89562. attributes;
  89563. let themeSetting = layerInfo.themeSetting;
  89564. let customSettings = themeSetting.customSettings;
  89565. let fieldName = themeSetting.themeField;
  89566. let segmentCount = themeSetting.segmentCount;
  89567. features.forEach(feature => {
  89568. attributes = feature.properties || feature.get('Properties');
  89569. if (attributes) {
  89570. //过滤掉非数值的数据
  89571. attributes[fieldName] &&
  89572. core_Util_Util.isNumber(attributes[fieldName]) &&
  89573. values.push(parseFloat(attributes[fieldName]));
  89574. } else if (feature.get(fieldName) && core_Util_Util.isNumber(feature.get(fieldName))) {
  89575. feature.get(fieldName) && values.push(parseFloat(feature.get(fieldName)));
  89576. }
  89577. }, this);
  89578. let segements = ArrayStatistic.getArraySegments(values, themeSetting.segmentMethod, segmentCount);
  89579. if (segements) {
  89580. let itemNum = segmentCount;
  89581. if (attributes && segements[0] === segements[attributes.length - 1]) {
  89582. itemNum = 1;
  89583. segements.length = 2;
  89584. }
  89585. //保留两位有效数
  89586. for (let key in segements) {
  89587. let value = segements[key];
  89588. value = key == 0 ? Math.floor(value * 100) / 100 : Math.ceil(value * 100) / 100 + 0.1; // 加0.1 解决最大值没有样式问题
  89589. segements[key] = Number(value.toFixed(2));
  89590. }
  89591. //获取一定量的颜色
  89592. let curentColors = themeSetting.colors;
  89593. // curentColors = ColorsPickerUtil.getGradientColors(curentColors, itemNum, 'RANGE');
  89594. for (let index = 0; index < itemNum; index++) {
  89595. if (index in customSettings) {
  89596. if (customSettings[index]['segment']['start']) {
  89597. segements[index] = customSettings[index]['segment']['start'];
  89598. }
  89599. if (customSettings[index]['segment']['end']) {
  89600. segements[index + 1] = customSettings[index]['segment']['end'];
  89601. }
  89602. }
  89603. }
  89604. //生成styleGroup
  89605. let styleGroups = [];
  89606. for (let i = 0; i < itemNum; i++) {
  89607. let color = curentColors[i];
  89608. if (i in customSettings) {
  89609. if (customSettings[i].color) {
  89610. color = customSettings[i].color;
  89611. }
  89612. }
  89613. if (featureType === 'LINE') {
  89614. style.strokeColor = color;
  89615. } else {
  89616. style.fillColor = color;
  89617. }
  89618. let start = segements[i];
  89619. let end = segements[i + 1];
  89620. let styleObj = JSON.parse(JSON.stringify(style));
  89621. styleGroups.push({ style: styleObj, color: color, start: start, end: end });
  89622. }
  89623. return styleGroups;
  89624. }
  89625. }
  89626. /**
  89627. * @private
  89628. * @function WebMap.prototype._formatGeoJSON
  89629. * @description 格式 GeoJSON。
  89630. * @param {GeoJSON} data - GeoJSON 数据。
  89631. */
  89632. _formatGeoJSON(data) {
  89633. let features = data.features;
  89634. features.forEach((row, index) => {
  89635. row.properties['index'] = index;
  89636. // TODO 待优化 坐标转换
  89637. // if (fileCode !== 'EPSG:4326') {
  89638. // if(row.geometry.coordinates[0] instanceof Array){
  89639. // row.geometry.coordinates.forEach((coords, index) => {
  89640. // let lnglat = this._unproject(coords);
  89641. // row.geometry.coordinates[index] = [lnglat.lng, lnglat.lat];
  89642. // }, this)
  89643. // return;
  89644. // }
  89645. // let lnglat = this._unproject(row.geometry.coordinates);
  89646. // row.geometry.coordinates = [lnglat.lng, lnglat.lat];
  89647. // }
  89648. });
  89649. return features;
  89650. }
  89651. /**
  89652. * @private
  89653. * @function WebMap.prototype._excelData2Feature将
  89654. * @description csv 和 xls 文件内容转换成 geojson
  89655. * @param content 文件内容
  89656. * @param layerInfo 图层信息
  89657. * @returns {Array} feature的数组集合
  89658. */
  89659. _excelData2Feature(dataContent) {
  89660. let fieldCaptions = dataContent.colTitles;
  89661. // let fileCode = layerInfo.projection;
  89662. //位置属性处理
  89663. let xfieldIndex = -1,
  89664. yfieldIndex = -1;
  89665. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  89666. if (this._isXField(fieldCaptions[i])) {
  89667. xfieldIndex = i;
  89668. }
  89669. if (this._isYField(fieldCaptions[i])) {
  89670. yfieldIndex = i;
  89671. }
  89672. }
  89673. // feature 构建后期支持坐标系 4326/3857
  89674. let features = [];
  89675. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  89676. let row = dataContent.rows[i];
  89677. let x = Number(row[xfieldIndex]),
  89678. y = Number(row[yfieldIndex]);
  89679. // let coordinates = [x, y];
  89680. // TODO 待优化 坐标转换
  89681. // if (fileCode !== 'EPSG:4326') {
  89682. // if(row.geometry.coordinates[0] instanceof Array){
  89683. // row.geometry.coordinates.forEach((coords, index) => {
  89684. // let lnglat = this._unproject(coords);
  89685. // row.geometry.coordinates[index] = [lnglat.lng, lnglat.lat];
  89686. // }, this)
  89687. // return;
  89688. // }
  89689. // let lnglat = this._unproject(row.geometry.coordinates);
  89690. // row.geometry.coordinates = [lnglat.lng, lnglat.lat];
  89691. // }
  89692. //属性信息
  89693. let attributes = {};
  89694. for (let index in dataContent.colTitles) {
  89695. let key = dataContent.colTitles[index];
  89696. attributes[key] = dataContent.rows[i][index];
  89697. }
  89698. attributes['index'] = i + '';
  89699. //目前csv 只支持处理点,所以先生成点类型的 geojson
  89700. let feature = {
  89701. type: 'Feature',
  89702. geometry: {
  89703. type: 'Point',
  89704. coordinates: [x, y]
  89705. },
  89706. properties: attributes
  89707. };
  89708. features.push(feature);
  89709. }
  89710. return features;
  89711. }
  89712. /**
  89713. * @private
  89714. * @function WebMap.prototype._sendMapToUser
  89715. * @description 返回最终的 map 对象给用户,供他们操作使用。
  89716. * @param count
  89717. * @param layersLen
  89718. */
  89719. _sendMapToUser(count, layersLen) {
  89720. if (count === layersLen) {
  89721. /**
  89722. * @event WebMap#addlayerssucceeded
  89723. * @description 添加图层成功。
  89724. * @property {mapboxgl.Map} map - MapBoxGL Map 对象。
  89725. * @property {Object} mapparams - 地图信息。
  89726. * @property {string} mapparams.title - 地图标题。
  89727. * @property {string} mapparams.description - 地图描述。
  89728. * @property {Array.<Object>} layers - 地图上所有的图层对象
  89729. */
  89730. this.fire('addlayerssucceeded', { map: this.map, mapparams: this.mapParams, layers: this.layers });
  89731. }
  89732. }
  89733. /**
  89734. * @function WebMap.prototype._unproject
  89735. * @private
  89736. * @description 墨卡托转经纬度。
  89737. * @param {} point - 待转换的点。
  89738. */
  89739. _unproject(point) {
  89740. var d = 180 / Math.PI,
  89741. r = 6378137,
  89742. ts = Math.exp(-point[1] / r),
  89743. phi = Math.PI / 2 - 2 * Math.atan(ts);
  89744. for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) {
  89745. con = 1;
  89746. dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;
  89747. phi += dphi;
  89748. }
  89749. return new (external_mapboxgl_default()).LngLat((point[0] * d) / r, phi * d);
  89750. }
  89751. /**
  89752. * @function WebMap.prototype._getParamString
  89753. * @private
  89754. * @param {Object} obj - 待添加的参数。
  89755. * @param {string} existingUrl - 待添加参数的 url。
  89756. * @param {boolean} [uppercase] - 参数是否转换为大写。
  89757. */
  89758. _getParamString(obj, existingUrl, uppercase) {
  89759. var params = [];
  89760. for (var i in obj) {
  89761. params.push((uppercase ? i.toUpperCase() : i) + '=' + obj[i]);
  89762. }
  89763. return (!existingUrl || existingUrl.indexOf('?') === -1 ? '?' : '&') + params.join('&');
  89764. }
  89765. /**
  89766. * @private
  89767. * @description 判断是否地理X坐标
  89768. * @param data
  89769. */
  89770. _isXField(data) {
  89771. var lowerdata = data.toLowerCase();
  89772. return (
  89773. lowerdata === 'x' ||
  89774. lowerdata === 'smx' ||
  89775. lowerdata === 'jd' ||
  89776. lowerdata === '经度' ||
  89777. lowerdata === '东经' ||
  89778. lowerdata === 'longitude' ||
  89779. lowerdata === 'lot' ||
  89780. lowerdata === 'lon' ||
  89781. lowerdata === 'lng'
  89782. );
  89783. }
  89784. /**
  89785. * @private
  89786. * @description 判断是否地理Y坐标
  89787. * @param data
  89788. */
  89789. _isYField(data) {
  89790. var lowerdata = data.toLowerCase();
  89791. return (
  89792. lowerdata === 'y' ||
  89793. lowerdata === 'smy' ||
  89794. lowerdata === 'wd' ||
  89795. lowerdata === '纬度' ||
  89796. lowerdata === '北纬' ||
  89797. lowerdata === 'latitude' ||
  89798. lowerdata === 'lat'
  89799. );
  89800. }
  89801. /**
  89802. * @private
  89803. * @function WebMap.prototype._transformStyleToMapBoxGl
  89804. * @description 根据图层类型将 layerInfo 中的 style 属性格式转换为 mapboxgl 中的 style 格式。
  89805. * @param {Object} style - layerInfo中的style属性
  89806. * @param {string} type - 图层类型
  89807. * @param {Array} [expression] - 存储颜色值得表达式
  89808. */
  89809. _transformStyleToMapBoxGl(style, type, expression) {
  89810. let transTable = {};
  89811. if ((style.type === 'POINT' || style.type === 'BASIC_POINT' || type === 'POINT') && type !== 'LINE') {
  89812. transTable = {
  89813. fillColor: 'circle-color',
  89814. strokeWidth: 'circle-stroke-width',
  89815. fillOpacity: 'circle-opacity',
  89816. radius: 'circle-radius',
  89817. strokeColor: 'circle-stroke-color',
  89818. strokeOpacity: 'circle-stroke-opacity'
  89819. };
  89820. } else if (type === 'LINE') {
  89821. transTable = {
  89822. strokeWidth: 'line-width',
  89823. strokeColor: 'line-color',
  89824. strokeOpacity: 'line-opacity'
  89825. };
  89826. } else if (type === 'POLYGON') {
  89827. transTable = {
  89828. fillColor: 'fill-color',
  89829. fillOpacity: 'fill-opacity',
  89830. strokeColor: 'fill-outline-color'
  89831. };
  89832. }
  89833. let newObj = {};
  89834. for (let item in style) {
  89835. if (transTable[item]) {
  89836. newObj[transTable[item]] = style[item];
  89837. }
  89838. }
  89839. if (expression) {
  89840. if (newObj['circle-color']) {
  89841. newObj['circle-color'] = expression;
  89842. } else if (newObj['line-color']) {
  89843. newObj['line-color'] = expression;
  89844. } else {
  89845. newObj['fill-color'] = expression;
  89846. }
  89847. }
  89848. if (style.lineDash && style.lineDash !== 'solid' && type === 'LINE') {
  89849. newObj['line-dasharray'] = this._dashStyle(style);
  89850. }
  89851. return newObj;
  89852. }
  89853. /**
  89854. * @private
  89855. * @function WebMap.prototype.._dashStyle
  89856. * @description 符号样式。
  89857. * @param {Object} style - 样式参数。
  89858. * @param {number} widthFactor - 宽度系数。
  89859. */
  89860. _dashStyle(style) {
  89861. if (!style) {
  89862. return [];
  89863. }
  89864. // var w = style.strokeWidth * widthFactor;
  89865. var w = 1;
  89866. var str = style.strokeDashstyle || style.lineDash;
  89867. switch (str) {
  89868. case 'solid':
  89869. return [];
  89870. case 'dot':
  89871. return [1, 4 * w];
  89872. case 'dash':
  89873. return [4 * w, 4 * w];
  89874. case 'dashdot':
  89875. return [4 * w, 4 * w, 1 * w, 4 * w];
  89876. case 'longdash':
  89877. return [8 * w, 4 * w];
  89878. case 'longdashdot':
  89879. return [8 * w, 4 * w, 1, 4 * w];
  89880. default:
  89881. if (!str) {
  89882. return [];
  89883. }
  89884. if (Util_Util.isArray(str)) {
  89885. return str;
  89886. }
  89887. str = StringExt.trim(str).replace(/\s+/g, ',');
  89888. return str.replace(/\[|\]/gi, '').split(',');
  89889. }
  89890. }
  89891. /**
  89892. * @private
  89893. * @description 将SVG转换成Canvas
  89894. * @param svgUrl
  89895. * @param divDom
  89896. * @param callBack
  89897. */
  89898. _getCanvasFromSVG(svgUrl, divDom, callBack) {
  89899. //一个图层对应一个canvas
  89900. let canvas = document.createElement('canvas');
  89901. canvas.id = 'dataviz-canvas-' + core_Util_Util.newGuid(8);
  89902. canvas.style.display = 'none';
  89903. divDom.appendChild(canvas);
  89904. const canvgs = window.canvg && window.canvg.default ? window.canvg.default : (external_function_try_return_canvg_catch_e_return_default());
  89905. const ctx = canvas.getContext('2d');
  89906. canvgs.from(ctx, svgUrl, {
  89907. ignoreMouse: true,
  89908. ignoreAnimation: true,
  89909. forceRedraw: () => false
  89910. }).then(v => {
  89911. v.start();
  89912. this._canvgsV.push(v);
  89913. if (canvas.width > 300 || canvas.height > 300) {
  89914. return;
  89915. }
  89916. callBack(canvas);
  89917. });
  89918. }
  89919. _stopCanvg() {
  89920. this._canvgsV.forEach(v => v.stop());
  89921. this._canvgsV = [];
  89922. }
  89923. /**
  89924. * @private
  89925. * @function WebMap.prototype._addOverlayToMap
  89926. * @description 添加基础矢量图层到 MAP
  89927. * @param {Object} style - mabgl style
  89928. * @param {string} type - 图层类型
  89929. */
  89930. _addOverlayToMap(type, source, layerID, layerStyle) {
  89931. let mbglTypeMap = {
  89932. POINT: 'circle',
  89933. LINE: 'line',
  89934. POLYGON: 'fill'
  89935. };
  89936. type = mbglTypeMap[type];
  89937. if (type === 'circle' || type === 'line' || type === 'fill') {
  89938. this.map.addLayer({
  89939. id: layerID,
  89940. type: type,
  89941. source: source,
  89942. paint: layerStyle.style,
  89943. layout: layerStyle.layout || {}
  89944. });
  89945. }
  89946. }
  89947. _addBaselayer(url, layerID, minzoom = 0, maxzoom = 22, isIserver) {
  89948. this.map.addLayer({
  89949. id: layerID,
  89950. type: 'raster',
  89951. source: {
  89952. type: 'raster',
  89953. tiles: url,
  89954. tileSize: 256,
  89955. rasterSource: isIserver ? 'iserver' : '',
  89956. prjCoordSys: isIserver ? { epsgCode: this.baseProjection.split(':')[1] } : ''
  89957. },
  89958. minzoom: minzoom,
  89959. maxzoom: maxzoom
  89960. });
  89961. }
  89962. /**
  89963. * @private
  89964. * @function WebMap.prototype._addStrokeLineForPoly
  89965. * @description 添加面的边框。
  89966. * @param {Object} style - mabgl style
  89967. */
  89968. _addStrokeLineForPoly(style, source, layerID, visible) {
  89969. let lineStyle = {};
  89970. lineStyle.style = this._transformStyleToMapBoxGl(style, 'LINE');
  89971. lineStyle.layout = { visibility: visible };
  89972. this._addOverlayToMap('LINE', source, layerID, lineStyle);
  89973. }
  89974. /**
  89975. * @private
  89976. * @function WebMap.prototype._parseGeoJsonData2Feature
  89977. * @description 将从restData地址上获取的json转换成feature(从iserver中获取的json转换成feature)
  89978. * @param {Object} metaData - json内容
  89979. * @returns {Array} mabgl.feature的数组集合
  89980. */
  89981. _parseGeoJsonData2Feature(metaData) {
  89982. let allFeatures = metaData.allDatas.features,
  89983. features = [];
  89984. for (let i = 0, len = allFeatures.length; i < len; i++) {
  89985. // TODO 坐标转换
  89986. let feature = allFeatures[i];
  89987. let coordinate = feature.geometry.coordinates;
  89988. if (allFeatures[i].geometry.type === 'Point') {
  89989. // 标注图层 还没有属性值时候不加
  89990. if (allFeatures[i].properties) {
  89991. allFeatures[i].properties.lon = coordinate[0];
  89992. allFeatures[i].properties.lat = coordinate[1];
  89993. }
  89994. }
  89995. feature.properties['index'] = i + '';
  89996. features.push(feature);
  89997. }
  89998. return features;
  89999. }
  90000. /**
  90001. * @private
  90002. * @function WebMap.prototype._getFeatureBySQL
  90003. * @description 通过 sql 方式查询数据。
  90004. */
  90005. _getFeatureBySQL(url, datasetNames, processCompleted, processFaild) {
  90006. let getFeatureParam, getFeatureBySQLService, getFeatureBySQLParams;
  90007. getFeatureParam = new FilterParameter({
  90008. name: datasetNames.join().replace(':', '@'),
  90009. attributeFilter: 'SMID > 0'
  90010. });
  90011. getFeatureBySQLParams = new GetFeaturesBySQLParameters({
  90012. queryParameter: getFeatureParam,
  90013. datasetNames: datasetNames,
  90014. fromIndex: 0,
  90015. toIndex: 100000,
  90016. returnContent: true
  90017. });
  90018. let options = {
  90019. eventListeners: {
  90020. processCompleted: getFeaturesEventArgs => {
  90021. processCompleted && processCompleted(getFeaturesEventArgs);
  90022. },
  90023. processFailed: e => {
  90024. processFaild && processFaild(e);
  90025. }
  90026. }
  90027. };
  90028. getFeatureBySQLService = new GetFeaturesBySQLService(url, options);
  90029. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  90030. }
  90031. /**
  90032. * @private
  90033. * @function WebMap.prototype._queryFeatureBySQL
  90034. * @description 通过 sql 方式查询数据。
  90035. */
  90036. _queryFeatureBySQL(
  90037. url,
  90038. layerName,
  90039. attributeFilter,
  90040. fields,
  90041. epsgCode,
  90042. processCompleted,
  90043. processFaild,
  90044. startRecord,
  90045. recordLength,
  90046. onlyAttribute
  90047. ) {
  90048. var queryParam, queryBySQLParams, queryBySQLService;
  90049. queryParam = new FilterParameter({
  90050. name: layerName,
  90051. attributeFilter: attributeFilter
  90052. });
  90053. if (fields) {
  90054. queryParam.fields = fields;
  90055. }
  90056. var params = {
  90057. queryParams: [queryParam]
  90058. };
  90059. if (onlyAttribute) {
  90060. params.queryOption = QueryOption.ATTRIBUTE;
  90061. }
  90062. startRecord && (params.startRecord = startRecord);
  90063. recordLength && (params.expectCount = recordLength);
  90064. if (epsgCode) {
  90065. params.prjCoordSys = {
  90066. epsgCode: epsgCode
  90067. };
  90068. }
  90069. queryBySQLParams = new QueryBySQLParameters(params);
  90070. queryBySQLService = new QueryService(url);
  90071. queryBySQLService.queryBySQL(queryBySQLParams, data => {
  90072. data.type === 'processCompleted' ? processCompleted(data) : processFaild(data);
  90073. });
  90074. }
  90075. /**
  90076. * @private
  90077. * @function WebMap.prototype._handleMultyPolygon
  90078. * @description 处理复杂面情况
  90079. */
  90080. _handleMultyPolygon(features) {
  90081. features.forEach(feature => {
  90082. if (feature.geometry.type !== 'Polygon') {
  90083. return;
  90084. }
  90085. let coords = feature.geometry.coordinates;
  90086. if (coords.length > 1) {
  90087. let coordinates = [];
  90088. coords.forEach(coord => {
  90089. coordinates.push([coord]);
  90090. });
  90091. feature.geometry.coordinates = coordinates;
  90092. feature.geometry.type = 'MultiPolygon';
  90093. }
  90094. });
  90095. return features;
  90096. }
  90097. _transformScaleToZoom(scale, crs) {
  90098. let scale_0 = 295829515.2024169;
  90099. if ((crs || this.map.getCRS()).epsgCode !== 'EPSG:3857') {
  90100. scale_0 = 295295895;
  90101. }
  90102. const scaleDenominator = scale.split(':')[1];
  90103. return Math.min(24, +Math.log2(scale_0 / +scaleDenominator).toFixed(2));
  90104. }
  90105. _getResolution(bounds, tileSize = 512.0) {
  90106. if (bounds.leftBottom && bounds.rightTop) {
  90107. return Math.max(bounds.rightTop.x - bounds.leftBottom.x, bounds.rightTop.y - bounds.leftBottom.y) / tileSize;
  90108. }
  90109. return Math.max(bounds[2] - bounds[0], bounds[3] - bounds[1]) / tileSize;
  90110. }
  90111. }
  90112. ;// CONCATENATED MODULE: ./src/mapboxgl/mapping/index.js
  90113. ;// CONCATENATED MODULE: ./src/mapboxgl/index.js
  90114. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  90115. * This program are made available under the terms of the Apache License, Version 2.0
  90116. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  90117. ;// CONCATENATED MODULE: ./src/mapboxgl/namespace.js
  90118. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  90119. * This program are made available under the terms of the Apache License, Version 2.0
  90120. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  90121. (external_mapboxgl_default()).supermap = {...SuperMap, ...(external_mapboxgl_default()).supermap};
  90122. (external_mapboxgl_default()).supermap.map = (external_mapboxgl_default()).supermap.map || {};
  90123. (external_mapboxgl_default()).supermap.LogoControl = Logo;
  90124. (external_mapboxgl_default()).supermap.Logo = Logo;
  90125. (external_mapboxgl_default()).supermap.Util = core_Util_Util;
  90126. (external_mapboxgl_default()).supermap.WebMap = WebMap;
  90127. (external_mapboxgl_default()).supermap.Graphic = Graphic;
  90128. (external_mapboxgl_default()).supermap.map.getDefaultVectorTileStyle = getDefaultVectorTileStyle;
  90129. (external_mapboxgl_default()).supermap.map.setBackground = setBackground;
  90130. (external_mapboxgl_default()).supermap.map.setPaintProperty = setPaintProperty;
  90131. (external_mapboxgl_default()).supermap.MapvDataSet = MapvDataSet;
  90132. (external_mapboxgl_default()).supermap.GeoFeatureThemeLayer = GeoFeature;
  90133. (external_mapboxgl_default()).supermap.Theme3DLayer = Theme3DLayer;
  90134. (external_mapboxgl_default()).supermap.ThemeFeature = ThemeFeature;
  90135. (external_mapboxgl_default()).supermap.ThemeLayer = ThemeLayer_Theme;
  90136. (external_mapboxgl_default()).supermap.Transform = Transform;
  90137. (external_mapboxgl_default()).supermap.WebSymbol = WebSymbol;
  90138. (external_mapboxgl_default()).supermap.DeckglLayer = DeckglLayer;
  90139. (external_mapboxgl_default()).supermap.GraphicLayer = GraphicLayer;
  90140. (external_mapboxgl_default()).supermap.GraphThemeLayer = Graph;
  90141. (external_mapboxgl_default()).supermap.GraticuleLayer = GraticuleLayer;
  90142. (external_mapboxgl_default()).supermap.HeatMapLayer = HeatMapLayer;
  90143. (external_mapboxgl_default()).supermap.LabelThemeLayer = LabelThemeLayer_Label;
  90144. (external_mapboxgl_default()).supermap.MapvLayer = MapvLayer;
  90145. (external_mapboxgl_default()).supermap.FGBLayer = FGBLayer;
  90146. (external_mapboxgl_default()).supermap.RangeTheme3DLayer = RangeTheme3DLayer;
  90147. (external_mapboxgl_default()).supermap.RangeThemeLayer = Range;
  90148. (external_mapboxgl_default()).supermap.RankSymbolThemeLayer = RankSymbol;
  90149. (external_mapboxgl_default()).supermap.ThreeLayer = ThreeLayer;
  90150. (external_mapboxgl_default()).supermap.UniqueTheme3DLayer = UniqueTheme3DLayer;
  90151. (external_mapboxgl_default()).supermap.UniqueThemeLayer = Unique;
  90152. (external_mapboxgl_default()).supermap.GraphMap = GraphMap;
  90153. (external_mapboxgl_default()).supermap.AddressMatchService = AddressMatchService;
  90154. (external_mapboxgl_default()).supermap.ChartService = ChartService;
  90155. (external_mapboxgl_default()).supermap.DataFlowService = DataFlowService;
  90156. (external_mapboxgl_default()).supermap.DatasetService = DatasetService;
  90157. (external_mapboxgl_default()).supermap.DatasourceService = DatasourceService;
  90158. (external_mapboxgl_default()).supermap.FeatureService = FeatureService;
  90159. (external_mapboxgl_default()).supermap.FieldService = FieldService;
  90160. (external_mapboxgl_default()).supermap.GeoprocessingService = GeoprocessingService;
  90161. (external_mapboxgl_default()).supermap.GridCellInfosService = GridCellInfosService;
  90162. (external_mapboxgl_default()).supermap.ImageCollectionService = ImageCollectionService;
  90163. (external_mapboxgl_default()).supermap.ImageService = ImageService;
  90164. (external_mapboxgl_default()).supermap.LayerInfoService = LayerInfoService;
  90165. (external_mapboxgl_default()).supermap.MapService = MapService;
  90166. (external_mapboxgl_default()).supermap.MeasureService = MeasureService;
  90167. (external_mapboxgl_default()).supermap.NetworkAnalyst3DService = NetworkAnalyst3DService;
  90168. (external_mapboxgl_default()).supermap.NetworkAnalystService = NetworkAnalystService;
  90169. (external_mapboxgl_default()).supermap.ProcessingService = ProcessingService;
  90170. (external_mapboxgl_default()).supermap.QueryService = QueryService;
  90171. (external_mapboxgl_default()).supermap.ServiceBase = ServiceBase;
  90172. (external_mapboxgl_default()).supermap.SpatialAnalystService = SpatialAnalystService;
  90173. (external_mapboxgl_default()).supermap.ThemeService = ThemeService;
  90174. (external_mapboxgl_default()).supermap.TrafficTransferAnalystService = TrafficTransferAnalystService;
  90175. (external_mapboxgl_default()).supermap.WebPrintingJobService = WebPrintingJobService;
  90176. (external_mapboxgl_default()).supermap.KnowledgeGraphService = KnowledgeGraphService;
  90177. (external_mapboxgl_default()).supermap.Components.ChartView = ChartView;
  90178. // 处理命名空间重名
  90179. (external_mapboxgl_default()).supermap.CommonUtil = Util_Util;
  90180. })();
  90181. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  90182. (() => {
  90183. "use strict";
  90184. })();
  90185. /******/ })()
  90186. ;